diff options
author | Ben Langmuir <blangmuir@apple.com> | 2022-08-01 18:08:24 -0700 |
---|---|---|
committer | Ben Langmuir <blangmuir@apple.com> | 2022-08-03 09:41:08 -0700 |
commit | 6a79e2ff1989b48f4a8ebf3ac51092eb8ad29e37 (patch) | |
tree | 7d8346aec6a702471f2d5291502e01c6be302468 /clang/lib/Basic/FileManager.cpp | |
parent | 446b61cff4ea0cb7e7fcc5e0fec7bc749d379b08 (diff) | |
download | llvm-6a79e2ff1989b48f4a8ebf3ac51092eb8ad29e37.zip llvm-6a79e2ff1989b48f4a8ebf3ac51092eb8ad29e37.tar.gz llvm-6a79e2ff1989b48f4a8ebf3ac51092eb8ad29e37.tar.bz2 |
[clang] Add FileEntryRef::getNameAsRequested()
As progress towards having FileManager::getFileRef() return the path
as-requested by default, return a FileEntryRef that can use
getNameAsRequested() to retrieve this path, with the ultimate goal that
this should be the behaviour of getName() and clients should explicitly
request the "external" name if they need to (see comment in
FileManager::getFileRef). For now, getName() continues to return the
external path by looking through the redirects.
For now, the new function is only used in unit tests.
Differential Revision: https://reviews.llvm.org/D131004
Diffstat (limited to 'clang/lib/Basic/FileManager.cpp')
-rw-r--r-- | clang/lib/Basic/FileManager.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp index 451c7c3..cb71976 100644 --- a/clang/lib/Basic/FileManager.cpp +++ b/clang/lib/Basic/FileManager.cpp @@ -293,12 +293,8 @@ FileManager::getFileRef(StringRef Filename, bool openFile, bool CacheFailure) { // name-as-accessed on the \a FileEntryRef. // // A potential plan to remove this is as follows - - // - Expose the requested filename. One possibility would be to allow - // redirection-FileEntryRefs to be returned, rather than returning - // the pointed-at-FileEntryRef, and customizing `getName()` to look - // through the indirection. // - Update callers such as `HeaderSearch::findUsableModuleForHeader()` - // to explicitly use the requested filename rather than just using + // to explicitly use the `getNameAsRequested()` rather than just using // `getName()`. // - Add a `FileManager::getExternalPath` API for explicitly getting the // remapped external filename when there is one available. Adopt it in @@ -329,9 +325,6 @@ 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); - - // Fix the tentative return value. - NamedFileEnt = &Redirection; } FileEntryRef ReturnedRef(*NamedFileEnt); |