[clang] [C++][Modules] Don't insert `#include` before GMF when `-include` used (PR #212533)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 28 18:22:19 PDT 2026


================
@@ -922,6 +922,16 @@ static bool checkPreprocessorOptions(
   }
 
   // Compute the #include and #include_macros lines we need.
+  for (unsigned I = 0, N = ExistingPPOpts.MacroIncludes.size(); I != N; ++I) {
+    StringRef File = ExistingPPOpts.MacroIncludes[I];
+    if (llvm::is_contained(PPOpts.MacroIncludes, File))
+      continue;
+
+    SuggestedPredefines += "#__include_macros \"";
+    SuggestedPredefines += File;
+    SuggestedPredefines += "\"\n##\n";
+  }
----------------
ChuanqiXu9 wrote:

Why do we need this?

https://github.com/llvm/llvm-project/pull/212533


More information about the cfe-commits mailing list