Parser: Move 'virtual class' block unsupported messages down out of parser

This commit is contained in:
Wilson Snyder 2020-06-29 21:03:14 -04:00
parent 748c818ccb
commit af197f2ceb
8 changed files with 39 additions and 9 deletions

View File

@ -301,6 +301,7 @@ class AstClass : public AstNodeModule {
// MEMBERS
MemberNameMap m_members; // Members or method children
AstClassPackage* m_packagep; // Class package this is under
bool m_virtual; // Virtual class
void insertCache(AstNode* nodep);
public:
@ -333,6 +334,8 @@ public:
MemberNameMap::const_iterator it = m_members.find(name);
return (it == m_members.end()) ? NULL : it->second;
}
bool isVirtual() const { return m_virtual; }
void isVirtual(bool flag) { m_virtual = flag; }
};
class AstClassExtends : public AstNode {

View File

@ -1962,6 +1962,7 @@ private:
virtual void visit(AstClass* nodep) VL_OVERRIDE {
if (nodep->didWidthAndSet()) return;
userIterateChildren(nodep, NULL); // First size all members
if (nodep->isVirtual()) nodep->v3warn(E_UNSUPPORTED, "Unsupported: virtual class");
nodep->repairCache();
}
virtual void visit(AstClassRefDType* nodep) VL_OVERRIDE {

View File

@ -5804,6 +5804,7 @@ class_declaration<nodep>: // ==IEEE: part of class_declaration
classFront<classp>: // IEEE: part of class_declaration
classVirtualE yCLASS lifetimeE idAny/*class_identifier*/
{ $$ = new AstClass($2, *$4);
$$->isVirtual($1);
$$->lifetime($3);
SYMP->pushNew($<classp>$); }
// // IEEE: part of interface_class_declaration
@ -5814,9 +5815,9 @@ classFront<classp>: // IEEE: part of class_declaration
BBUNSUP($2, "Unsupported: interface classes"); }
;
classVirtualE:
/* empty */ { }
| yVIRTUAL__CLASS { BBUNSUP($1, "Unsupported: virtual classes"); }
classVirtualE<cbool>:
/* empty */ { $$ = false; }
| yVIRTUAL__CLASS { $$ = true; }
;
classExtendsE<nodep>: // IEEE: part of class_declaration

View File

@ -22,9 +22,6 @@
%Error-UNSUPPORTED: t/t_class_unsup_bad.v:29:4: Unsupported: extern class method prototype
29 | extern task exttask;
| ^~~~~~
%Error-UNSUPPORTED: t/t_class_unsup_bad.v:32:1: Unsupported: virtual classes
32 | virtual class VC;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_class_unsup_bad.v:42:4: Unsupported: virtual class member qualifier
42 | virtual function uvm_root get_root();
| ^~~~~~~

View File

@ -0,0 +1,4 @@
%Error-UNSUPPORTED: t/t_class_virtual.v:7:9: Unsupported: virtual class
7 | virtual class VC;
| ^~~~~
%Error: Exiting due to

View File

@ -0,0 +1,19 @@
#!/usr/bin/env perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2020 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(vlt => 1);
lint(
fails => 1,
expect_filename => $Self->{golden_filename},
);
ok(1);
1;

View File

@ -0,0 +1,8 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2019 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
virtual class VC;
endclass

View File

@ -1,6 +1,3 @@
%Error-UNSUPPORTED: t/t_class_vparam_unsup.v:12:1: Unsupported: virtual classes
12 | virtual class vclass #(type CTYPE_t = arg_class_t);
| ^~~~~~~
%Error-UNSUPPORTED: t/t_class_vparam_unsup.v:13:58: Unsupported: Parameter classes
13 | pure virtual function void funcname(paramed_class_t #(CTYPE_t) v);
| ^~~~~~~