[PATCH] D90484: FileManager: Add FileEntryRef::getDir, returning DirectoryEntryRef

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 30 10:50:12 PDT 2020


dexonsmith created this revision.
dexonsmith added reviewers: arphaman, JDevlieghere.
Herald added a subscriber: ributzka.
dexonsmith requested review of this revision.

Add `FileEntryRef::getDir`, which returns a `DirectoryEntryRef`. This
includes a few changes:

- Customize `OptionalStorage` so that `Optional<DirectoryEntryRef>` is pointer-sized (like the change made to `Optional<FileEntryRef>`). Factored out a common class, `FileMgr::MapEntryOptionalStorage`, to reduce the code duplication.
- Store an `Optional<DirectoryEntryRef>` in `FileEntryRef::MapValue`. This is set if and only if `MapValue` has a real `FileEntry`.
- Change `FileManager::getFileRef` and `getVirtualFileRef` to use `getDirectoryRef` and store it in the `StringMap` for `FileEntryRef`.


https://reviews.llvm.org/D90484

Files:
  clang/include/clang/Basic/DirectoryEntry.h
  clang/include/clang/Basic/FileEntry.h
  clang/lib/Basic/FileManager.cpp
  clang/unittests/Basic/FileEntryTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90484.301959.patch
Type: text/x-patch
Size: 19129 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201030/abe9be92/attachment-0001.bin>


More information about the cfe-commits mailing list