When emitting HTML messages, take into account margin fusing due to tabs.

llvm-svn: 48998
diff --git a/clang/Driver/HTMLDiagnostics.cpp b/clang/Driver/HTMLDiagnostics.cpp
index a473695..df2bb06 100644
--- a/clang/Driver/HTMLDiagnostics.cpp
+++ b/clang/Driver/HTMLDiagnostics.cpp
@@ -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>";