================
@@ -2128,9 +2245,16 @@ bool ModuleMap::loadModuleMapFile(FileEntryRef File, 
bool IsSystem,
 
   // If the module map file wasn't already entered, do so now.
   if (ID.isInvalid()) {
-    auto FileCharacter =
-        IsSystem ? SrcMgr::C_System_ModuleMap : SrcMgr::C_User_ModuleMap;
-    ID = SourceMgr.createFileID(File, ExternModuleLoc, FileCharacter);
+    ID = SourceMgr.translateFile(File);
+    // TODO: The way we compute affecting module maps requires this to be a
+    //       local FileID. This should be changed to reuse loaded FileIDs when
+    //       available, and change the way that affecting module maps are
+    //       computed to not require this.
+    if (ID.isInvalid() || SourceMgr.isLoadedFileID(ID)) {
----------------
Bigcheese wrote:

Yeah, the preference is that we don't create new SourceManager entries for a 
file as that takes up SLoc space and has a tiny bit of serialization overhead. 
The TODO is to remove the `isLoadedFileID()` and otherwise ensure that we never 
create extra FileIDs. 

https://github.com/llvm/llvm-project/pull/132853
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to