aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2020-12-10 15:27:51 -0800
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2020-12-23 15:18:50 -0800
commit3ee43adfb20d5dc56b7043b314bd22f457c55483 (patch)
tree53f588c5df51e1ed87cbb3ae42a7ef55b758701a /clang/lib/Basic/SourceManager.cpp
parent245218bb355599771ba43a0fe1449d1670f2666c (diff)
downloadllvm-3ee43adfb20d5dc56b7043b314bd22f457c55483.zip
llvm-3ee43adfb20d5dc56b7043b314bd22f457c55483.tar.gz
llvm-3ee43adfb20d5dc56b7043b314bd22f457c55483.tar.bz2
Basic: Add native support for stdin to SourceManager and FileManager
Add support for stdin to SourceManager and FileManager. Adds FileManager::getSTDIN, which adds a FileEntryRef for `<stdin>` and reads the MemoryBuffer, which is stored as `FileEntry::Content`. Eventually the other buffers in `ContentCache` will sink to here as well -- we probably usually want to load/save a MemoryBuffer eagerly -- but it's happening early for stdin to get rid of CompilerInstance::InitializeSourceManager's final call to `SourceManager::overrideFileContents`. clang/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.export/p1.cpp relies on building a module from stdin; supporting that requires setting ContentCache::BufferOverridden. Differential Revision: https://reviews.llvm.org/D93148
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r--clang/lib/Basic/SourceManager.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index d2c0de5..56b233b 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -414,6 +414,7 @@ ContentCache &SourceManager::getOrCreateContentCache(const FileEntry *FileEnt,
Entry->IsFileVolatile = UserFilesAreVolatile && !isSystemFile;
Entry->IsTransient = FilesAreTransient;
+ Entry->BufferOverridden |= FileEnt->isNamedPipe();
return *Entry;
}