/// 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;
/// 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:
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.