This is an archive of the discontinued LLVM Phabricator instance.

[clang] Add FileEntryRef::getNameAsRequested()
ClosedPublic

Authored by benlangmuir on Aug 2 2022, 11:38 AM.

Details

Summary

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.

Diff Detail

Event Timeline

benlangmuir created this revision.Aug 2 2022, 11:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2022, 11:38 AM
benlangmuir requested review of this revision.Aug 2 2022, 11:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2022, 11:38 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
bnbarham accepted this revision.Aug 2 2022, 12:37 PM

Thanks 🙇

clang/unittests/Basic/FileManagerTest.cpp
381

Bit weird that this test was checking for true 🤔. Seems like it isn't used outside of tests except for isEqual in DenseMapInfo though.

This revision is now accepted and ready to land.Aug 2 2022, 12:37 PM
This revision was automatically updated to reflect the committed changes.