[cfe-dev] Fwd: warnings and error messages always go to standard error
Geoff Levner via cfe-dev
cfe-dev at lists.llvm.org
Tue Aug 28 13:37:49 PDT 2018
Aha! Thank you very much, Eli. That does the trick.
[Actually, though, you have to pass createDiagnostics() a
DiagnosticConsumer, which in my case is my TextDiagnosticPrinter.]
Geoff
On Tue, 28 Aug 2018 at 22:03, Friedman, Eli <efriedma at codeaurora.org> wrote:
> On 8/28/2018 12:51 PM, Geoff Levner via cfe-dev wrote:
>
> Greetings, clangspeople,
>
> We are using Clang and LLVM in an application to compile and execute C++
> code on the fly. If the code fails to compile, I would like to be able to
> pop up a dialog box telling the user why. But warnings and error messages
> go straight to standard error.
>
> I have tried passing a raw_string_ostream to TextDiagnosticPrinter instead
> of errs(), but that seems to have no effect. What is that stream actually
> used for? Am I doing something wrong? I have attached the code we use to
> compile (simplified a bit).
>
>
> The DiagnosticsEngine you pass to the Driver is only used for diagnostics
> from the driver itself, not the resulting compilation.
>
> createDiagnostics() takes a DiagnosticsEngine as a parameter. (If you
> don't explicitly pass one, it will create one for you, which prints
> diagnostics to stderr.)
>
> -Eli
>
> --
> Employee of Qualcomm Innovation Center, Inc.
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180828/1b64c715/attachment.html>
More information about the cfe-dev
mailing list