Lint check for pure virtual in non-virtual class.
This commit is contained in:
parent
123d1af29d
commit
ed268805ce
|
|
@ -205,6 +205,15 @@ private:
|
||||||
nodep->virtRefDTypep(editOneDType(nodep->virtRefDTypep()));
|
nodep->virtRefDTypep(editOneDType(nodep->virtRefDTypep()));
|
||||||
nodep->virtRefDType2p(editOneDType(nodep->virtRefDType2p()));
|
nodep->virtRefDType2p(editOneDType(nodep->virtRefDType2p()));
|
||||||
}
|
}
|
||||||
|
virtual void visit(AstNodeFTask* nodep) override {
|
||||||
|
iterateChildren(nodep);
|
||||||
|
editDType(nodep);
|
||||||
|
if (nodep->classMethod() && nodep->pureVirtual() && VN_IS(m_modp, Class)
|
||||||
|
&& !VN_CAST(m_modp, Class)->isVirtual()) {
|
||||||
|
nodep->v3error(
|
||||||
|
"Illegal to have 'pure virtual' in non-virtual class (IEEE 1800-2017 8.21)");
|
||||||
|
}
|
||||||
|
}
|
||||||
virtual void visit(AstNodeVarRef* nodep) override {
|
virtual void visit(AstNodeVarRef* nodep) override {
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
editDType(nodep);
|
editDType(nodep);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
%Error-UNSUPPORTED: t/t_class_virtual_pure.v:8:22: Unsupported: 'virtual' class method
|
|
||||||
8 | pure virtual task hello();
|
|
||||||
| ^~~~~
|
|
||||||
%Error-UNSUPPORTED: t/t_class_virtual_pure.v:7:9: Unsupported: virtual class
|
|
||||||
7 | virtual class VC;
|
|
||||||
| ^~~~~
|
|
||||||
%Error: Exiting due to
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
%Error: t/t_class_virtual_pure_bad.v:8:22: Illegal to have 'pure virtual' in non-virtual class (IEEE 1800-2017 8.21)
|
||||||
|
8 | pure virtual task pure_task;
|
||||||
|
| ^~~~~~~~~
|
||||||
|
%Error: Exiting due to
|
||||||
|
|
@ -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;
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
// 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
|
||||||
|
|
||||||
|
class VBase;
|
||||||
|
pure virtual task pure_task;
|
||||||
|
endclass
|
||||||
Loading…
Reference in New Issue