Internals: Add cloneTreePure to prepare for side effect check.

Use cloneTreePure when what is being cloned must be side-effect free.
Use cloneTree when safe to contain side effects (e.g. cloning module).
This commit is contained in:
Wilson Snyder
2023-09-16 22:50:54 -04:00
parent cd1fe64e6c
commit 761adf1cf0
25 changed files with 193 additions and 180 deletions
+1 -1
View File
@@ -292,7 +292,7 @@ private:
}
void replaceSubstEtc(AstNode* nodep, AstNodeExpr* substp) {
if (debug() > 5) nodep->dumpTree("- substw_old: ");
AstNodeExpr* newp = substp->cloneTree(true);
AstNodeExpr* newp = substp->cloneTreePure(true);
if (!nodep->isQuad() && newp->isQuad()) {
newp = new AstCCast{newp->fileline(), newp, nodep};
}