Restore Parser state before committing the associated transaction.

In LookupHelper::findType, we switch the RAII for the transaction
and for the parser so that the parser state is restored before
the transaction is committed.   This fixes the execution of

 gROOT->GetListOfTypes()->FindObject("deque<ROOT::TTreeReaderValueBase*>::_Alloc_value_type"); gROOT->GetListOfTypes()->FindObject("deque<ROOT::TTreeReaderValueBase*>::const_iterator");

When both statement were in the same transaction, without this
change, the 2nd one would return (incorrectly) zero.
This commit is contained in:
Philippe Canal 2013-08-15 08:33:14 -05:00 committed by sftnight
parent 694eb20c36
commit 26995d74d1

View File

@ -80,6 +80,9 @@ namespace cling {
//
QualType TheQT;
// Could trigger deserialization of decls.
Interpreter::PushTransactionRAII RAII(m_Interpreter);
// Use P for shortness
Parser& P = *m_Parser;
ParserStateRAII ResetParserState(P);
@ -87,8 +90,6 @@ namespace cling {
//
// Try parsing the type name.
//
// Could trigger deserialization of decls.
Interpreter::PushTransactionRAII RAII(m_Interpreter);
TypeResult Res(P.ParseTypeName());
if (Res.isUsable()) {
// Accept it only if the whole name was parsed.