[PATCH] D89498: HeaderSearch: Simplify use of FileEntryRef in HeaderSearch::LookupFile, NFC
Duncan P. N. Exon Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 15 14:30:06 PDT 2020
dexonsmith created this revision.
dexonsmith added a reviewer: arphaman.
Herald added a subscriber: ributzka.
dexonsmith requested review of this revision.
Simplify `HeaderSearch::LookupFile`. Instead of deconstructing a
`FileEntryRef` into a name and `FileEntry` and then rebuilding it later,
use it as is. This helps to unblock making the constructor of
`FileEntryRef` private to `FileManager`.
https://reviews.llvm.org/D89498
Files:
clang/lib/Lex/HeaderSearch.cpp
Index: clang/lib/Lex/HeaderSearch.cpp
===================================================================
--- clang/lib/Lex/HeaderSearch.cpp
+++ clang/lib/Lex/HeaderSearch.cpp
@@ -765,8 +765,7 @@
// This is the header that MSVC's header search would have found.
ModuleMap::KnownHeader MSSuggestedModule;
- const FileEntry *MSFE_FE = nullptr;
- StringRef MSFE_Name;
+ Optional<FileEntryRef> MSFE;
// Unless disabled, check to see if the file is in the #includer's
// directory. This cannot be based on CurDir, because each includer could be
@@ -841,8 +840,7 @@
if (Diags.isIgnored(diag::ext_pp_include_search_ms, IncludeLoc)) {
return FE;
} else {
- MSFE_FE = &FE->getFileEntry();
- MSFE_Name = FE->getName();
+ MSFE = FE;
if (SuggestedModule) {
MSSuggestedModule = *SuggestedModule;
*SuggestedModule = ModuleMap::KnownHeader();
@@ -854,9 +852,6 @@
}
}
- Optional<FileEntryRef> MSFE(MSFE_FE ? FileEntryRef(MSFE_Name, *MSFE_FE)
- : Optional<FileEntryRef>());
-
CurDir = nullptr;
// If this is a system #include, ignore the user #include locs.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89498.298466.patch
Type: text/x-patch
Size: 1210 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201015/882ee4ad/attachment.bin>
More information about the cfe-commits
mailing list