]> granicus.if.org Git - clang/commitdiff
[libclang] Don't disable the preprocessing record while indexing so as
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 6 Oct 2012 01:18:35 +0000 (01:18 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 6 Oct 2012 01:18:35 +0000 (01:18 +0000)
to not mess up with module building.

It was not worth trying to combine indexing without preprocessing record
and building modules with one because:

-just importing a module/PCH that was built with a pp record, enables it anyway
-the performance gain of indexing without the preprocessing record is insignificant.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165352 91177308-0d34-0410-b5e6-96231b3b80d8

tools/libclang/Indexing.cpp

index 0b12d82d30a48c0e6a1937341445772d30137cac..6ea87eb95ed51669b6e2e2197bf90d541e64252c 100644 (file)
@@ -191,22 +191,12 @@ public:
                          unsigned indexOptions,
                          CXTranslationUnit cxTU)
     : IndexCtx(clientData, indexCallbacks, indexOptions, cxTU),
-      CXTU(cxTU), EnablePPDetailedRecordForModules(false) { }
-
-  bool EnablePPDetailedRecordForModules;
+      CXTU(cxTU) { }
 
   virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
                                          StringRef InFile) {
     PreprocessorOptions &PPOpts = CI.getPreprocessorOpts();
 
-    // We usually disable the preprocessing record for indexing even if the
-    // original preprocessing options had it enabled. Now that the indexing
-    // Preprocessor has been created (without a preprocessing record), re-enable
-    // the option in case modules are enabled, so that the detailed record
-    // option can be propagated when the module file is generated.
-    if (CI.getLangOpts().Modules && EnablePPDetailedRecordForModules)
-      PPOpts.DetailedRecord = true;
-
     if (!PPOpts.ImplicitPCHInclude.empty()) {
       IndexCtx.importedPCH(
                         CI.getFileManager().getFile(PPOpts.ImplicitPCHInclude));
@@ -402,17 +392,11 @@ static void clang_indexSourceFile_Impl(void *UserData) {
     // FIXME: Add a flag for modules.
     CacheCodeCompletionResults
       = TU_options & CXTranslationUnit_CacheCompletionResults;
-    if (TU_options & CXTranslationUnit_DetailedPreprocessingRecord) {
-      PPOpts.DetailedRecord = true;
-    }
   }
 
-  IndexAction->EnablePPDetailedRecordForModules
-    = PPOpts.DetailedRecord ||
-      (TU_options & CXTranslationUnit_DetailedPreprocessingRecord);
-
-  if (!requestedToGetTU)
-    PPOpts.DetailedRecord = false;
+  if (TU_options & CXTranslationUnit_DetailedPreprocessingRecord) {
+    PPOpts.DetailedRecord = true;
+  }
 
   DiagnosticErrorTrap DiagTrap(*Diags);
   bool Success = ASTUnit::LoadFromCompilerInvocationAction(CInvok.getPtr(), Diags,