[cfe-commits] r49005 - /cfe/trunk/Driver/HTMLDiagnostics.cpp

Ted Kremenek kremenek at apple.com
Mon Mar 31 16:30:12 PDT 2008


Author: kremenek
Date: Mon Mar 31 18:30:12 2008
New Revision: 49005

URL: http://llvm.org/viewvc/llvm-project?rev=49005&view=rev
Log:
Embed linkable IDs in message bubbles.

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=49005&r1=49004&r2=49005&view=diff

==============================================================================
--- cfe/trunk/Driver/HTMLDiagnostics.cpp (original)
+++ cfe/trunk/Driver/HTMLDiagnostics.cpp Mon Mar 31 18:30:12 2008
@@ -44,7 +44,9 @@
   
   virtual void HandlePathDiagnostic(const PathDiagnostic& D);
   
-  void HandlePiece(Rewriter& R, const PathDiagnosticPiece& P, unsigned num);
+  void HandlePiece(Rewriter& R, const PathDiagnosticPiece& P,
+                   unsigned num, unsigned max);
+  
   void HighlightRange(Rewriter& R, SourceRange Range, unsigned MainFileID);
 };
   
@@ -98,11 +100,12 @@
   // Process the path.
   
   unsigned n = D.size();
+  unsigned max = n;
   
   for (PathDiagnostic::const_reverse_iterator I=D.rbegin(), E=D.rend();
         I!=E; ++I, --n) {
     
-    HandlePiece(R, *I, n);
+    HandlePiece(R, *I, n, max);
   }
   
   // Add line numbers, header, footer, etc.
@@ -172,7 +175,7 @@
 
 void HTMLDiagnostics::HandlePiece(Rewriter& R,
                                   const PathDiagnosticPiece& P,
-                                  unsigned num) {
+                                  unsigned num, unsigned max) {
   
   // For now, just draw a box above the line in question, and emit the
   // warning.
@@ -212,7 +215,14 @@
   std::ostringstream os;
   
   os << "\n<tr><td class=\"num\"></td><td class=\"line\">"
-     << "<div class=\"msg\" style=\"margin-left:"
+     << "<div id=\"";
+  
+  if (num == max)
+    os << "EndPath";
+  else
+    os << "Path" << num;
+  
+  os << "\" class=\"msg\" style=\"margin-left:"
      << PosNo << "ex\">";
   
   os << html::EscapeText(P.getString()) << "</div></td></tr>";





More information about the cfe-commits mailing list