[PATCH] D125149: [Frontend] Flip default of CreateInvocationOptions::ProbePrecompiled to false

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 10 07:58:54 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG00a3c9f2a46a: [Frontend] Flip default of CreateInvocationOptions::ProbePrecompiled to false (authored by sammccall).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125149/new/

https://reviews.llvm.org/D125149

Files:
  clang/include/clang/Frontend/Utils.h
  clang/lib/Frontend/ASTUnit.cpp
  clang/tools/c-index-test/core_main.cpp
  clang/tools/libclang/Indexing.cpp
  clang/unittests/Frontend/UtilsTest.cpp


Index: clang/unittests/Frontend/UtilsTest.cpp
===================================================================
--- clang/unittests/Frontend/UtilsTest.cpp
+++ clang/unittests/Frontend/UtilsTest.cpp
@@ -48,20 +48,20 @@
   llvm::IntrusiveRefCntPtr<DiagnosticsEngine> CommandLineDiagsEngine =
       clang::CompilerInstance::createDiagnostics(new DiagnosticOptions, &D,
                                                  false);
-  // Default: ProbePrecompiled is true.
+  // Default: ProbePrecompiled=false
   CreateInvocationOptions CIOpts;
   CIOpts.Diags = CommandLineDiagsEngine;
   CIOpts.VFS = FS;
   std::unique_ptr<CompilerInvocation> CI = createInvocation(Args, CIOpts);
   ASSERT_TRUE(CI);
-  EXPECT_THAT(CI->getPreprocessorOpts().Includes, ElementsAre());
-  EXPECT_EQ(CI->getPreprocessorOpts().ImplicitPCHInclude, "foo.h.pch");
+  EXPECT_THAT(CI->getPreprocessorOpts().Includes, ElementsAre("foo.h"));
+  EXPECT_EQ(CI->getPreprocessorOpts().ImplicitPCHInclude, "");
 
-  CIOpts.ProbePrecompiled = false;
+  CIOpts.ProbePrecompiled = true;
   CI = createInvocation(Args, CIOpts);
   ASSERT_TRUE(CI);
-  EXPECT_THAT(CI->getPreprocessorOpts().Includes, ElementsAre("foo.h"));
-  EXPECT_EQ(CI->getPreprocessorOpts().ImplicitPCHInclude, "");
+  EXPECT_THAT(CI->getPreprocessorOpts().Includes, ElementsAre());
+  EXPECT_EQ(CI->getPreprocessorOpts().ImplicitPCHInclude, "foo.h.pch");
 }
 
 } // namespace
Index: clang/tools/libclang/Indexing.cpp
===================================================================
--- clang/tools/libclang/Indexing.cpp
+++ clang/tools/libclang/Indexing.cpp
@@ -510,6 +510,7 @@
 
   CreateInvocationOptions CIOpts;
   CIOpts.Diags = Diags;
+  CIOpts.ProbePrecompiled = true; // FIXME: historical default. Needed?
   std::shared_ptr<CompilerInvocation> CInvok =
       createInvocation(*Args, std::move(CIOpts));
 
Index: clang/tools/c-index-test/core_main.cpp
===================================================================
--- clang/tools/c-index-test/core_main.cpp
+++ clang/tools/c-index-test/core_main.cpp
@@ -223,6 +223,7 @@
     Diags(CompilerInstance::createDiagnostics(new DiagnosticOptions));
   CreateInvocationOptions CIOpts;
   CIOpts.Diags = Diags;
+  CIOpts.ProbePrecompiled = true; // FIXME: historical default. Needed?
   auto CInvok = createInvocation(ArgsWithProgName, std::move(CIOpts));
   if (!CInvok)
     return true;
Index: clang/lib/Frontend/ASTUnit.cpp
===================================================================
--- clang/lib/Frontend/ASTUnit.cpp
+++ clang/lib/Frontend/ASTUnit.cpp
@@ -1732,6 +1732,7 @@
     CreateInvocationOptions CIOpts;
     CIOpts.VFS = VFS;
     CIOpts.Diags = Diags;
+    CIOpts.ProbePrecompiled = true; // FIXME: historical default. Needed?
     CI = createInvocation(llvm::makeArrayRef(ArgBegin, ArgEnd),
                           std::move(CIOpts));
     if (!CI)
Index: clang/include/clang/Frontend/Utils.h
===================================================================
--- clang/include/clang/Frontend/Utils.h
+++ clang/include/clang/Frontend/Utils.h
@@ -206,7 +206,7 @@
   /// This is used to replace -include with -include-pch in the cc1 args.
   /// FIXME: ProbePrecompiled=true is a poor, historical default.
   /// It misbehaves if the PCH file is from GCC, has the wrong version, etc.
-  bool ProbePrecompiled = true;
+  bool ProbePrecompiled = false;
   /// If set, the target is populated with the cc1 args produced by the driver.
   /// This may be populated even if createInvocation returns nullptr.
   std::vector<std::string> *CC1Args = nullptr;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125149.428380.patch
Type: text/x-patch
Size: 3568 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220510/cb922e40/attachment.bin>


More information about the cfe-commits mailing list