Move options for -E mode from PrintPreprocessedOutput.cpp to 
clang-cc.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72095 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/clang-cc/PrintPreprocessedOutput.cpp b/tools/clang-cc/PrintPreprocessedOutput.cpp
index 23a728c..429b829 100644
--- a/tools/clang-cc/PrintPreprocessedOutput.cpp
+++ b/tools/clang-cc/PrintPreprocessedOutput.cpp
@@ -81,22 +81,6 @@
 // Preprocessed token printer
 //===----------------------------------------------------------------------===//
 
-static llvm::cl::opt<bool>
-DisableLineMarkers("P", llvm::cl::desc("Disable linemarker output in -E mode"));
-static llvm::cl::opt<bool>
-EnableCommentOutput("C", llvm::cl::desc("Enable comment output in -E mode"));
-static llvm::cl::opt<bool>
-EnableMacroCommentOutput("CC",
-                         llvm::cl::desc("Enable comment output in -E mode, "
-                                        "even from macro expansions"));
-static llvm::cl::opt<bool>
-DumpMacros("dM", llvm::cl::desc("Print macro definitions in -E mode instead of"
-                                " normal output"));
-
-static llvm::cl::opt<bool>
-DumpDefines("dD", llvm::cl::desc("Print macro definitions in -E mode in "
-                                "addition to normal output"));
-
 namespace {
 class PrintPPOutputPPCallbacks : public PPCallbacks {
   Preprocessor &PP;
@@ -109,9 +93,13 @@
   SrcMgr::CharacteristicKind FileType;
   llvm::SmallString<512> CurFilename;
   bool Initialized;
+  bool DisableLineMarkers;
+  bool DumpDefines;
 public:
-  PrintPPOutputPPCallbacks(Preprocessor &pp, llvm::raw_ostream &os)
-     : PP(pp), ConcatInfo(PP), OS(os) {
+  PrintPPOutputPPCallbacks(Preprocessor &pp, llvm::raw_ostream &os,
+                           bool lineMarkers, bool defines)
+     : PP(pp), ConcatInfo(PP), OS(os), DisableLineMarkers(lineMarkers),
+       DumpDefines(defines) {
     CurLine = 0;
     CurFilename += "<uninit>";
     EmittedTokensOnThisLine = false;
@@ -441,19 +429,19 @@
 
 /// DoPrintPreprocessedInput - This implements -E mode.
 ///
-void clang::DoPrintPreprocessedInput(Preprocessor &PP, llvm::raw_ostream *OS) {
-  if (DumpMacros) {
-    DoPrintMacros(PP, OS);
-    return;
-  }
-
+void clang::DoPrintPreprocessedInput(Preprocessor &PP, llvm::raw_ostream *OS,
+                                     bool EnableCommentOutput,
+                                     bool EnableMacroCommentOutput,
+                                     bool DisableLineMarkers,
+                                     bool DumpDefines) {
   // Inform the preprocessor whether we want it to retain comments or not, due
   // to -C or -CC.
   PP.SetCommentRetentionState(EnableCommentOutput, EnableMacroCommentOutput);
 
   OS->SetBufferSize(64*1024);
 
-  PrintPPOutputPPCallbacks *Callbacks = new PrintPPOutputPPCallbacks(PP, *OS);
+  PrintPPOutputPPCallbacks *Callbacks =
+      new PrintPPOutputPPCallbacks(PP, *OS, DisableLineMarkers, DumpDefines);
   PP.AddPragmaHandler(0, new UnknownPragmaHandler("#pragma", Callbacks));
   PP.AddPragmaHandler("GCC", new UnknownPragmaHandler("#pragma GCC",
                                                       Callbacks));