diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
| commit | 45b533945f0851ec234ca846e1af5ee1e4df0b6e (patch) | |
| tree | 0a5b74c0b9ca73aded34df95c91fcaf3815230d8 /lib/Frontend/TextDiagnostic.cpp | |
| parent | 7e86edd64bfae4e324224452e4ea879b3371a4bd (diff) | |
Notes
Diffstat (limited to 'lib/Frontend/TextDiagnostic.cpp')
| -rw-r--r-- | lib/Frontend/TextDiagnostic.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Frontend/TextDiagnostic.cpp b/lib/Frontend/TextDiagnostic.cpp index aaf17a983371..d4e156d44582 100644 --- a/lib/Frontend/TextDiagnostic.cpp +++ b/lib/Frontend/TextDiagnostic.cpp @@ -777,7 +777,7 @@ void TextDiagnostic::emitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc, if (PLoc.isInvalid()) { // At least print the file name if available: FileID FID = SM.getFileID(Loc); - if (!FID.isInvalid()) { + if (FID.isValid()) { const FileEntry* FE = SM.getFileEntryForID(FID); if (FE && FE->isValid()) { OS << FE->getName(); @@ -875,7 +875,7 @@ void TextDiagnostic::emitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc, void TextDiagnostic::emitIncludeLocation(SourceLocation Loc, PresumedLoc PLoc, const SourceManager &SM) { - if (DiagOpts->ShowLocation) + if (DiagOpts->ShowLocation && PLoc.getFilename()) OS << "In file included from " << PLoc.getFilename() << ':' << PLoc.getLine() << ":\n"; else @@ -885,11 +885,11 @@ void TextDiagnostic::emitIncludeLocation(SourceLocation Loc, void TextDiagnostic::emitImportLocation(SourceLocation Loc, PresumedLoc PLoc, StringRef ModuleName, const SourceManager &SM) { - if (DiagOpts->ShowLocation) + if (DiagOpts->ShowLocation && PLoc.getFilename()) OS << "In module '" << ModuleName << "' imported from " << PLoc.getFilename() << ':' << PLoc.getLine() << ":\n"; else - OS << "In module " << ModuleName << "':\n"; + OS << "In module '" << ModuleName << "':\n"; } void TextDiagnostic::emitBuildingModuleLocation(SourceLocation Loc, @@ -1060,7 +1060,7 @@ void TextDiagnostic::emitSnippetAndCaret( SmallVectorImpl<CharSourceRange>& Ranges, ArrayRef<FixItHint> Hints, const SourceManager &SM) { - assert(!Loc.isInvalid() && "must have a valid source location here"); + assert(Loc.isValid() && "must have a valid source location here"); assert(Loc.isFileID() && "must have a file location here"); // If caret diagnostics are enabled and we have location, we want to |
