Simplify, in anticipation of introducing explicit action instances.

llvm-svn: 87101
This commit is contained in:
Daniel Dunbar 2009-11-13 09:57:06 +00:00
parent f7093b5ae8
commit 39991862e1
1 changed files with 16 additions and 19 deletions

View File

@ -460,27 +460,33 @@ static void ProcessInputFile(CompilerInstance &CI, const std::string &InFile,
}
}
const std::string &ImplicitPCHInclude =
CI.getPreprocessorOpts().getImplicitPCHInclude();
if (Consumer) {
// Create the ASTContext.
CI.createASTContext();
// Create the external AST source when using PCH.
const std::string &ImplicitPCHInclude =
CI.getPreprocessorOpts().getImplicitPCHInclude();
if (!ImplicitPCHInclude.empty()) {
CI.createPCHExternalASTSource(ImplicitPCHInclude);
if (!CI.getASTContext().getExternalSource())
return;
} else {
// Initialize builtin info when not using PCH.
PP.getBuiltinInfo().InitializeBuiltins(PP.getIdentifierTable(),
PP.getLangOptions().NoBuiltin);
}
}
// Initialize the main file entry. This needs to be delayed until after PCH
// has loaded.
if (InitializeSourceManager(PP, CI.getFrontendOpts(), InFile))
return;
// Initialize builtin info as long as we aren't using an external AST
// source.
if (!CI.hasASTContext() || !CI.getASTContext().getExternalSource())
PP.getBuiltinInfo().InitializeBuiltins(PP.getIdentifierTable(),
PP.getLangOptions().NoBuiltin);
// Initialize the main file entry. This needs to be delayed until after PCH
// has loaded.
if (InitializeSourceManager(PP, CI.getFrontendOpts(), InFile))
return;
if (Consumer) {
// FIXME: Move the truncation aspect of this into Sema.
if (!FEOpts.CodeCompletionAt.FileName.empty())
CI.createCodeCompletionConsumer();
@ -490,15 +496,6 @@ static void ProcessInputFile(CompilerInstance &CI, const std::string &InFile,
ParseAST(PP, Consumer.get(), CI.getASTContext(), FEOpts.ShowStats,
CompleteTranslationUnit, CompletionConsumer);
} else {
// Initialize builtin info.
PP.getBuiltinInfo().InitializeBuiltins(PP.getIdentifierTable(),
PP.getLangOptions().NoBuiltin);
// Initialize the main file entry. This needs to be delayed until after PCH
// has loaded.
if (InitializeSourceManager(PP, CI.getFrontendOpts(), InFile))
return;
// Run the preprocessor actions.
llvm::TimeRegion Timer(ClangFrontendTimer);
switch (PA) {