summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-02-18 22:10:00 +0000
committerTed Kremenek <kremenek@apple.com>2009-02-18 22:10:00 +0000
commitea3a9e270cc73fbde3e0f7c132f845a74adb9467 (patch)
tree236b378b24755b65a60318c0ee1d036eeba20835 /clang/lib
parente3bba6e3d0c6b78b26359e80ac373846a29b2ae0 (diff)
downloadbcm5719-llvm-ea3a9e270cc73fbde3e0f7c132f845a74adb9467.tar.gz
bcm5719-llvm-ea3a9e270cc73fbde3e0f7c132f845a74adb9467.zip
HTMLDiagnostics: Always display diagnostics *below* the line in question.
llvm-svn: 64959
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/HTMLDiagnostics.cpp29
1 files changed, 7 insertions, 22 deletions
diff --git a/clang/lib/Driver/HTMLDiagnostics.cpp b/clang/lib/Driver/HTMLDiagnostics.cpp
index 1561fc455d7..6a4bf2307f6 100644
--- a/clang/lib/Driver/HTMLDiagnostics.cpp
+++ b/clang/lib/Driver/HTMLDiagnostics.cpp
@@ -351,20 +351,14 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID,
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 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID,
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());
}
OpenPOWER on IntegriCloud