[cfe-commits] r64959 - /cfe/trunk/lib/Driver/HTMLDiagnostics.cpp
Ted Kremenek
kremenek at apple.com
Wed Feb 18 14:10:01 PST 2009
Author: kremenek
Date: Wed Feb 18 16:10:00 2009
New Revision: 64959
URL: http://llvm.org/viewvc/llvm-project?rev=64959&view=rev
Log:
HTMLDiagnostics: Always display diagnostics *below* the line in question.
Modified:
cfe/trunk/lib/Driver/HTMLDiagnostics.cpp
Modified: cfe/trunk/lib/Driver/HTMLDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/HTMLDiagnostics.cpp?rev=64959&r1=64958&r2=64959&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/HTMLDiagnostics.cpp (original)
+++ cfe/trunk/lib/Driver/HTMLDiagnostics.cpp Wed Feb 18 16:10:00 2009
@@ -351,20 +351,14 @@
const char *TokInstantiationPtr =Pos.getInstantiationLoc().getCharacterData();
const char *LineStart = TokInstantiationPtr-ColNo;
- // Only compute LineEnd if we display below a line.
+ // Compute LineEnd.
const char *LineEnd = TokInstantiationPtr;
-
- if (P.getDisplayHint() == PathDiagnosticPiece::Below) {
- const char* FileEnd = Buf->getBufferEnd();
-
- while (*LineEnd != '\n' && LineEnd != FileEnd)
- ++LineEnd;
- }
+ const char* FileEnd = Buf->getBufferEnd();
+ while (*LineEnd != '\n' && LineEnd != FileEnd)
+ ++LineEnd;
// Compute the margin offset by counting tabs and non-tabs.
-
- unsigned PosNo = 0;
-
+ unsigned PosNo = 0;
for (const char* c = LineStart; c != TokInstantiationPtr; ++c)
PosNo += *c == '\t' ? 8 : 1;
@@ -432,19 +426,10 @@
os << html::EscapeText(Msg) << "</div></td></tr>";
// Insert the new html.
- unsigned DisplayPos;
- switch (P.getDisplayHint()) {
- default: assert(0 && "Unhandled hint.");
- case PathDiagnosticPiece::Above:
- DisplayPos = LineStart - FileStart;
- break;
- case PathDiagnosticPiece::Below:
- DisplayPos = LineEnd - FileStart;
- break;
- }
-
+ unsigned DisplayPos = LineEnd - FileStart;
SourceLocation Loc =
SM.getLocForStartOfFile(LPosInfo.first).getFileLocWithOffset(DisplayPos);
+
R.InsertStrBefore(Loc, os.str());
}
More information about the cfe-commits
mailing list