diff options
Diffstat (limited to 'clang-tools-extra/clang-doc/tool')
| -rw-r--r-- | clang-tools-extra/clang-doc/tool/ClangDocMain.cpp | 78 |
1 files changed, 14 insertions, 64 deletions
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp index 6b50f6ca838..d8559aae2b5 100644 --- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp +++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp @@ -56,19 +56,14 @@ static llvm::cl::opt<std::string> 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 @@ static llvm::cl::opt<OutputFormatTy> 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 @@ bool CreateDirectory(const Twine &DirName, bool ClearDirectory = false) { 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 @@ getInfoOutputFile(StringRef Root, 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 @@ int main(int argc, const char **argv) { 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 @@ int main(int argc, const char **argv) { 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 = |

