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 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 MSFE(MSFE_FE ? FileEntryRef(MSFE_Name, *MSFE_FE) - : Optional()); - CurDir = nullptr; // If this is a system #include, ignore the user #include locs.