From: Nico Weber Date: Wed, 28 Oct 2020 00:10:48 +0000 (-0400) Subject: Unbreak build with gcc5.3 after 917acac X-Git-Tag: llvmorg-13-init~7944 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=739d4bf8f43d0a5a3a99e07b1647ded1ce1d81b3;p=platform%2Fupstream%2Fllvm.git Unbreak build with gcc5.3 after 917acac --- diff --git a/clang/include/clang/Basic/FileManager.h b/clang/include/clang/Basic/FileManager.h index d27b426..12848f4 100644 --- a/clang/include/clang/Basic/FileManager.h +++ b/clang/include/clang/Basic/FileManager.h @@ -107,7 +107,9 @@ public: /// 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. - llvm::PointerUnion V; + // The second type is really a `const MapEntry *`, but that confuses gcc5.3. + // Once that's no longer supported, change this back. + llvm::PointerUnion V; MapValue() = delete; MapValue(FileEntry &FE) : V(&FE) {} diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp index d26ead4..38d9403 100644 --- a/clang/lib/Basic/FileManager.cpp +++ b/clang/lib/Basic/FileManager.cpp @@ -215,7 +215,8 @@ FileManager::getFileRef(StringRef Filename, bool openFile, bool CacheFailure) { FileEntryRef::MapValue Value = *SeenFileInsertResult.first->second; if (LLVM_LIKELY(Value.V.is())) return FileEntryRef(*SeenFileInsertResult.first); - return FileEntryRef(*Value.V.get()); + return FileEntryRef(*reinterpret_cast( + Value.V.get())); } // We've not seen this before. Fill it in. @@ -347,7 +348,8 @@ FileManager::getVirtualFile(StringRef Filename, off_t Size, FileEntry *FE; if (LLVM_LIKELY(FE = Value.V.dyn_cast())) return FE; - return &FileEntryRef(*Value.V.get()) + return &FileEntryRef(*reinterpret_cast( + Value.V.get())) .getFileEntry(); }