diff options
author | Richard Howell <rhow@fb.com> | 2023-01-18 14:58:15 -0800 |
---|---|---|
committer | Richard Howell <rhow@fb.com> | 2023-01-20 07:23:11 -0800 |
commit | 75fbb5d2238f1824f03d205b699061a115d5effc (patch) | |
tree | a84325c4a57e4284d5720446e99cbe2dddb8a7ef /clang/lib/Sema/SemaModule.cpp | |
parent | 9d4f1a9eff27716069dc6a2d991baa228c197b85 (diff) | |
download | llvm-75fbb5d2238f1824f03d205b699061a115d5effc.zip llvm-75fbb5d2238f1824f03d205b699061a115d5effc.tar.gz llvm-75fbb5d2238f1824f03d205b699061a115d5effc.tar.bz2 |
[clang][nfc] refactor Module::Header to use OptionalFileEntryRef
Refactor the `Module::Header` class to use an `OptionalFileEntryRef`
instead of a `FileEntry*`. This is preparation for refactoring the
`TopHeaderNames` to use `FileEntryRef` so that we preserve the
lookup path of the headers when serializing.
This is mostly based on https://reviews.llvm.org/D90497
Reviewed By: jansvoboda11
Differential Revision: https://reviews.llvm.org/D142113
Diffstat (limited to 'clang/lib/Sema/SemaModule.cpp')
-rw-r--r-- | clang/lib/Sema/SemaModule.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp index 64dce281..8fa31ea 100644 --- a/clang/lib/Sema/SemaModule.cpp +++ b/clang/lib/Sema/SemaModule.cpp @@ -120,12 +120,12 @@ void Sema::HandleStartOfHeaderUnit() { // TODO: Make the C++20 header lookup independent. // When the input is pre-processed source, we need a file ref to the original // file for the header map. - auto F = SourceMgr.getFileManager().getFile(HUName); + auto F = SourceMgr.getFileManager().getOptionalFileRef(HUName); // For the sake of error recovery (if someone has moved the original header // after creating the pre-processed output) fall back to obtaining the file // ref for the input file, which must be present. if (!F) - F = SourceMgr.getFileEntryForID(SourceMgr.getMainFileID()); + F = SourceMgr.getFileEntryRefForID(SourceMgr.getMainFileID()); assert(F && "failed to find the header unit source?"); Module::Header H{HUName.str(), HUName.str(), *F}; auto &Map = PP.getHeaderSearchInfo().getModuleMap(); |