Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] issue with ASTRewrite and assert macro

I don't think ASTRewrite can handle changes affecting macro arguments. Could you please file a bug. I'll gladly review any patch that comes with it.

-sergey


On Fri, Jul 19, 2013 at 5:12 PM, Ayupov, Andrey <andrey.ayupov@xxxxxxxxx> wrote:

Just wanted to check if the issue that I am hitting is a known one and would appreciate any feedback on whether there are plans to fix it.

ASTRewrite does not generate assert macro from AST correctly. I made an experiment, where for the following code

 

assert(a>0);

 

I just replaced IASTIdExpression (corresponding to variable ‘a’ in the _expression_ above a>0) by its copy, presumably without changing the AST structure:

rewriter.replace(orig, orig.copy(), null);

 

The code that’s being generated looks like this:

a;

 

Just for reference, the assert macro is taken from assert.h that looks like this:

# define assert(expr) \

  (__ASSERT_VOID_CAST ((expr) ? 0 :                                                                           \

                                     (__assert_fail (__STRING(expr), __FILE__, __LINE__,    \

                                                                   __ASSERT_FUNCTION), 0)))

 

Thanks,

Andrey

 


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



Back to the top