diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-09-02 21:17:18 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2024-01-07 23:04:38 +0000 |
commit | 0e1e0ce556810ad5f9d45485e686f0653530516c (patch) | |
tree | ab02ce7c4fafc0518430e9cec77d41201bce23f0 /contrib/llvm-project/clang/lib/Basic/FileManager.cpp | |
parent | c3eb0b7c19221f3a2133ab14d3ffffa61ec0c4bc (diff) |
Diffstat (limited to 'contrib/llvm-project/clang/lib/Basic/FileManager.cpp')
-rw-r--r-- | contrib/llvm-project/clang/lib/Basic/FileManager.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/contrib/llvm-project/clang/lib/Basic/FileManager.cpp b/contrib/llvm-project/clang/lib/Basic/FileManager.cpp index e8d0f20019eb..f92c1aeb2112 100644 --- a/contrib/llvm-project/clang/lib/Basic/FileManager.cpp +++ b/contrib/llvm-project/clang/lib/Basic/FileManager.cpp @@ -319,7 +319,7 @@ FileManager::getFileRef(StringRef Filename, bool openFile, bool CacheFailure) { // Cache the redirection in the previously-inserted entry, still available // in the tentative return value. - NamedFileEnt->second = FileEntryRef::MapValue(Redirection); + NamedFileEnt->second = FileEntryRef::MapValue(Redirection, DirInfo); } FileEntryRef ReturnedRef(*NamedFileEnt); @@ -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. @@ -632,16 +631,15 @@ void FileManager::GetUniqueIDMapping( UIDToFiles[VFE->getUID()] = VFE; } -StringRef FileManager::getCanonicalName(const DirectoryEntry *Dir) { - llvm::DenseMap<const void *, llvm::StringRef>::iterator Known - = CanonicalNames.find(Dir); +StringRef FileManager::getCanonicalName(DirectoryEntryRef Dir) { + auto Known = CanonicalNames.find(Dir); if (Known != CanonicalNames.end()) return Known->second; - StringRef CanonicalName(Dir->getName()); + StringRef CanonicalName(Dir.getName()); SmallString<4096> CanonicalNameBuf; - if (!FS->getRealPath(Dir->getName(), CanonicalNameBuf)) + if (!FS->getRealPath(Dir.getName(), CanonicalNameBuf)) CanonicalName = CanonicalNameBuf.str().copy(CanonicalNameStorage); CanonicalNames.insert({Dir, CanonicalName}); |