[all-commits] [llvm/llvm-project] 245218: Basic: Support named pipes natively in SourceManag...

Duncan P. N. Exon Smith via All-commits all-commits at lists.llvm.org
Wed Dec 23 14:58:50 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 245218bb355599771ba43a0fe1449d1670f2666c
      https://github.com/llvm/llvm-project/commit/245218bb355599771ba43a0fe1449d1670f2666c
  Author: Duncan P. N. Exon Smith <dexonsmith at apple.com>
  Date:   2020-12-23 (Wed, 23 Dec 2020)

  Changed paths:
    M clang/lib/Basic/FileManager.cpp
    M clang/lib/Basic/SourceManager.cpp
    M clang/lib/Frontend/CompilerInstance.cpp
    M clang/test/Misc/dev-fd-fs.c

  Log Message:
  -----------
  Basic: Support named pipes natively in SourceManager and FileManager

Handle named pipes natively in SourceManager and FileManager, removing a
call to `SourceManager::overrideFileContents` in
`CompilerInstance::InitializeSourceManager` (removing a blocker for
sinking the content cache to FileManager (which will incidently sink
this new named pipe logic with it)).

SourceManager usually checks if the file entry's size matches the
eventually loaded buffer, but that's now skipped for named pipes since
the `stat` won't reflect the full size.  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`. `FileManager::getBufferForFile` also needs to
treat these files as volatile when loading the buffer.

Native support in SourceManager / FileManager means that named pipes can
also be `#include`d, and clang/test/Misc/dev-fd-fs.c was expanded to
check for that.

This is a new version of 3b18a594c7717a328c33b9c1eba675e9f4bd367c, which
was reverted in b34632201987eed369bb7ef4646f341b901c95b8 since it was
missing the `SourceManager` changes.

Differential Revision: https://reviews.llvm.org/D92531




More information about the All-commits mailing list