Dynamic lookup: replacing something in the condition doesn't mean that we should give up; there might be more to replace in the then / else parts.

Add a tests for that.
Fix involuntary test (using an undeclared printf) by fwd declaring printf.


git-svn-id: http://root.cern.ch/svn/root/trunk@48787 27541ba8-7e3a-0410-8455-c3a389f83636
This commit is contained in:
Axel Naumann 2013-03-01 15:13:01 +00:00
parent 756aceef51
commit 451a0e5066
2 changed files with 5 additions and 2 deletions

View File

@ -267,7 +267,7 @@ namespace cling {
if (IfCondInfo.isForReplacement())
if (Expr* IfCondExpr = IfCondInfo.getAs<Expr>()) {
Node->setCond(SubstituteUnknownSymbol(m_Context->BoolTy, IfCondExpr));
return ASTNodeInfo(Node, /*needs eval*/false);
//return ASTNodeInfo(Node, /*needs eval*/false);
}
// Visit the other parts - they will fall naturally into Stmt or
@ -781,6 +781,7 @@ namespace cling {
return false; // returning false will abort the in-depth traversal.
}
TraverseStmt(D->getBody());
return true; // returning false will abort the in-depth traversal.
}

View File

@ -19,12 +19,14 @@
#include "cling/Interpreter/Interpreter.h"
#include "cling/Interpreter/InterpreterCallbacks.h"
extern "C" int printf(const char*,...);
.dynamicExtensions
gCling->setCallbacks(new cling::test::SymbolResolverCallback(gCling));
int a[5] = {1,2,3,4,5};
if (h->PrintArray(a, 5)) { // runtime result type bool
whatever->PrintString("Replaced in then.\n");
printf("\n%s\n", "Array Printed Successfully!");
}
// CHECK: 12345