[clang] Add FileEntryRef::getNameAsRequested()
authorBen Langmuir <blangmuir@apple.com>
Tue, 2 Aug 2022 01:08:24 +0000 (18:08 -0700)
committerBen Langmuir <blangmuir@apple.com>
Wed, 3 Aug 2022 16:41:08 +0000 (09:41 -0700)
commit6a79e2ff1989b48f4a8ebf3ac51092eb8ad29e37
tree7d8346aec6a702471f2d5291502e01c6be302468
parent446b61cff4ea0cb7e7fcc5e0fec7bc749d379b08
[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
clang/include/clang/Basic/FileEntry.h
clang/lib/Basic/FileManager.cpp
clang/unittests/Basic/FileEntryTest.cpp
clang/unittests/Basic/FileManagerTest.cpp