[PATCH] D143427: [clang] NFC: Remove GCC 5.1 workaround in FileEntry
Jan Svoboda via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 6 11:40:47 PST 2023
jansvoboda11 created this revision.
jansvoboda11 added a reviewer: benlangmuir.
Herald added a subscriber: ributzka.
Herald added a project: All.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
We no longer support GCC 5.1 (D122976 <https://reviews.llvm.org/D122976>), so let's remove the workaround in FileEntry.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D143427
Files:
clang/include/clang/Basic/FileEntry.h
clang/lib/Basic/FileManager.cpp
Index: clang/lib/Basic/FileManager.cpp
===================================================================
--- clang/lib/Basic/FileManager.cpp
+++ clang/lib/Basic/FileManager.cpp
@@ -403,8 +403,7 @@
FileEntryRef::MapValue Value = *NamedFileEnt.second;
if (LLVM_LIKELY(Value.V.is<FileEntry *>()))
return FileEntryRef(NamedFileEnt);
- return FileEntryRef(*reinterpret_cast<const FileEntryRef::MapEntry *>(
- Value.V.get<const void *>()));
+ return FileEntryRef(*Value.V.get<const FileEntryRef::MapEntry *>());
}
// We've not seen this before, or the file is cached as non-existent.
Index: clang/include/clang/Basic/FileEntry.h
===================================================================
--- clang/include/clang/Basic/FileEntry.h
+++ clang/include/clang/Basic/FileEntry.h
@@ -118,10 +118,7 @@
/// VFSs that use external names. In that case, the \c FileEntryRef
/// returned by the \c FileManager will have the external name, and not the
/// name that was used to lookup the file.
- ///
- /// The second type is really a `const MapEntry *`, but that confuses
- /// gcc5.3. Once that's no longer supported, change this back.
- llvm::PointerUnion<FileEntry *, const void *> V;
+ llvm::PointerUnion<FileEntry *, const MapEntry *> V;
/// Directory the file was found in. Set if and only if V is a FileEntry.
OptionalDirectoryEntryRef Dir;
@@ -165,10 +162,10 @@
/// Retrieve the base MapEntry after redirects.
const MapEntry &getBaseMapEntry() const {
- const MapEntry *ME = this->ME;
- while (const void *Next = ME->second->V.dyn_cast<const void *>())
- ME = static_cast<const MapEntry *>(Next);
- return *ME;
+ const MapEntry *Base = ME;
+ while (const auto *Next = Base->second->V.dyn_cast<const MapEntry *>())
+ Base = Next;
+ return *Base;
}
private:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143427.495229.patch
Type: text/x-patch
Size: 1878 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230206/7f4a2364/attachment.bin>
More information about the cfe-commits
mailing list