[cfe-commits] r48998 - /cfe/trunk/Driver/HTMLDiagnostics.cpp
Ted Kremenek
kremenek at apple.com
Mon Mar 31 14:40:15 PDT 2008
Author: kremenek
Date: Mon Mar 31 16:40:14 2008
New Revision: 48998
URL: http://llvm.org/viewvc/llvm-project?rev=48998&view=rev
Log:
When emitting HTML messages, take into account margin fusing due to tabs.
Modified:
cfe/trunk/Driver/HTMLDiagnostics.cpp
Modified: cfe/trunk/Driver/HTMLDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/HTMLDiagnostics.cpp?rev=48998&r1=48997&r2=48998&view=diff
==============================================================================
--- cfe/trunk/Driver/HTMLDiagnostics.cpp (original)
+++ cfe/trunk/Driver/HTMLDiagnostics.cpp Mon Mar 31 16:40:14 2008
@@ -200,13 +200,20 @@
const char *TokLogicalPtr = LPos.getCharacterData();
const char *LineStart = TokLogicalPtr-ColNo;
+ // Compute the margin offset by counting tabs and non-tabs.
+
+ unsigned PosNo = 0;
+
+ for (const char* c = LineStart; c != TokLogicalPtr; ++c)
+ PosNo += *c == '\t' ? 8 : 1;
+
// Create the html for the message.
std::ostringstream os;
os << "\n<tr><td class=\"num\"></td><td class=\"line\">"
<< "<div class=\"msg\" style=\"margin-left:"
- << ColNo << "ex\">";
+ << PosNo << "ex\">";
os << html::EscapeText(P.getString()) << "</div></td></tr>";
More information about the cfe-commits
mailing list