[cfe-dev] Parsing VCC annotations with clang

Florian Merz florian.merz at kit.edu
Tue May 31 04:48:33 PDT 2011


Hey Chris,

thank you for your response and the information you provided.

If I used a macro such as

  #define _(x) // x

so that x is not removed but turned into a comment instead. Can this comment 
be accessed in clang and can I determine the corresponding 
function/struct/loop with this? It seems like clang::CommentHandler is able to 
handle comments and determine the range of the comment in the source file. From 
there I'd expect to be able to determine the surrounding object easily. Am I 
on the right track with this?

Regards,
 Florian


Am Montag, 30. Mai 2011, 21:50:23 schrieb Chris Lattner:
> On May 30, 2011, at 1:46 AM, Florian Merz wrote:
> > What would be necessary to make clang able to parse VCC [1] annotations
> > like _(requires ...), _(ensures ...) and _(invariant)  in the example
> > above. I'd like to be able to turn these into run time checks for these
> > properties.
> 
> Hi Florian,
> 
> I'm not familiar with the extension, but this would likely rewrite a lot of
> parser work, as well as AST and code generation work.  This is an
> interesting research extension, but not likely something we'd take back
> into mainline.
> 
> -Chris




More information about the cfe-dev mailing list