[clang] Insert headers in global module fragment (PR #151624)

via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 2 22:33:09 PDT 2025


================
@@ -115,6 +134,7 @@ unsigned getOffsetAfterHeaderGuardsAndComments(StringRef FileName,
               return SM.getFileOffset(Tok.getLocation());
             return 0;
           }));
+  return std::max(HeaderAndPPOffset, ModuleDecl);
----------------
JVApen wrote:

If rather say something like:
````
Determines the area where we want to insert header includes. This will be put (when available):
 - after `#pragma once`
 - in-between header guards (`#ifdef/#define` & `#endif`)
 - after opening global module (`module;`)
````
Feel free to rephrase or ignore

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


More information about the cfe-commits mailing list