Kill PreprocessorFactory, which was both morally repugnant and totally unused.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86076 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/AnalysisConsumer.cpp b/lib/Frontend/AnalysisConsumer.cpp
index 049f3bd..714ede4 100644
--- a/lib/Frontend/AnalysisConsumer.cpp
+++ b/lib/Frontend/AnalysisConsumer.cpp
@@ -52,12 +52,11 @@
 //===----------------------------------------------------------------------===//
 
 static PathDiagnosticClient*
-CreatePlistHTMLDiagnosticClient(const std::string& prefix, Preprocessor* PP,
-                            PreprocessorFactory* PPF) {
+CreatePlistHTMLDiagnosticClient(const std::string& prefix, Preprocessor* PP) {
   llvm::sys::Path F(prefix);
   PathDiagnosticClientFactory *PF =
-    CreateHTMLDiagnosticClientFactory(F.getDirname(), PP, PPF);
-  return CreatePlistDiagnosticClient(prefix, PP, PPF, PF);
+    CreateHTMLDiagnosticClientFactory(F.getDirname(), PP);
+  return CreatePlistDiagnosticClient(prefix, PP, PF);
 }
 
 //===----------------------------------------------------------------------===//
@@ -78,7 +77,6 @@
     Diagnostic &Diags;
     ASTContext* Ctx;
     Preprocessor* PP;
-    PreprocessorFactory* PPF;
     const std::string OutDir;
     AnalyzerOptions Opts;
 
@@ -92,13 +90,11 @@
     llvm::OwningPtr<AnalysisManager> Mgr;
 
     AnalysisConsumer(Diagnostic &diags, Preprocessor* pp,
-                     PreprocessorFactory* ppf,
                      const LangOptions& lopts,
                      const std::string& outdir,
                      const AnalyzerOptions& opts)
-      : LOpts(lopts), Diags(diags),
-        Ctx(0), PP(pp), PPF(ppf),
-        OutDir(outdir), Opts(opts), PD(0) {
+      : LOpts(lopts), Diags(diags), Ctx(0), PP(pp), OutDir(outdir),
+        Opts(opts), PD(0) {
       DigestAnalyzerOptions();
     }
 
@@ -108,7 +104,7 @@
         switch (Opts.AnalysisDiagOpt) {
         default:
 #define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATEFN, AUTOCREATE) \
-          case PD_##NAME: PD = CREATEFN(OutDir, PP, PPF); break;
+          case PD_##NAME: PD = CREATEFN(OutDir, PP); break;
 #include "clang/Frontend/Analyses.def"
         }
       }
@@ -444,12 +440,11 @@
 //===----------------------------------------------------------------------===//
 
 ASTConsumer* clang::CreateAnalysisConsumer(Diagnostic &diags, Preprocessor* pp,
-                                           PreprocessorFactory* ppf,
                                            const LangOptions& lopts,
                                            const std::string& OutDir,
                                            const AnalyzerOptions& Opts) {
 
-  llvm::OwningPtr<AnalysisConsumer> C(new AnalysisConsumer(diags, pp, ppf,
+  llvm::OwningPtr<AnalysisConsumer> C(new AnalysisConsumer(diags, pp,
                                                            lopts, OutDir,
                                                            Opts));
 
diff --git a/lib/Frontend/HTMLDiagnostics.cpp b/lib/Frontend/HTMLDiagnostics.cpp
index 9d6f96c..648ecac 100644
--- a/lib/Frontend/HTMLDiagnostics.cpp
+++ b/lib/Frontend/HTMLDiagnostics.cpp
@@ -77,7 +77,6 @@
 
 PathDiagnosticClient*
 clang::CreateHTMLDiagnosticClient(const std::string& prefix, Preprocessor* PP,
-                                  PreprocessorFactory*,
                                   llvm::SmallVectorImpl<std::string>* FilesMade)
 {
   return new HTMLDiagnostics(prefix, PP, FilesMade);
@@ -111,8 +110,7 @@
 
 PathDiagnosticClientFactory*
 clang::CreateHTMLDiagnosticClientFactory(const std::string& prefix,
-                                         Preprocessor* PP,
-                                         PreprocessorFactory*) {
+                                         Preprocessor* PP) {
   return new HTMLDiagnosticsFactory(prefix, PP);
 }
 
@@ -216,12 +214,6 @@
   // for example.
 
   if (PP) html::SyntaxHighlight(R, FID, *PP);
-
-  // FIXME: We eventually want to use PPF to create a fresh Preprocessor,
-  //  once we have worked out the bugs.
-  //
-  // if (PPF) html::HighlightMacros(R, FID, *PPF);
-  //
   if (PP) html::HighlightMacros(R, FID, *PP);
 
   // Get the full directory name of the analyzed file.
diff --git a/lib/Frontend/HTMLPrint.cpp b/lib/Frontend/HTMLPrint.cpp
index 8d93d70..75e6184 100644
--- a/lib/Frontend/HTMLPrint.cpp
+++ b/lib/Frontend/HTMLPrint.cpp
@@ -13,13 +13,14 @@
 
 #include "clang/Frontend/ASTConsumers.h"
 #include "clang/AST/ASTConsumer.h"
-#include "clang/AST/Decl.h"
-#include "clang/Rewrite/Rewriter.h"
-#include "clang/Rewrite/HTMLRewrite.h"
-#include "clang/Basic/Diagnostic.h"
-#include "clang/Basic/SourceManager.h"
-#include "clang/Basic/FileManager.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/Decl.h"
+#include "clang/Basic/Diagnostic.h"
+#include "clang/Basic/FileManager.h"
+#include "clang/Basic/SourceManager.h"
+#include "clang/Lex/Preprocessor.h"
+#include "clang/Rewrite/HTMLRewrite.h"
+#include "clang/Rewrite/Rewriter.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace clang;
@@ -32,13 +33,14 @@
   class HTMLPrinter : public ASTConsumer {
     Rewriter R;
     llvm::raw_ostream *Out;
-    Diagnostic &Diags;
-    Preprocessor *PP;
-    PreprocessorFactory *PPF;
+    Preprocessor &PP;
+    bool SyntaxHighlight, HighlightMacros;
+
   public:
-    HTMLPrinter(llvm::raw_ostream *OS, Diagnostic &D, Preprocessor *pp,
-                PreprocessorFactory* ppf)
-      : Out(OS), Diags(D), PP(pp), PPF(ppf) {}
+    HTMLPrinter(llvm::raw_ostream *OS, Preprocessor &pp,
+                bool _SyntaxHighlight, bool _HighlightMacros)
+      : Out(OS), PP(pp), SyntaxHighlight(_SyntaxHighlight),
+        HighlightMacros(_HighlightMacros) {}
     virtual ~HTMLPrinter();
 
     void Initialize(ASTContext &context);
@@ -46,10 +48,10 @@
 }
 
 ASTConsumer* clang::CreateHTMLPrinter(llvm::raw_ostream *OS,
-                                      Diagnostic &D, Preprocessor *PP,
-                                      PreprocessorFactory* PPF) {
-
-  return new HTMLPrinter(OS, D, PP, PPF);
+                                      Preprocessor &PP,
+                                      bool SyntaxHighlight,
+                                      bool HighlightMacros) {
+  return new HTMLPrinter(OS, PP, SyntaxHighlight, HighlightMacros);
 }
 
 void HTMLPrinter::Initialize(ASTContext &context) {
@@ -57,7 +59,7 @@
 }
 
 HTMLPrinter::~HTMLPrinter() {
-  if (Diags.hasErrorOccurred())
+  if (PP.getDiagnostics().hasErrorOccurred())
     return;
 
   // Format the file.
@@ -79,8 +81,8 @@
   // We might not have a preprocessor if we come from a deserialized AST file,
   // for example.
 
-  if (PP) html::SyntaxHighlight(R, FID, *PP);
-  if (PPF) html::HighlightMacros(R, FID, *PP);
+  if (SyntaxHighlight) html::SyntaxHighlight(R, FID, PP);
+  if (HighlightMacros) html::HighlightMacros(R, FID, PP);
   html::EscapeText(R, FID, false, true);
 
   // Emit the HTML.
diff --git a/lib/Frontend/PlistDiagnostics.cpp b/lib/Frontend/PlistDiagnostics.cpp
index a83dca0..a10ecd4 100644
--- a/lib/Frontend/PlistDiagnostics.cpp
+++ b/lib/Frontend/PlistDiagnostics.cpp
@@ -29,7 +29,6 @@
 
 namespace clang {
   class Preprocessor;
-  class PreprocessorFactory;
 }
 
 namespace {
@@ -63,8 +62,7 @@
 }
 
 PathDiagnosticClient*
-clang::CreatePlistDiagnosticClient(const std::string& s,
-                                   Preprocessor *PP, PreprocessorFactory*,
+clang::CreatePlistDiagnosticClient(const std::string& s, Preprocessor *PP,
                                    PathDiagnosticClientFactory *PF) {
   return new PlistDiagnostics(s, PP->getLangOptions(), PF);
 }