[cfe-dev] Source Rewrite while parsing
Arpit Sancheti
arpit.sancheti2002 at gmail.com
Mon Aug 5 00:35:26 PDT 2013
Respected Sir,
I want clang to transform some specially written comments in C:
/*
@requires { x >= 0 }
@ensures { result = 0 }
*/
int reduce_to_zero (int x)
{
while (x != 0) {
x = x - 1;
}
return x;
}
should be parsed as:
int reduce_to_zero (int x)
{
if( x >= 0 )
{
while (x != 0) {
x = x - 1;
}
}
if( result = 0 )
return x;
}
Here the requires keyword in the comment serves as the pre-condition and
ensures keyword serves as the post-condition for this function.
Could you please tell me how should I approach to this problem.
Thanks in advance
Arpit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130805/89d7d039/attachment.html>
More information about the cfe-dev
mailing list