[PATCH] D65627: [clang-doc] Add flag to continue after mapping errors

2019-08-02 Thread Diego Astiazarán via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL367729: [clang-doc] Add flag to continue after mapping 
errors (authored by DiegoAstiazaran, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65627?vs=213126&id=213135#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65627/new/

https://reviews.llvm.org/D65627

Files:
  clang-tools-extra/trunk/clang-doc/tool/ClangDocMain.cpp


Index: clang-tools-extra/trunk/clang-doc/tool/ClangDocMain.cpp
===
--- clang-tools-extra/trunk/clang-doc/tool/ClangDocMain.cpp
+++ clang-tools-extra/trunk/clang-doc/tool/ClangDocMain.cpp
@@ -48,6 +48,11 @@
 static llvm::cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage);
 static llvm::cl::OptionCategory ClangDocCategory("clang-doc options");
 
+static llvm::cl::opt 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
 OutDirectory("output",
  llvm::cl::desc("Directory for outputting generated files."),
@@ -229,8 +234,14 @@
   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.


Index: clang-tools-extra/trunk/clang-doc/tool/ClangDocMain.cpp
===
--- clang-tools-extra/trunk/clang-doc/tool/ClangDocMain.cpp
+++ clang-tools-extra/trunk/clang-doc/tool/ClangDocMain.cpp
@@ -48,6 +48,11 @@
 static llvm::cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage);
 static llvm::cl::OptionCategory ClangDocCategory("clang-doc options");
 
+static llvm::cl::opt 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
 OutDirectory("output",
  llvm::cl::desc("Directory for outputting generated files."),
@@ -229,8 +234,14 @@
   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.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D65627: [clang-doc] Add flag to continue after mapping errors

2019-08-02 Thread Diego Astiazarán via Phabricator via cfe-commits
DiegoAstiazaran updated this revision to Diff 213126.
DiegoAstiazaran retitled this revision from "[clang-doc] Continue after mapping 
error" to "[clang-doc] Add flag to continue after mapping errors".
DiegoAstiazaran edited the summary of this revision.
DiegoAstiazaran added a comment.

A flag has been added to decide if the tool should continue after an error 
occurs in the mapping phase.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65627/new/

https://reviews.llvm.org/D65627

Files:
  clang-tools-extra/clang-doc/tool/ClangDocMain.cpp


Index: clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
===
--- clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -48,6 +48,11 @@
 static llvm::cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage);
 static llvm::cl::OptionCategory ClangDocCategory("clang-doc options");
 
+static llvm::cl::opt 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
 OutDirectory("output",
  llvm::cl::desc("Directory for outputting generated files."),
@@ -229,8 +234,14 @@
   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.


Index: clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
===
--- clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -48,6 +48,11 @@
 static llvm::cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage);
 static llvm::cl::OptionCategory ClangDocCategory("clang-doc options");
 
+static llvm::cl::opt 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
 OutDirectory("output",
  llvm::cl::desc("Directory for outputting generated files."),
@@ -229,8 +234,14 @@
   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.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits