From d038bb196c51dcf80cbe771f4229b4e227c6c5b6 Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Fri, 5 Aug 2022 10:56:56 -0700 Subject: [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 --- clang/lib/Basic/FileManager.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'clang/lib/Basic/FileManager.cpp') 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())) - return FileEntryRef(*SeenFileInsertResult.first); - return FileEntryRef(*reinterpret_cast( - Value.V.get())); + return FileEntryRef(*SeenFileInsertResult.first); } // We've not seen this before. Fill it in. -- cgit v1.1