aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/HTMLDiagnostics.cpp
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
commit3f0b6562486d91e2ebf729766e08ddf878c684e9 (patch)
tree4d1ca81d7869efea595d07ae5d0f7fb48a983ce0 /lib/Driver/HTMLDiagnostics.cpp
parentf231346438e61e59ff7b72d5ecbd58b6ae484211 (diff)
HTMLDiagnostics: Always display diagnostics *below* the line in question.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64959 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/HTMLDiagnostics.cpp')
-rw-r--r--lib/Driver/HTMLDiagnostics.cpp29
1 files changed, 7 insertions, 22 deletions
diff --git a/lib/Driver/HTMLDiagnostics.cpp b/lib/Driver/HTMLDiagnostics.cpp
index 1561fc455d..6a4bf2307f 100644
--- a/lib/Driver/HTMLDiagnostics.cpp
+++ b/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());
}