aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-11-13 09:57:06 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-11-13 09:57:06 +0000
commit3d0dab330beb7ab5e0450a56f0c5c45fda06a0e3 (patch)
tree9f1389999976b44127de9c2d08f5f4843fe6136b
parentc2f484f1f05216a9a427ac84b5773789a4661111 (diff)
Simplify, in anticipation of introducing explicit action instances.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87101 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/clang-cc/clang-cc.cpp35
1 files changed, 16 insertions, 19 deletions
diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp
index 8e969479e7..7cdf2ac8b0 100644
--- a/tools/clang-cc/clang-cc.cpp
+++ b/tools/clang-cc/clang-cc.cpp
@@ -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) {