[cfe-dev] clang errors vs clang_getDiagnostics

Jacob Carlborg doob at me.com
Tue Jan 22 04:13:28 PST 2013


On 2013-01-22 08:25, Anders Bakken wrote:

> I get this:
>
> main.cpp:4:3: error: use of undeclared identifier 'foobaz'; did you
> mean 'foobar'?
>    foobaz();
>    ^~~~~~
>    foobar
> main.cpp:1:6: note: 'foobar' declared here
> void foobar();
>       ^
> 1 error generated.
>
> If I do the same thing with clang_parseTranslationUnit and then
> clang_getDiagnostic I don't seem to get this suggestion. I just get:
>
> error: use of undeclared identifier 'foobaz' [2, Semantic Issue]
>
> Do I need to pass a switch that is on by default for clang itself?

I think it's Clang (not libclang) that outputs the error message in this 
format. What you get from libclang is only a simple default 
implementation of formatting error messages.

-- 
/Jacob Carlborg




More information about the cfe-dev mailing list