[PATCH] D33013: Driver must return non-zero code on errors in command line

Serge Pavlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 17 05:16:26 PDT 2017


sepavloff added inline comments.


================
Comment at: lib/Tooling/CompilationDatabase.cpp:208
   IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
-  UnusedInputDiagConsumer DiagClient;
+  TextDiagnosticPrinter DiagnosticPrinter(llvm::errs(), &*DiagOpts);
+  UnusedInputDiagConsumer DiagClient(DiagnosticPrinter);
----------------
alexfh wrote:
> This code is used as a library not only for command-line tools. Directly using stderr is wrong in many use cases of the Tooling library. It should instead somehow let the user of the library get these errors via a provided DiagnosticConsumer. Not sure how to do this here without a more careful reading of the code, but wanted to let you know that this change causes a regression at least for clang-tidy (and likely for many other Clang tools).
This function does not have a way to report error, so its interface needs to be changed first. The change D33272 implements such modification.



https://reviews.llvm.org/D33013





More information about the cfe-commits mailing list