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 | 5e5442c98bbfaa93e74c3f1a7d104545e91ba00d (patch) | |
tree | 6eeceaa57362bb8ee394ef20a3ec491c80ef9fc7 /lib/Support | |
parent | c37e3d5d7cd9576711204dfd0240edefba2df4c7 (diff) | |
download | external_llvm-5e5442c98bbfaa93e74c3f1a7d104545e91ba00d.zip external_llvm-5e5442c98bbfaa93e74c3f1a7d104545e91ba00d.tar.gz external_llvm-5e5442c98bbfaa93e74c3f1a7d104545e91ba00d.tar.bz2 |
Avoid printing a spurious semicolon when there is no filename.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94071 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/SourceMgr.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/Support/SourceMgr.cpp b/lib/Support/SourceMgr.cpp index 7dd42f4..bdc637a 100644 --- a/lib/Support/SourceMgr.cpp +++ b/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'; |