diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2020-10-15 18:46:25 -0400 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2020-10-22 22:20:50 -0400 |
commit | cf593d224c9c3fc2cf93827cb66fd9e550a6a486 (patch) | |
tree | 8c80bc90a121b560c3fe517b37bdf57bc32ffc8b /clang/lib/Basic/SourceManager.cpp | |
parent | 27e11d7120c0caa20a167b44ba29828446a525c0 (diff) | |
download | llvm-cf593d224c9c3fc2cf93827cb66fd9e550a6a486.zip llvm-cf593d224c9c3fc2cf93827cb66fd9e550a6a486.tar.gz llvm-cf593d224c9c3fc2cf93827cb66fd9e550a6a486.tar.bz2 |
SourceManager: getFileEntryRefForID => getNonBuiltinFilenameForID, NFC
`SourceManager::getFileEntryRefForID`'s remaining callers just want the
filename component, which is coming from the `FileInfo`. Replace the API
with `getNonBuiltinFilenameForID`, which also removes another use of
`FileEntryRef::FileEntryRef` outside of `FileManager`.
Both callers are collecting file dependencies, and one of them relied on
this API to filter out built-ins (as exposed by
clang/test/ClangScanDeps/modules-full.cpp). It seems nice to continue
providing that service.
Differential Revision: https://reviews.llvm.org/D89508
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r-- | clang/lib/Basic/SourceManager.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index c91ef41..79eeeb2 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -725,11 +725,12 @@ void SourceManager::setFileIsTransient(const FileEntry *File) { const_cast<SrcMgr::ContentCache *>(CC)->IsTransient = true; } -Optional<FileEntryRef> SourceManager::getFileEntryRefForID(FileID FID) const { +Optional<StringRef> +SourceManager::getNonBuiltinFilenameForID(FileID FID) const { if (const SrcMgr::SLocEntry *Entry = getSLocEntryForFile(FID)) if (auto *Content = Entry->getFile().getContentCache()) if (Content && Content->OrigEntry) - return FileEntryRef(Entry->getFile().getName(), *Content->OrigEntry); + return Entry->getFile().getName(); return None; } |