Hi,
I'm playing with a recursive AST, and I want to visit all the DeclRefExprs and record them. I have been able to do this successfully, by overloading VisitDeclRefExpr, except for this section:
bool isValid = IN_RANGE(tx, validXmin, validXmax);
if (isValid)
validBuffer[get_global_id(0)] = true;
Where the AST looks like this:
(DeclStmt 0x5003680 <line:67:2, col:51>
(0x5003410 "bool isValid =
(ParenExpr 0x5003660 <line:1:31, col:56> '_Bool'
(BinaryOperator 0x5003638 <col:32, col:55> '_Bool' '&&'
(BinaryOperator 0x5003528 <col:32, col:41> '_Bool' '>='
(ImplicitCastExpr 0x50034f8 <col:32, col:34> 'int' <LValueToRValue>
(ParenExpr 0x5003490 <col:32, col:34> 'int' lvalue
(DeclRefExpr 0x5003468 <line:67:26> 'int' lvalue Var 0x5002000 'tx' 'int')))
(ImplicitCastExpr 0x5003510 <line:1:37, col:41> 'int' <LValueToRValue>
(ParenExpr 0x50034d8 <col:37, col:41> 'int' lvalue
(DeclRefExpr 0x50034b0 <line:67:30> 'int' lvalue Var 0x5002860 'validXmin' 'int'))))
(BinaryOperator 0x5003610 <line:1:46, col:55> '_Bool' '<='
(ImplicitCastExpr 0x50035e0 <col:46, col:48> 'int' <LValueToRValue>
(ParenExpr 0x5003578 <col:46, col:48> 'int' lvalue
(DeclRefExpr 0x5003550 <line:67:26> 'int' lvalue Var 0x5002000 'tx' 'int')))
(ImplicitCastExpr 0x50035f8 <line:1:51, col:55> 'int' <LValueToRValue>
(ParenExpr 0x50035c0 <col:51, col:55> 'int' lvalue
(DeclRefExpr 0x5003598 <line:67:41> 'int' lvalue Var 0x5002a40 'validXmax' 'int'))))))"))
(IfStmt 0x5003868 <line:69:2, line:70:35>
(<<<NULL>>>)
(ImplicitCastExpr 0x50036c0 <line:69:6> '_Bool' <LValueToRValue>
(DeclRefExpr 0x5003698 <col:6> '_Bool' lvalue Var 0x5003410 'isValid' '_Bool'))
(BinaryOperator 0x5003840 <line:70:3, col:35> '_Bool' lvalue '='
(ArraySubscriptExpr 0x5003800 <col:3, col:31> '_Bool' lvalue
(ImplicitCastExpr 0x50037e8 <col:3> '_Bool *' <LValueToRValue>
(DeclRefExpr 0x50036d8 <col:3> '_Bool *' lvalue ParmVar 0x5001940 'validBuffer' '_Bool *'))
(CallExpr 0x50037b8 <col:15, col:30> 'int'
(ImplicitCastExpr 0x50037a0 <col:15> 'int (*)(int)' <FunctionToPointerDecay>
(DeclRefExpr 0x5003778 <col:15> 'int (int)' lvalue Function 0x5000d90 'get_global_id' 'int (int)'))
(IntegerLiteral 0x5003758 <col:29> 'int' 0)))
(CXXBoolLiteralExpr 0x5003828 <col:35> '_Bool' true))
(<<<NULL>>>))
My problem is that isValid in the if condition is not visited here. isValid is visited if i use a variable to store the result from get_global_id and use it to id the array, what is the reason for this?
Many thanks,
Sam