[cfe-dev] operatorCallExpr() AST matcher not working as expected
qiuyin at gmail.com
qiuyin at gmail.com
Mon Mar 18 23:17:38 PDT 2013
Define special stmt as those nodes for which shouldUseDataRecursionFor() returns true (namely, binary operator, unary operator, case stmt, and cxx operator call). It looks like RecursiveASTVisitor::dataTraverse() skips all special stmts whose parent is another special stmt. That's why the second op call was not visited. Because it is a special stmt, and its parent, the assign binary operator is special too. Perhaps i am ignorant, but is this intended behavior?
------¿¿¿¿------
¿¿¿ Yin Qiu <qiuyin at gmail.com>
To: <cfe-dev at cs.uiuc.edu>
Date: 2013年3月19日 星期二 上午08时51分25秒
Subject: operatorCallExpr() AST matcher not working as expected
Hi,
Given this code snippet,
1 class Bar
2 {
3 public:
4 int operator()(int);
5 };
6
7 void foo()
8 {
9 Bar bar;
10 int i1;
11 bar(1);
12 i1 = bar(1);
13 }
An operatorCallExpr matcher is able to find the the first
CXXOperatorCallExpr at line 11 but not the one at line 12.
MatchASTVisitor seems to skip a CXXOperatorCallExpr node under a
BinaryOperator. Is this expected?
--
Yin
More information about the cfe-dev
mailing list