[clang-tools-extra] r367729 - [clang-doc] Add flag to continue after mapping errors
Diego Astiazaran via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 2 15:02:36 PDT 2019
Author: diegoastiazaran
Date: Fri Aug 2 15:02:36 2019
New Revision: 367729
URL: http://llvm.org/viewvc/llvm-project?rev=367729&view=rev
Log:
[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
Modified:
clang-tools-extra/trunk/clang-doc/tool/ClangDocMain.cpp
Modified: clang-tools-extra/trunk/clang-doc/tool/ClangDocMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-doc/tool/ClangDocMain.cpp?rev=367729&r1=367728&r2=367729&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-doc/tool/ClangDocMain.cpp (original)
+++ clang-tools-extra/trunk/clang-doc/tool/ClangDocMain.cpp Fri Aug 2 15:02:36 2019
@@ -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.
More information about the cfe-commits
mailing list