[clang-doc] Limit integration tests

Now that the clang-doc libraries are covered by unit tests, we don't
need to have extensive (and unmaintainable) integration tests. This
replaces the integration test suite with a smaller one that just tests
the tool itself and removes extraneous dumping logic from the tool
itself.

Includes tests that cover the parse->serialize->merge->generate
pipeline, as well as tests for the --public, --format, --doxygen, and
--output flags.

Differential Revision: https://reviews.llvm.org/D53150

llvm-svn: 344655
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index 6b50f6c..d8559aa 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -56,19 +56,14 @@
                  llvm::cl::init("docs"), llvm::cl::cat(ClangDocCategory));
 
 static llvm::cl::opt<bool>
-    DumpMapperResult("dump-mapper",
-                     llvm::cl::desc("Dump mapper results to bitcode file."),
-                     llvm::cl::init(false), llvm::cl::cat(ClangDocCategory));
-
-static llvm::cl::opt<bool> DumpIntermediateResult(
-    "dump-intermediate",
-    llvm::cl::desc("Dump intermediate results to bitcode file."),
-    llvm::cl::init(false), llvm::cl::cat(ClangDocCategory));
-
-static llvm::cl::opt<bool>
     PublicOnly("public", llvm::cl::desc("Document only public declarations."),
                llvm::cl::init(false), llvm::cl::cat(ClangDocCategory));
 
+static llvm::cl::opt<bool> DoxygenOnly(
+    "doxygen",
+    llvm::cl::desc("Use only doxygen-style comments to generate docs."),
+    llvm::cl::init(false), llvm::cl::cat(ClangDocCategory));
+
 enum OutputFormatTy {
   md,
   yaml,
@@ -83,10 +78,15 @@
                llvm::cl::init(OutputFormatTy::yaml),
                llvm::cl::cat(ClangDocCategory));
 
-static llvm::cl::opt<bool> DoxygenOnly(
-    "doxygen",
-    llvm::cl::desc("Use only doxygen-style comments to generate docs."),
-    llvm::cl::init(false), llvm::cl::cat(ClangDocCategory));
+std::string getFormatString() {
+  switch (FormatEnum) {
+  case OutputFormatTy::yaml:
+    return "yaml";
+  case OutputFormatTy::md:
+    return "md";
+  }
+  llvm_unreachable("Unknown OutputFormatTy");
+}
 
 bool CreateDirectory(const Twine &DirName, bool ClearDirectory = false) {
   std::error_code OK;
@@ -107,26 +107,6 @@
   return false;
 }
 
-bool DumpResultToFile(const Twine &DirName, const Twine &FileName,
-                      StringRef Buffer, bool ClearDirectory = false) {
-  std::error_code OK;
-  llvm::SmallString<128> IRRootPath;
-  llvm::sys::path::native(OutDirectory, IRRootPath);
-  llvm::sys::path::append(IRRootPath, DirName);
-  if (CreateDirectory(IRRootPath, ClearDirectory))
-    return true;
-  llvm::sys::path::append(IRRootPath, FileName);
-  std::error_code OutErrorInfo;
-  llvm::raw_fd_ostream OS(IRRootPath, OutErrorInfo, llvm::sys::fs::F_None);
-  if (OutErrorInfo != OK) {
-    llvm::errs() << "Error opening documentation file.\n";
-    return true;
-  }
-  OS << Buffer;
-  OS.close();
-  return false;
-}
-
 // A function to extract the appropriate path name for a given info's
 // documentation. The path returned is a composite of the parent namespaces as
 // directories plus the decl name as the filename.
@@ -161,16 +141,6 @@
   return Path;
 }
 
-std::string getFormatString() {
-  switch (FormatEnum) {
-  case OutputFormatTy::yaml:
-    return "yaml";
-  case OutputFormatTy::md:
-    return "md";
-  }
-  llvm_unreachable("Unknown OutputFormatTy");
-}
-
 // Iterate through tool results and build string map of info vectors from the
 // encoded bitstreams.
 bool bitcodeResultsToInfos(
@@ -234,17 +204,6 @@
     return 1;
   }
 
-  if (DumpMapperResult) {
-    bool Err = false;
-    Exec->get()->getToolResults()->forEachResult(
-        [&](StringRef Key, StringRef Value) {
-          Err = DumpResultToFile("bc", Key + ".bc", Value);
-        });
-    if (Err)
-      llvm::errs() << "Error dumping map results.\n";
-    return Err;
-  }
-
   // Collect values into output by key.
   // In ToolResults, the Key is the hashed USR and the value is the
   // bitcode-encoded representation of the Info object.
@@ -262,15 +221,6 @@
       continue;
     }
 
-    if (DumpIntermediateResult) {
-      SmallString<4096> Buffer;
-      llvm::BitstreamWriter Stream(Buffer);
-      doc::ClangDocBitcodeWriter Writer(Stream);
-      Writer.dispatchInfoForWrite(Reduced.get().get());
-      if (DumpResultToFile("bc", Group.getKey() + ".bc", Buffer))
-        llvm::errs() << "Error dumping to bitcode.\n";
-      continue;
-    }
     doc::Info *I = Reduced.get().get();
 
     auto InfoPath =