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:
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:
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits