Index: lib/Frontend/CompilerInstance.cpp =================================================================== --- lib/Frontend/CompilerInstance.cpp +++ lib/Frontend/CompilerInstance.cpp @@ -742,7 +742,7 @@ // Figure out where to get and map in the main file. if (InputFile != "-") { - const FileEntry *File; + const FileEntry *File = nullptr; if (Opts.FindPchSource.empty()) { File = FileMgr.getFile(InputFile, /*OpenFile=*/true); } else { @@ -760,13 +760,14 @@ SmallVector, 16> Includers; Includers.push_back(std::make_pair(FindFile, FindFile->getDir())); - File = HS->LookupFile(InputFile, SourceLocation(), /*isAngled=*/false, - /*FromDir=*/nullptr, - /*CurDir=*/UnusedCurDir, Includers, - /*SearchPath=*/nullptr, - /*RelativePath=*/nullptr, - /*RequestingModule=*/nullptr, - /*SuggestedModule=*/nullptr, /*SkipCache=*/true); + if (HS) + File = HS->LookupFile(InputFile, SourceLocation(), /*isAngled=*/false, + /*FromDir=*/nullptr, + /*CurDir=*/UnusedCurDir, Includers, + /*SearchPath=*/nullptr, + /*RelativePath=*/nullptr, + /*RequestingModule=*/nullptr, + /*SuggestedModule=*/nullptr, /*SkipCache=*/true); // Also add the header to /showIncludes output. if (File) DepOpts.ShowIncludesPretendHeader = File->getName();