[modules] Refactor handling of -fmodules-embed-*. Track this properly rather
than reusing the "overridden buffer" mechanism. This will allow us to make
embedded files and overridden files behave differently in future.
llvm-svn: 254121
diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp
index 8a523d2..137ff6e 100644
--- a/clang/lib/Basic/FileManager.cpp
+++ b/clang/lib/Basic/FileManager.cpp
@@ -137,7 +137,7 @@
// at the same time. Therefore, if DirName is already in the cache,
// we don't need to recurse as its ancestors must also already be in
// the cache.
- if (NamedDirEnt.second)
+ if (NamedDirEnt.second && NamedDirEnt.second != NON_EXISTENT_DIR)
return;
// Add the virtual directory to the cache.
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index 7abcba1..80a003f 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -439,7 +439,7 @@
}
Entry->IsSystemFile = isSystemFile;
- Entry->BufferOverridden = FilesAreTransient;
+ Entry->IsTransient = FilesAreTransient;
return Entry;
}
@@ -674,11 +674,9 @@
OverriddenFilesInfo->OverriddenFilesWithBuffer.erase(File);
}
-void SourceManager::embedFileContentsInModule(const FileEntry *File) {
- // We model an embedded file as a file whose buffer has been overridden
- // by its contents as they are now.
+void SourceManager::setFileIsTransient(const FileEntry *File) {
const SrcMgr::ContentCache *CC = getOrCreateContentCache(File);
- const_cast<SrcMgr::ContentCache *>(CC)->BufferOverridden = true;
+ const_cast<SrcMgr::ContentCache *>(CC)->IsTransient = true;
}
StringRef SourceManager::getBufferData(FileID FID, bool *Invalid) const {