[cfe-commits] r64750 - /cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp
Chris Lattner
sabre at nondot.org
Mon Feb 16 23:34:34 PST 2009
Author: lattner
Date: Tue Feb 17 01:34:34 2009
New Revision: 64750
URL: http://llvm.org/viewvc/llvm-project?rev=64750&view=rev
Log:
simplify some code.
Modified:
cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp
Modified: cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp?rev=64750&r1=64749&r2=64750&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp (original)
+++ cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp Tue Feb 17 01:34:34 2009
@@ -103,8 +103,6 @@
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 @@
}
// 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 @@
// 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.
More information about the cfe-commits
mailing list