================
@@ -1845,10 +1853,88 @@ ASTReader::readSLocOffset(ModuleFile *F, unsigned 
Index) {
         std::errc::illegal_byte_sequence,
         "incorrectly-formatted source location entry in AST file");
   case SM_SLOC_FILE_ENTRY:
+    return SLocEntryInfo{
+        static_cast<SourceLocation::UIntTy>(F->SLocEntryBaseOffset + 
Record[0]),
+        static_cast<unsigned>(Record[4])};
   case SM_SLOC_BUFFER_ENTRY:
   case SM_SLOC_EXPANSION_ENTRY:
-    return F->SLocEntryBaseOffset + Record[0];
+    return SLocEntryInfo{
+        static_cast<SourceLocation::UIntTy>(F->SLocEntryBaseOffset + 
Record[0]),
+        0};
+  }
+}
+
+void ASTReader::buildLoadedInputFiles() {
+  LoadedInputFilesBuilt = true;
+  // ModuleManager iterates modules in index order, so the copy chosen for a
+  // file does not depend on module load order.
+  for (ModuleFile &F : ModuleMgr) {
+    for (unsigned I = 0, N = F.InputFilesLoaded.size(); I != N; ++I) {
+      InputFileInfo FI = getInputFileInfo(F, I + 1);
+      if (FI.UnresolvedImportedFilename.empty())
+        continue;
+      // An overridden input holds a buffer rather than the file named by its
+      // path, so its path and size cannot identify matching contents.
+      if (FI.Overridden)
+        continue;
+      auto Filename =
+          ResolveImportedPath(PathBuf, FI.UnresolvedImportedFilename, F);
+      // Make both paths absolute and remove dot segments before comparing 
them.
----------------
cor3ntin wrote:

```suggestion
      // Canonicalize both paths before comparing them.
```

https://github.com/llvm/llvm-project/pull/209795
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to