diff options
author | Dan Gohman <gohman@apple.com> | 2010-01-21 10:13:27 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-01-21 10:13:27 +0000 |
commit | 7c6759094aa496c62c7f1616e54f496ad98da096 (patch) | |
tree | 25cfada43e6374341aa4dfecd0feff66650a2b5c /llvm/lib/Support | |
parent | 60a9bf414e9074e8e49718cd340224b1ab359f43 (diff) | |
download | bcm5719-llvm-7c6759094aa496c62c7f1616e54f496ad98da096.tar.gz bcm5719-llvm-7c6759094aa496c62c7f1616e54f496ad98da096.zip |
Avoid printing a spurious semicolon when there is no filename.
llvm-svn: 94071
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r-- | llvm/lib/Support/SourceMgr.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/llvm/lib/Support/SourceMgr.cpp b/llvm/lib/Support/SourceMgr.cpp index 7dd42f4df8f..bdc637a4a37 100644 --- a/llvm/lib/Support/SourceMgr.cpp +++ b/llvm/lib/Support/SourceMgr.cpp @@ -192,18 +192,21 @@ void SMDiagnostic::Print(const char *ProgName, raw_ostream &S) { if (ProgName && ProgName[0]) S << ProgName << ": "; - if (Filename == "-") - S << "<stdin>"; - else - S << Filename; + if (!Filename.empty()) { + if (Filename == "-") + S << "<stdin>"; + else + S << Filename; - if (LineNo != -1) { - S << ':' << LineNo; - if (ColumnNo != -1) - S << ':' << (ColumnNo+1); + if (LineNo != -1) { + S << ':' << LineNo; + if (ColumnNo != -1) + S << ':' << (ColumnNo+1); + } + S << ": "; } - S << ": " << Message << '\n'; + S << Message << '\n'; if (LineNo != -1 && ColumnNo != -1 && ShowLine) { S << LineContents << '\n'; |