]> granicus.if.org Git - clang/commitdiff
When emitting HTML messages, take into account margin fusing due to tabs.
authorTed Kremenek <kremenek@apple.com>
Mon, 31 Mar 2008 21:40:14 +0000 (21:40 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 31 Mar 2008 21:40:14 +0000 (21:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48998 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/HTMLDiagnostics.cpp

index a4736950f335261424bb4de89ba2f3d8cfecc018..df2bb06636d4083cbf131c4b36f67b345258e744 100644 (file)
@@ -200,13 +200,20 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R,
   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>";