From Vassil: substitute then / else (ROOT-6345).
VisitCompoundStmt correctly substitutes the child Stmts. When calling Visit() on a Stmt, this substitution needs to be carried out by the caller: only it knows what target type to request. This fixes the issue for if statements which do not fall back to VisitStmt() because of the conditional being of bool type. In principle we are still missing do / while statements, too - again due to the conditional part.
This commit is contained in:
parent
a57c866b3d
commit
cea02a82e7
@ -287,11 +287,19 @@ namespace cling {
|
|||||||
//return ASTNodeInfo(Node, /*needs eval*/false);
|
//return ASTNodeInfo(Node, /*needs eval*/false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Visit the other parts - they will fall naturally into Stmt or
|
// Visit the other parts - they will fall naturally into CompoundStmt
|
||||||
// CompoundStmt where we know what to do.
|
// where we know what to do. For Stmt, though, we need to substitute here,
|
||||||
Visit(Node->getThen());
|
// knowing the "target" type.
|
||||||
if (Stmt* ElseExpr = Node->getElse())
|
ASTNodeInfo thenInfo = Visit(Node->getThen());
|
||||||
Visit(ElseExpr);
|
if (thenInfo.isForReplacement())
|
||||||
|
Node->setThen(SubstituteUnknownSymbol(m_Context->VoidTy,
|
||||||
|
thenInfo.getAs<Expr>()));
|
||||||
|
if (Stmt* ElseExpr = Node->getElse()) {
|
||||||
|
ASTNodeInfo elseInfo = Visit(ElseExpr);
|
||||||
|
if (elseInfo.isForReplacement())
|
||||||
|
Node->setElse(SubstituteUnknownSymbol(m_Context->VoidTy,
|
||||||
|
elseInfo.getAs<Expr>()));
|
||||||
|
}
|
||||||
|
|
||||||
return ASTNodeInfo(Node, false);
|
return ASTNodeInfo(Node, false);
|
||||||
}
|
}
|
||||||
@ -564,7 +572,7 @@ namespace cling {
|
|||||||
|
|
||||||
ASTNodeInfo EvaluateTSynthesizer::VisitCallExpr(CallExpr* E) {
|
ASTNodeInfo EvaluateTSynthesizer::VisitCallExpr(CallExpr* E) {
|
||||||
// FIXME: Maybe we need to handle the arguments
|
// FIXME: Maybe we need to handle the arguments
|
||||||
// ASTNodeInfo NewNode = Visit(E->getCallee());
|
//ASTNodeInfo NewNode = Visit(E->getCallee());
|
||||||
return ASTNodeInfo (E, IsArtificiallyDependent(E));
|
return ASTNodeInfo (E, IsArtificiallyDependent(E));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user