Skip to main content

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

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





Back to the top