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.


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




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:



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)))





cdt-dev mailing list

Back to the top