diff options
author | Ben Langmuir <blangmuir@apple.com> | 2022-08-05 10:56:56 -0700 |
---|---|---|
committer | Ben Langmuir <blangmuir@apple.com> | 2022-08-05 12:23:38 -0700 |
commit | d038bb196c51dcf80cbe771f4229b4e227c6c5b6 (patch) | |
tree | c218ad86c2d240401c3848f2ccbfd2372a77f2e1 /clang/lib/Basic/FileManager.cpp | |
parent | 3e0e5568a6a8c744d26f79a1e55360fe2655867c (diff) | |
download | llvm-d038bb196c51dcf80cbe771f4229b4e227c6c5b6.zip llvm-d038bb196c51dcf80cbe771f4229b4e227c6c5b6.tar.gz llvm-d038bb196c51dcf80cbe771f4229b4e227c6c5b6.tar.bz2 |
[clang] Fix redirection behaviour for cached FileEntryRef
In 6a79e2ff1989b we changed Filemanager::getEntryRef() to return the
redirecting FileEntryRef instead of looking through the redirection.
This commit fixes the case when looking up a cached file path to also
return the redirecting FileEntryRef. This mainly affects the behaviour
of calling getNameAsRequested() on the resulting entry ref.
Differential Revision: https://reviews.llvm.org/D131273
Diffstat (limited to 'clang/lib/Basic/FileManager.cpp')
-rw-r--r-- | clang/lib/Basic/FileManager.cpp | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp index cb71976..4ef2535 100644 --- a/clang/lib/Basic/FileManager.cpp +++ b/clang/lib/Basic/FileManager.cpp @@ -212,13 +212,7 @@ FileManager::getFileRef(StringRef Filename, bool openFile, bool CacheFailure) { if (!SeenFileInsertResult.first->second) return llvm::errorCodeToError( SeenFileInsertResult.first->second.getError()); - // Construct and return and FileEntryRef, unless it's a redirect to another - // filename. - FileEntryRef::MapValue Value = *SeenFileInsertResult.first->second; - if (LLVM_LIKELY(Value.V.is<FileEntry *>())) - return FileEntryRef(*SeenFileInsertResult.first); - return FileEntryRef(*reinterpret_cast<const FileEntryRef::MapEntry *>( - Value.V.get<const void *>())); + return FileEntryRef(*SeenFileInsertResult.first); } // We've not seen this before. Fill it in. |