Teach ASTUnit to hold on to the Sema object and ASTConsumer that are

used when parsing (or re-parsing) a file. Also, when loading a
precompiled header into ASTUnit, create a Sema object that holds onto
semantic-analysis information.

llvm-svn: 111003
This commit is contained in:
Douglas Gregor
2010-08-13 03:15:25 +00:00
parent d89e349f06
commit 6fd55e06d3
5 changed files with 49 additions and 13 deletions

View File

@@ -44,6 +44,12 @@ void ASTMergeAction::ExecuteAction() {
if (!Unit)
continue;
// Reset the argument -> string function so that it has the AST
// context we want, since the Sema object created by
// LoadFromPCHFile will override it.
CI.getDiagnostics().SetArgToStringFn(&FormatASTNodeDiagnosticArgument,
&CI.getASTContext());
ASTImporter Importer(CI.getDiagnostics(),
CI.getASTContext(),
CI.getFileManager(),