[cfe-dev] redirect clang warning/error ouput

mats petersson via cfe-dev cfe-dev at lists.llvm.org
Thu Aug 17 02:14:28 PDT 2017


To a "buffer" (along the lines of `std::stringstream`) is also possible if
you write your own "driver" for the compiler, but clang as an exectuable
file has no concept of "buffer" as output destination.

I'm not going to look up exactly how to do write the necessary code to
capture the output from the compiler components, but I know it's possible,
and there have been posts about it in the past.

--
Mats

On 17 August 2017 at 02:46, Jonas Devlieghere via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi Ogzu,
>
> Clang prints both errors and warnings to stderr. You could redirect stdout
> to a file and redirect stderr to stdout: clang foo.c > file 2>&1
>
> Cheers,
> Jonas
>
> On Wed, Aug 16, 2017 at 4:39 PM, ogzu rasa via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> Hello,
>> How can I redirect clang (version 3.8.1) warning/error message to a
>> buffer ?
>>
>> Thanks in advance for helps,
>> ogzu
>>
>>
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Garanti
>> sans virus. www.avast.com
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>> <#m_6012979265466226631_m_7454206286853231618_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170817/30b38bdf/attachment.html>


More information about the cfe-dev mailing list