class Preprocessor: Now owns the "predefines" char*; it deletes [] it in its dstor.

clang.cpp: InitializePreprocessor now makes a copy of the contents of PredefinesBuffer and
  passes it to the preprocessor object.
  
clang.cpp: DriverPreprocessorFactory now calls "InitializePreprocessor" instead of this being done in main().

html::HighlightMacros() now takes a PreprocessorFactory, allowing it to conjure up a new
Preprocessor to highlight macros.

class HTMLDiagnostics now takes a PreprocessorFactory* that it can use for html::HighlightMacros().
Updated clients of HTMLDiagnostics to use this new interface.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49875 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/HTMLDiagnostics.cpp b/Driver/HTMLDiagnostics.cpp
index 78381f9..4d95c17 100644
--- a/Driver/HTMLDiagnostics.cpp
+++ b/Driver/HTMLDiagnostics.cpp
@@ -38,8 +38,10 @@
   llvm::sys::Path Directory, FilePrefix;
   bool createdDir, noDir;
   Preprocessor* PP;
+  PreprocessorFactory* PPF;
 public:
-  HTMLDiagnostics(const std::string& prefix, Preprocessor* pp = NULL);
+  HTMLDiagnostics(const std::string& prefix, Preprocessor* pp,
+                  PreprocessorFactory* ppf);
 
   virtual ~HTMLDiagnostics() {}
   
@@ -53,18 +55,20 @@
   
 } // end anonymous namespace
 
-HTMLDiagnostics::HTMLDiagnostics(const std::string& prefix, Preprocessor* pp)
+HTMLDiagnostics::HTMLDiagnostics(const std::string& prefix, Preprocessor* pp,
+                                 PreprocessorFactory* ppf)
   : Directory(prefix), FilePrefix(prefix), createdDir(false), noDir(false),
-    PP(pp) {
+    PP(pp), PPF(ppf) {
   
   // All html files begin with "report" 
   FilePrefix.appendComponent("report");
 }
 
 PathDiagnosticClient*
-clang::CreateHTMLDiagnosticClient(const std::string& prefix, Preprocessor* PP) {
+clang::CreateHTMLDiagnosticClient(const std::string& prefix, Preprocessor* PP,
+                                  PreprocessorFactory* PPF) {
   
-  return new HTMLDiagnostics(prefix, PP);
+  return new HTMLDiagnostics(prefix, PP, PPF);
 }
 
 //===----------------------------------------------------------------------===//
@@ -122,10 +126,8 @@
   // We might not have a preprocessor if we come from a deserialized AST file,
   // for example.
   
-  if (PP) {
-    html::SyntaxHighlight(R, FileID, *PP);
-    // html::HighlightMacros(R, FileID, *PP);
-  }
+  if (PP) html::SyntaxHighlight(R, FileID, *PP);
+  if (PPF) html::HighlightMacros(R, FileID, *PPF);
   
   // Get the full directory name of the analyzed file.