diff options
author | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
commit | c72c57c9e9b69944e3e009cd5e209634839581d3 (patch) | |
tree | 4fc2f184c499d106f29a386c452b49e5197bf63d /lib/Frontend/FrontendAction.cpp | |
parent | 5b20025c30d23d521e12c1f33ec8fa6b821952cd (diff) | |
download | FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.zip FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.tar.gz |
Vendor import of clang trunk r178860:
http://llvm.org/svn/llvm-project/cfe/trunk@178860
Diffstat (limited to 'lib/Frontend/FrontendAction.cpp')
-rw-r--r-- | lib/Frontend/FrontendAction.cpp | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp index 2e9a791..6031ad2 100644 --- a/lib/Frontend/FrontendAction.cpp +++ b/lib/Frontend/FrontendAction.cpp @@ -11,8 +11,6 @@ #include "clang/AST/ASTConsumer.h" #include "clang/AST/ASTContext.h" #include "clang/AST/DeclGroup.h" -#include "clang/Lex/HeaderSearch.h" -#include "clang/Lex/Preprocessor.h" #include "clang/Frontend/ASTUnit.h" #include "clang/Frontend/ChainedIncludesSource.h" #include "clang/Frontend/CompilerInstance.h" @@ -20,15 +18,18 @@ #include "clang/Frontend/FrontendPluginRegistry.h" #include "clang/Frontend/LayoutOverrideSource.h" #include "clang/Frontend/MultiplexConsumer.h" +#include "clang/Lex/HeaderSearch.h" +#include "clang/Lex/Preprocessor.h" #include "clang/Parse/ParseAST.h" #include "clang/Serialization/ASTDeserializationListener.h" #include "clang/Serialization/ASTReader.h" +#include "clang/Serialization/GlobalModuleIndex.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/Timer.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/system_error.h" -#include "llvm/Support/Timer.h" using namespace clang; namespace { @@ -187,6 +188,10 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, setCurrentInput(Input, AST); + // Inform the diagnostic client we are processing a source file. + CI.getDiagnosticClient().BeginSourceFile(CI.getLangOpts(), 0); + HasBegunSourceFile = true; + // Set the shared objects, these are reset when we finish processing the // file, otherwise the CompilerInstance will happily destroy them. CI.setFileManager(&AST->getFileManager()); @@ -198,7 +203,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, if (!BeginSourceFileAction(CI, InputFile)) goto failure; - /// Create the AST consumer. + // Create the AST consumer. CI.setASTConsumer(CreateWrappedASTConsumer(CI, InputFile)); if (!CI.hasASTConsumer()) goto failure; @@ -246,16 +251,8 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, CI.getLangOpts(), CI.getTargetOpts(), CI.getPreprocessorOpts())) { - for (unsigned I = 0, N = PPOpts.Includes.size(); I != N; ++I) { - if (PPOpts.Includes[I] == PPOpts.ImplicitPCHInclude) { - PPOpts.Includes[I] = Dir->path(); - PPOpts.ImplicitPCHInclude = Dir->path(); - Found = true; - break; - } - } - - assert(Found && "Implicit PCH include not in includes list?"); + PPOpts.ImplicitPCHInclude = Dir->path(); + Found = true; break; } } @@ -279,8 +276,8 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, if (!BeginSourceFileAction(CI, InputFile)) goto failure; - /// Create the AST context and consumer unless this is a preprocessor only - /// action. + // Create the AST context and consumer unless this is a preprocessor only + // action. if (!usesPreprocessorOnly()) { CI.createASTContext(); @@ -290,8 +287,6 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, goto failure; CI.getASTContext().setASTMutationListener(Consumer->GetASTMutationListener()); - CI.getPreprocessor().setPPMutationListener( - Consumer->GetPPMutationListener()); if (!CI.getPreprocessorOpts().ChainedIncludes.empty()) { // Convert headers to PCH and chain them. @@ -380,6 +375,15 @@ bool FrontendAction::Execute() { } else ExecuteAction(); + // If we are supposed to rebuild the global module index, do so now unless + // there were any module-build failures. + if (CI.shouldBuildGlobalModuleIndex() && CI.hasFileManager() && + CI.hasPreprocessor()) { + GlobalModuleIndex::writeIndex( + CI.getFileManager(), + CI.getPreprocessor().getHeaderSearchInfo().getModuleCachePath()); + } + return true; } |