ROSE  0.11.52.0
arrIndexLabeler.h
1 #include <featureTests.h>
2 #ifdef ROSE_ENABLE_SOURCE_ANALYSIS
3 
4 #ifndef ARR_INDEX_LABELER_H
5 #define ARR_INDEX_LABELER_H
6 
7 #include <sage3.h>
8 #include <list>
9 
10 namespace arrIndexLabeler {
11 
12 // labels the portion of the AST rooted at root with annotations that identify the various portions
13 // the read/write sides of SgAssignOp nodes (if they are)
14 void addArrayIndexAnnotations(SgNode* root);
15 
16 // returns true if the given node is part of an array index expression and false otherwise
17 bool isArrayIndex(SgNode* n);
18 
19 // returns true the given SgPntrArrRefExp node this is a top-level SgPntrArrRefExp that is not part
20 // of a larger SgPntrArrRefExp
21 // (i.e. given a[b[i][j]][k][l], it is either a[b[i][j]][k][l] or b[i][j])
22 bool isTopArrayRefExp(const SgNode* n);
23 
24 // returns the SgExpression node that contains the name of the array in the given SgPntrArrRefExp or
25 // NULL if the node is not a SgPntrArrRefExp
26 SgExpression* getArrayNameExp(SgNode* n);
27 
28 // returns the dimensionality of the array reference in the given SgPntrArrRefExp
29 int getArrayDim(SgPntrArrRefExp* n);
30 
31 // returns the list of index expressionf in the given SgPntrArrRefExp
32  std::list<SgExpression*>& getArrayIndexExprs(SgPntrArrRefExp* n);
33 }
34 #endif
35 #endif
This class represents the notion of an expression. Expressions are derived from SgLocatedNodes, since similar to statement, expressions have a concrete location within the user's source code.
This class represents the base class for all IR nodes within Sage III.
Definition: Cxx_Grammar.h:9555