Improve V3Ast function usage ergonomics (#3650)

Signed-off-by: HungMingWu <[email protected]>
This commit is contained in:
HungMingWu
2022-10-21 14:12:12 +01:00
committed by Geza Lore
parent 627a144b83
commit 196f3292d5
30 changed files with 343 additions and 260 deletions
+2 -2
View File
@@ -408,7 +408,7 @@ private:
// Replace varrefs with new var pointer
void relink(AstNode* nodep) {
nodep->foreachAndNext<AstVarRef>([](AstVarRef* refp) {
nodep->foreachAndNext([](AstVarRef* refp) {
if (refp->varp()->user2p()) { // It's being converted to an alias.
AstVarScope* const newvscp = VN_AS(refp->varp()->user2p(), VarScope);
refp->varScopep(newvscp);
@@ -1276,7 +1276,7 @@ private:
// Mark non-local variables written by the exported function
bool writesNonLocals = false;
cfuncp->foreach<AstVarRef>([&writesNonLocals](AstVarRef* refp) {
cfuncp->foreach([&writesNonLocals](AstVarRef* refp) {
if (refp->access().isReadOnly()) return; // Ignore read reference
AstVar* const varp = refp->varScopep()->varp();
// We are ignoring function locals as they should not be referenced anywhere