[PATCH] D33272: Method loadFromCommandLine should be able to report errors

Serge Pavlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 22 10:14:56 PDT 2017


sepavloff added a comment.

Thank you!

I put updated fix here. If it is OK, I'll commit it tomorrow.



================
Comment at: lib/Tooling/CompilationDatabase.cpp:292
+  if (Argc == 0) {
+    ErrorMsg = "error: no arguments specified\n";
+    return nullptr;
----------------
alexfh wrote:
> The lack of the arguments (or the `--` below) shouldn't be treated as an error (at least an error that is worth showing to the user). The caller will just move on to trying the next kind of a compilation database. The only actual errors we can get here may be coming from `stripPositionalArgs`.
> 
> The caller should be modified accordingly (i.e. not output anything when both the return value is `nullptr` and `ErrorMsg` is empty).
What if error message contains a prefix that indicates if this is error or warning? Errors could be printed and warnings ignored in `CommonOptionsParser.cpp:122`. Such solution would allow clients to investigate failures in more details.



https://reviews.llvm.org/D33272





More information about the cfe-commits mailing list