================
@@ -542,14 +580,27 @@ FileID SourceManager::createFileID(FileEntryRef 
SourceFile,
                                    SourceLocation::UIntTy LoadedOffset) {
   SrcMgr::ContentCache &IR = getOrCreateContentCache(SourceFile,
                                                      isSystem(FileCharacter));
+  SrcMgr::ContentCache *Cache = &IR;
+  StringRef Filename = SourceFile.getName();
+
+  if (IR.OrigEntry && !IR.OrigEntry->isSameRef(SourceFile)) {
+    if (referencesDistinctFilePaths(getFileManager(), *IR.OrigEntry,
+                                    SourceFile)) {
+      Cache = cloneContentCache(ContentCacheAlloc, IR);
+      Cache->OrigEntry = SourceFile;
+      FileIDContentCaches.push_back(Cache);
+    } else {
+      Filename = IR.OrigEntry->getName();
----------------
keith wrote:

Sorry I'm having a hard time tracing this back since it was a while ago and i 
don't have a windows machine to test with. But I think it's actually because of 
this:

```
// RUN: %clang_cc1 ... -include %S/Inputs/debug-info-macro.h ...
```

resulting in `C:\\path\\to\\whatever/Inputs/debug-info-macro.h` and this DIFile 
from the error:

```
17: !7 = !DIFile(filename: 
"C:\\_work\\llvm-project\\llvm-project\\clang\\test\\DebugInfo\\Generic/Inputs/debug-info-macro.h",
 directory: "") 
```

and then:

```
/*Line 16*/ #include  "Inputs/debug-info-macro.h"
```

resulting in `C:\\path\\to\\whatever\\Inputs/debug-info-macro.h` and this 
DIFile from the error:

```
22: !12 = !DIFile(filename: 
"C:\\_work\\llvm-project\\llvm-project\\clang\\test\\DebugInfo\\Generic\\Inputs/debug-info-macro.h",
 directory: "") 
```

where the only difference is the include path searching behavior respects the 
system path separator

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

Reply via email to