[cfe-dev] Disable lexical analyzer for clang

Ted Kremenek kremenek at apple.com
Wed Apr 6 12:39:16 PDT 2011


Internally, Clang will generate an AST even if a #include cannot be resolved.  It will leave holes in the AST, however, whenever it encounters a semantic error where it cannot construct a well-formed AST node.

On Apr 6, 2011, at 11:57 AM, Andrey Tarasevich wrote:

> Hello
> 
> Sorry, I send previous message with bad subject - "Disable". Now I fixed subject.
> 
> I'm doing some source-to-source manipulations. Is it possible to disable lexical analyzing during parsing? I mean, if there is an error during parsing, for instance consider following code sample
> 
> void main()
> {
>    int *a = NULL;
>    int b = 0;
>    b++;
> }
> 
> clang will indicate error for a NULL, since stdlib.h is not included. And that statement will be ignored for the AST generation. Is it possible to make clang ignore such errors and generate AST as there are no errors?
> 
> With best regards,
> Andrey Tarasevich
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list