From cd50723fb1fbd9e5b194de30751c787c756a5bca Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Tue, 26 Mar 2013 09:59:19 +0000 Subject: [PATCH] Start and commit the transaction containing StartTU. To do: end and begin-of-next transaction should be tied together, else we might have decls not ending up in any transaction. git-svn-id: http://root.cern.ch/svn/root/branches/dev/root6-pch@48936 27541ba8-7e3a-0410-8455-c3a389f83636 --- lib/Interpreter/IncrementalParser.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/Interpreter/IncrementalParser.cpp b/lib/Interpreter/IncrementalParser.cpp index c133b3a2..6f2dec42 100644 --- a/lib/Interpreter/IncrementalParser.cpp +++ b/lib/Interpreter/IncrementalParser.cpp @@ -85,11 +85,12 @@ namespace cling { getCodeGenerator()->Initialize(getCI()->getASTContext()); const std::string& PCHFileName = m_CI->getInvocation ().getPreprocessorOpts().ImplicitPCHInclude; + + CompilationOptions CO; + CO.DeclarationExtraction = 0; + CO.ValuePrinting = CompilationOptions::VPDisabled; + CO.CodeGeneration = hasCodeGenerator(); if (!PCHFileName.empty()) { - CompilationOptions CO; - CO.DeclarationExtraction = 0; - CO.ValuePrinting = CompilationOptions::VPDisabled; - CO.CodeGeneration = hasCodeGenerator(); beginTransaction(CO); m_CI->createPCHExternalASTSource(PCHFileName, true /*DisablePCHValidation*/, @@ -99,6 +100,7 @@ namespace cling { commitTransaction(endTransaction()); } + beginTransaction(CO); Sema* TheSema = &m_CI->getSema(); m_Parser.reset(new Parser(m_CI->getPreprocessor(), *TheSema, false /*skipFuncBodies*/)); @@ -112,6 +114,7 @@ namespace cling { ExternalASTSource *External = TheSema->getASTContext().getExternalSource(); if (External) External->StartTranslationUnit(m_Consumer); + commitTransaction(endTransaction()); } IncrementalParser::~IncrementalParser() {