Open the transaction to collect declarations coming from the dynamic expressions.

This commit is contained in:
Vassil Vassilev 2013-06-17 12:46:49 +02:00 committed by sftnight
parent 93d0d81de2
commit 816b721f80

View File

@ -749,6 +749,12 @@ namespace cling {
MultiLevelTemplateArgumentList(TemplateArgs));
FunctionDecl* Fn = dyn_cast<FunctionDecl>(D);
// We expect incoming declarations (instantiations) and we
// need to open the transaction to collect them.
Transaction::State oldState = getTransaction()->getState();
getTransaction()->setState(Transaction::kCollecting);
// Creates new body of the substituted declaration
m_Sema->InstantiateFunctionDefinition(Fn->getLocation(), Fn, true, true);
@ -767,6 +773,8 @@ namespace cling {
m_NoSLoc
).takeAs<DeclRefExpr>();
getTransaction()->setState(oldState);
// TODO: Figure out a way to avoid passing in wrong source locations
// of the symbol being replaced. This is important when we calculate the
// size of the memory buffers and may lead to creation of wrong wrappers.