File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 4343using namespace clang ::ast_matchers;
4444using namespace clang ::tooling;
4545using namespace clang ;
46- static llvm::ExitOnError ExitOnErr;
4746
4847static llvm::cl::extrahelp CommonHelp (CommonOptionsParser::HelpMessage);
4948static llvm::cl::OptionCategory ClangDocCategory (" clang-doc options" );
@@ -119,6 +118,8 @@ static llvm::cl::opt<OutputFormatTy> FormatEnum(
119118 " Documentation in mustache HTML format" )),
120119 llvm::cl::init(OutputFormatTy::yaml), llvm::cl::cat(ClangDocCategory));
121120
121+ static llvm::ExitOnError ExitOnErr;
122+
122123static std::string getFormatString () {
123124 switch (FormatEnum) {
124125 case OutputFormatTy::yaml:
@@ -387,8 +388,13 @@ Example usage for a project using a compile commands database:
387388 sortUsrToInfo (USRToInfo);
388389
389390 // Ensure the root output directory exists.
390- ExitOnErr (
391- llvm::errorCodeToError (llvm::sys::fs::create_directories (OutDirectory)));
391+ if (std::error_code Err = llvm::sys::fs::create_directories (OutDirectory);
392+ Err != std::error_code ()) {
393+ ExitOnErr (llvm::createStringError (
394+ llvm::inconvertibleErrorCode (), " Failed to create directory '%s': %s" ,
395+ OutDirectory.c_str (), Err.message ().c_str ()));
396+ }
397+
392398
393399 // Run the generator.
394400 llvm::outs () << " Generating docs...\n " ;
Original file line number Diff line number Diff line change 1+ // RUN: not clang-doc %S/Inputs/basic-project/src/Circle.cpp -output=/root/docs 2>&1 | FileCheck %s
2+
3+ // CHECK: clang-doc error: Failed to create directory
4+
You can’t perform that action at this time.
0 commit comments