[PATCH] D143427: [clang] NFC: Remove GCC 5.1 workaround in FileEntry
Jan Svoboda via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 7 09:27:55 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5e14a48463b4: [clang] NFC: Remove GCC 5.1 workaround in FileEntry (authored by jansvoboda11).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143427/new/
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.495577.patch
Type: text/x-patch
Size: 1878 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230207/a5e6f612/attachment.bin>
More information about the cfe-commits
mailing list