diff options
| author | Diego Astiazaran <diegoaat97@gmail.com> | 2019-08-02 22:02:36 +0000 |
|---|---|---|
| committer | Diego Astiazaran <diegoaat97@gmail.com> | 2019-08-02 22:02:36 +0000 |
| commit | 8fb7074d3b2831dd3ad812585f9f82d015d041da (patch) | |
| tree | a8f2e0a3b4eefdcf0a980f74cf38fc48c91249d1 /clang-tools-extra/clang-doc | |
| parent | 21d01ea9b6f106371a131fd4676e798ff6382aab (diff) | |
| download | bcm5719-llvm-8fb7074d3b2831dd3ad812585f9f82d015d041da.tar.gz bcm5719-llvm-8fb7074d3b2831dd3ad812585f9f82d015d041da.zip | |
[clang-doc] Add flag to continue after mapping errors
The tool used to stop execution if there was an error in the mapping
phase. It will now show the error but continue with the files that were
mapped correctly if the flag is true.
Differential revision: https://reviews.llvm.org/D65627
llvm-svn: 367729
Diffstat (limited to 'clang-tools-extra/clang-doc')
| -rw-r--r-- | clang-tools-extra/clang-doc/tool/ClangDocMain.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp index 0e910f3506c..c0bc5bc27bb 100644 --- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp +++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp @@ -48,6 +48,11 @@ using namespace clang; static llvm::cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage); static llvm::cl::OptionCategory ClangDocCategory("clang-doc options"); +static llvm::cl::opt<bool> IgnoreMappingFailures( + "ignore-map-errors", + llvm::cl::desc("Continue if files are not mapped correctly."), + llvm::cl::init(true), llvm::cl::cat(ClangDocCategory)); + static llvm::cl::opt<std::string> OutDirectory("output", llvm::cl::desc("Directory for outputting generated files."), @@ -229,8 +234,14 @@ int main(int argc, const char **argv) { auto Err = Exec->get()->execute(doc::newMapperActionFactory(CDCtx), ArgAdjuster); if (Err) { - llvm::errs() << toString(std::move(Err)) << "\n"; - return 1; + if (IgnoreMappingFailures) + llvm::errs() << "Error mapping decls in files. Clang-doc will ignore " + "these files and continue:\n" + << toString(std::move(Err)) << "\n"; + else { + llvm::errs() << toString(std::move(Err)) << "\n"; + return 1; + } } // Collect values into output by key. |

