diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2023-05-26 13:40:40 -0700 |
---|---|---|
committer | Jan Svoboda <jan_svoboda@apple.com> | 2023-07-11 11:17:24 -0700 |
commit | 06611e361363a4c209aaccd0ee24652d2c56cafb (patch) | |
tree | e311d8a6ed28903f66b3e39432c7383a2d137281 /clang/lib/Basic/Module.cpp | |
parent | bdbb3fd5807cdf87bffa718f8c5b0472e8331bfb (diff) | |
download | llvm-06611e361363a4c209aaccd0ee24652d2c56cafb.zip llvm-06611e361363a4c209aaccd0ee24652d2c56cafb.tar.gz llvm-06611e361363a4c209aaccd0ee24652d2c56cafb.tar.bz2 |
[clang] Implement `PointerLikeTraits` for `{File,Directory}EntryRef`
This patch implements `llvm::PointerLikeTraits<FileEntryRef>` and `llvm::PointerLikeTraits<DirectoryEntryRef>`, allowing some simplifications around umbrella header/directory code.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D154905
Diffstat (limited to 'clang/lib/Basic/Module.cpp')
-rw-r--r-- | clang/lib/Basic/Module.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp index 2bdbe8d2..8ec6823 100644 --- a/clang/lib/Basic/Module.cpp +++ b/clang/lib/Basic/Module.cpp @@ -264,10 +264,10 @@ bool Module::fullModuleNameIs(ArrayRef<StringRef> nameParts) const { } OptionalDirectoryEntryRef Module::getEffectiveUmbrellaDir() const { - if (const auto *ME = Umbrella.dyn_cast<const FileEntryRef::MapEntry *>()) - return FileEntryRef(*ME).getDir(); - if (const auto *ME = Umbrella.dyn_cast<const DirectoryEntryRef::MapEntry *>()) - return DirectoryEntryRef(*ME); + if (Umbrella && Umbrella.is<FileEntryRef>()) + return Umbrella.get<FileEntryRef>().getDir(); + if (Umbrella && Umbrella.is<DirectoryEntryRef>()) + return Umbrella.get<DirectoryEntryRef>(); return std::nullopt; } |