[PATCH] D92531: Reapply "Frontend: Sink named pipe logic from CompilerInstance down to FileManager"

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 2 18:14:56 PST 2020


dexonsmith created this revision.
dexonsmith added reviewers: arphaman, Bigcheese, jansvoboda11.
Herald added subscribers: ributzka, JDevlieghere.
Herald added a project: clang.
dexonsmith requested review of this revision.

This reverts commit b34632201987eed369bb7ef4646f341b901c95b8 <https://reviews.llvm.org/rGb34632201987eed369bb7ef4646f341b901c95b8>,
reapplying 3b18a594c7717a328c33b9c1eba675e9f4bd367c <https://reviews.llvm.org/rG3b18a594c7717a328c33b9c1eba675e9f4bd367c> with an additional
change to SourceManager.

SourceManager checks if the file entry's size matches the eventually
loaded buffer. This doesn't make sense for named pipes so I've disabled
that check. Since we can't trust `ContentsEntry->getSize()`, we also need
shift the check for files that are too large until after the buffer is
loaded... and load the buffer immediately in `createFileID` so that no
client gets a bad value from `ContentCache::getSize`.

My main goal with this commit is to remove a use of
`SourceManager::overrideFileContents`, whose existance blocks sinking
the content cache down to `FileManager`.

The original commit message follows:

Frontend: Sink named pipe logic from CompilerInstance down to FileManager

Remove compilicated logic from CompilerInstance::InitializeSourceManager
to deal with named pipes, updating FileManager::getBufferForFile to
handle it in a more straightforward way. The existing test at
clang/test/Misc/dev-fd-fs.c covers the new behaviour (just like it did
the old behaviour).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92531

Files:
  clang/lib/Basic/FileManager.cpp
  clang/lib/Basic/SourceManager.cpp
  clang/lib/Frontend/CompilerInstance.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92531.309118.patch
Type: text/x-patch
Size: 5380 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201203/27efce94/attachment.bin>


More information about the cfe-commits mailing list