Author: Jan Svoboda Date: 2023-02-07T09:27:24-08:00 New Revision: 5e14a48463b4c3eb3f36eeef30dee7312f9127da
URL: https://github.com/llvm/llvm-project/commit/5e14a48463b4c3eb3f36eeef30dee7312f9127da DIFF: https://github.com/llvm/llvm-project/commit/5e14a48463b4c3eb3f36eeef30dee7312f9127da.diff LOG: [clang] NFC: Remove GCC 5.1 workaround in FileEntry We no longer support GCC 5.1 (D122976), so let's remove the workaround in FileEntry. Reviewed By: benlangmuir Differential Revision: https://reviews.llvm.org/D143427 Added: Modified: clang/include/clang/Basic/FileEntry.h clang/lib/Basic/FileManager.cpp Removed: ################################################################################ diff --git a/clang/include/clang/Basic/FileEntry.h b/clang/include/clang/Basic/FileEntry.h index 93e84cf233a30..d86191aaa0c7b 100644 --- a/clang/include/clang/Basic/FileEntry.h +++ b/clang/include/clang/Basic/FileEntry.h @@ -118,10 +118,7 @@ class FileEntryRef { /// 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 @@ class FileEntryRef { /// 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: diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp index e8d0f20019eba..7d6fc47dbc384 100644 --- a/clang/lib/Basic/FileManager.cpp +++ b/clang/lib/Basic/FileManager.cpp @@ -403,8 +403,7 @@ FileEntryRef FileManager::getVirtualFileRef(StringRef Filename, off_t Size, 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. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits