From 75fbb5d2238f1824f03d205b699061a115d5effc Mon Sep 17 00:00:00 2001 From: Richard Howell Date: Wed, 18 Jan 2023 14:58:15 -0800 Subject: [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 --- clang/lib/Sema/SemaModule.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'clang/lib/Sema/SemaModule.cpp') 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(); -- cgit v1.1