Author: Duncan P. N. Exon Smith Date: 2020-10-23T22:10:50-04:00 New Revision: 74910cbbd8d1df824ab1d5e742c50641d0fee907
URL: https://github.com/llvm/llvm-project/commit/74910cbbd8d1df824ab1d5e742c50641d0fee907 DIFF: https://github.com/llvm/llvm-project/commit/74910cbbd8d1df824ab1d5e742c50641d0fee907.diff LOG: HeaderSearch: Simplify use of FileEntryRef in HeaderSearch::LookupFile, NFC 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`. Differential Revision: Added: Modified: clang/lib/Lex/HeaderSearch.cpp Removed: ################################################################################ diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp index 3fd43e0e3aad..50c1fb984206 100644 --- a/clang/lib/Lex/HeaderSearch.cpp +++ b/clang/lib/Lex/HeaderSearch.cpp @@ -765,8 +765,7 @@ Optional<FileEntryRef> HeaderSearch::LookupFile( // 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 @@ Optional<FileEntryRef> HeaderSearch::LookupFile( 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> HeaderSearch::LookupFile( } } - 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. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits