[cfe-dev] I can't get the defined size
Rajendra
rks at cse.iitb.ac.in
Wed Dec 26 01:04:31 PST 2012
I am also looking to get defined size of array.
Using VisitDeclStmt(Stmt *s), I can get following info:
Found DeclStmt
decl statement: int dummy[5]
identifier name = dummy
type = int [5]
But how to get defined size?
Also using, VisitBinAssign(BinaryOperator *E) and
VisitArraySubscriptExpr(ArraySubscriptExpr* S), I can get following info:
Found BinaryOperator
Assignment Op = in B1
IntegerLiteral:
RHS value: 10
found array subscript expr
ImplicitCastExpr:
ArrayToPointerDecay
identifier = arr
IntegerLiteral:
index value: 9
But why I am getting RHS first for arr[9] = 10;? I should get first LHS
arr[9] and then RHS value 10, since Visit methods are called in pre-order
DFS manner as AST is traverse. Correct me if it is otherwise?
I am having same trouble when I have unary minus on LHS of a binary
operation (e.g. x = -1 + x;), then VisitUnaryMinus() is getting visited
after RHS? why it is so?
- Rajendra
--
View this message in context: http://clang-developers.42468.n3.nabble.com/I-can-t-get-the-defined-size-tp4029189p4029192.html
Sent from the Clang Developers mailing list archive at Nabble.com.
More information about the cfe-dev
mailing list