aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/TextDiagnosticPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-17 07:34:34 +0000
committerChris Lattner <sabre@nondot.org>2009-02-17 07:34:34 +0000
commit8f7b396f497e25d462f38b9ad6ebd74acab38dde (patch)
tree7b422e1080dcad694f570967e9c8761f9bf5433c /lib/Driver/TextDiagnosticPrinter.cpp
parent4330d65797e10618e39817ca59e8772671c3de59 (diff)
simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64750 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/TextDiagnosticPrinter.cpp')
-rw-r--r--lib/Driver/TextDiagnosticPrinter.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Driver/TextDiagnosticPrinter.cpp b/lib/Driver/TextDiagnosticPrinter.cpp
index fb0e49e6cb..1d61f85c33 100644
--- a/lib/Driver/TextDiagnosticPrinter.cpp
+++ b/lib/Driver/TextDiagnosticPrinter.cpp
@@ -103,8 +103,6 @@ void TextDiagnosticPrinter::HighlightRange(const SourceRange &R,
void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
const DiagnosticInfo &Info) {
- unsigned ColNo = 0;
-
// If the location is specified, print out a file/line/col and include trace
// if enabled.
if (Info.getLocation().isValid()) {
@@ -120,11 +118,11 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
}
// Compute the column number.
- ColNo = PLoc.getColumn();
if (ShowLocation) {
OS << PLoc.getFilename() << ':' << LineNo << ':';
- if (ColNo && ShowColumn)
- OS << ColNo << ':';
+ if (ShowColumn)
+ if (unsigned ColNo = PLoc.getColumn())
+ OS << ColNo << ':';
OS << ' ';
}
}
@@ -155,6 +153,8 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
// about presumed locations anymore.
FullSourceLoc ILoc = Info.getLocation().getInstantiationLoc();
+ unsigned ColNo = ILoc.getInstantiationColumnNumber();
+
// Rewind from the current position to the start of the line.
const char *TokInstantiationPtr = ILoc.getCharacterData();
const char *LineStart = TokInstantiationPtr-ColNo+1; // Column # is 1-based.