DynScopes: escape up to Stmt level (ROOT-9738).

This commit is contained in:
Axel Naumann 2018-10-29 11:37:30 +01:00 committed by sftnight
parent 69f1d35dd6
commit 778c416dc0

View File

@ -586,23 +586,19 @@ namespace cling {
} }
ASTNodeInfo EvaluateTSynthesizer::VisitExpr(Expr* Node) { ASTNodeInfo EvaluateTSynthesizer::VisitExpr(Expr* Node) {
bool NeedsEval = false;
for (Stmt::child_iterator for (Stmt::child_iterator
I = Node->child_begin(), E = Node->child_end(); I != E; ++I) { I = Node->child_begin(), E = Node->child_end(); I != E; ++I) {
if (*I) { if (*I) {
ASTNodeInfo NewNode = Visit(*I); ASTNodeInfo NewNode = Visit(*I);
assert(NewNode.hasSingleNode() && assert(NewNode.hasSingleNode() &&
"Cannot have more than one stmt at that point"); "Cannot have more than one stmt at that point");
if (NewNode.isForReplacement()) { if (NewNode.isForReplacement())
if (Expr *E = NewNode.getAs<Expr>()) NeedsEval = true;
// Assume void if still not escaped *I = NewNode.getAsSingleNode();
*I = SubstituteUnknownSymbol(m_Context->VoidTy, E);
}
else {
*I = NewNode.getAsSingleNode();
}
} }
} }
return ASTNodeInfo(Node, 0); return ASTNodeInfo(Node, NeedsEval);
} }
ASTNodeInfo EvaluateTSynthesizer::VisitBinaryOperator(BinaryOperator* Node) { ASTNodeInfo EvaluateTSynthesizer::VisitBinaryOperator(BinaryOperator* Node) {