[clang] [ASTWriter] Detect more non-affecting FileIDs to reduce source location duplication (PR #112015)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 13 19:17:24 PDT 2024


================
@@ -192,13 +201,13 @@ GetAffectingModuleMaps(const Preprocessor &PP, Module *RootModule) {
 
       // The containing module map is affecting, because it's being pointed
       // into by Module::DefinitionLoc.
-      if (auto FE = MM.getContainingModuleMapFile(Mod))
-        ModuleMaps.insert(*FE);
+      if (auto F = MM.getContainingModuleMapFileID(Mod); F.isValid())
+        ModuleMaps.insert(F);
       // For inferred modules, the module map that allowed inferring is not
       // related to the virtual containing module map file. It did affect the
       // compilation, though.
-      if (auto FE = MM.getModuleMapFileForUniquing(Mod))
-        ModuleMaps.insert(*FE);
+      if (auto F = MM.getModuleMapFileIDForUniquing(Mod); F.isValid())
----------------
ChuanqiXu9 wrote:

The duplicated name may not smell good.

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


More information about the cfe-commits mailing list