================
@@ -542,14 +570,26 @@ 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 (pathDiffersIgnoringWindowsSlashes(*IR.OrigEntry, SourceFile)) {
+      Cache = cloneContentCache(ContentCacheAlloc, IR);
+      Cache->OrigEntry = SourceFile;
+      FileIDContentCaches.push_back(Cache);
----------------
jansvoboda11 wrote:

Is there a reason not to sink this logic directly into 
`getOrCreateContentCache()` and maybe use a different key for the lookup map 
other than `FileEntryRef`?

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