Be defensive when printing module import locations; the diagnostic printer needs to be robust

llvm-svn: 170466
This commit is contained in:
Douglas Gregor 2012-12-18 23:02:07 +00:00
parent 00f6c7754b
commit dfc9430bc7
1 changed files with 1 additions and 1 deletions

View File

@ -898,7 +898,7 @@ void TextDiagnostic::emitBuildingModuleLocation(SourceLocation Loc,
PresumedLoc PLoc,
StringRef ModuleName,
const SourceManager &SM) {
if (DiagOpts->ShowLocation)
if (DiagOpts->ShowLocation && PLoc.getFilename())
OS << "While building module '" << ModuleName << "' imported from "
<< PLoc.getFilename() << ':' << PLoc.getLine() << ":\n";
else