[cfe-dev] clang errors vs clang_getDiagnostics

Anders Bakken agbakken at gmail.com
Mon Jan 21 23:32:40 PST 2013


Oops. I found it. -fspell-checking. Sorry for the spam.

Anders

On Mon, Jan 21, 2013 at 11:25 PM, Anders Bakken <agbakken at gmail.com> wrote:
> Hi
>
> I have a problem with using diagnostics with the C API.
>
> I do this on the command line:
>
> main.cpp:
>
> void foobar();
>
> int main() {
>   foobaz();
> }
>
> clang main.cpp
>
> 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?
>
> regards
>
> Anders



More information about the cfe-dev mailing list