Add a mode of hackily syntax highlighting comments.  This has a number of
problems, including the fact that it doesn't work well with multi-line 
comments due to Ted's crazy table.  However, that could be fixed, and it
does work with single-line ones :).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49778 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/HTMLPrint.cpp b/Driver/HTMLPrint.cpp
index 44cd624..cb32afd 100644
--- a/Driver/HTMLPrint.cpp
+++ b/Driver/HTMLPrint.cpp
@@ -30,9 +30,10 @@
     Rewriter R;
     std::string OutFilename;
     Diagnostic &Diags;
+    Preprocessor *PP;
   public:
-    HTMLPrinter(const std::string &OutFile, Diagnostic &D)
-      : OutFilename(OutFile), Diags(D) {}
+    HTMLPrinter(const std::string &OutFile, Diagnostic &D, Preprocessor *pp)
+      : OutFilename(OutFile), Diags(D), PP(pp) {}
     virtual ~HTMLPrinter();
     
     void Initialize(ASTContext &context);
@@ -40,8 +41,8 @@
 }
 
 ASTConsumer* clang::CreateHTMLPrinter(const std::string &OutFile, 
-                                      Diagnostic &D) {
-  return new HTMLPrinter(OutFile, D);
+                                      Diagnostic &D, Preprocessor *PP) {
+  return new HTMLPrinter(OutFile, D, PP);
 }
 
 void HTMLPrinter::Initialize(ASTContext &context) {
@@ -58,6 +59,12 @@
   html::AddLineNumbers(R, FileID);
   html::AddHeaderFooterInternalBuiltinCSS(R, FileID);
 
+  // If we have a preprocessor, relex the file and syntax hilight.  We might not
+  // have a preprocessor if we come from a deserialized AST file, for example.
+  if (PP)
+    html::SyntaxHighlight(R, FileID, *PP);
+  
+  
   // Open the output.
   FILE *OutputFILE;
   if (OutFilename.empty() || OutFilename == "-")