systemc-clang 2.0.0
Parsing SystemC constructs
|
Typedefs | |
typedef std::pair< std::string, std::tuple< std::size_t, std::size_t, std::size_t > > | IndexPairType |
typedef std::map< std::string, std::tuple< std::size_t, std::size_t, std::size_t > > | IndexMapType |
typedef std::vector< llvm::APInt > | ArraySizesType |
typedef std::vector< const clang::Expr * > | ArraySizesExprType |
Functions | |
IndexMapType | getArrayInstanceIndex (clang::CXXCtorInitializer *ctor_init) |
ArraySizesType | getConstantArraySizes (const clang::ValueDecl *fd) |
ArraySizesExprType | getArraySubscripts (const clang::Expr *expr) |
const clang::MemberExpr * | getArrayMemberExprName (const clang::Expr *expr) |
typedef std::vector<const clang::Expr *> sc_ast_matchers::utils::array_type::ArraySizesExprType |
Definition at line 31 of file ArrayTypeUtils.h.
typedef std::vector<llvm::APInt> sc_ast_matchers::utils::array_type::ArraySizesType |
Definition at line 30 of file ArrayTypeUtils.h.
typedef std::map<std::string, std::tuple<std::size_t, std::size_t, std::size_t> > sc_ast_matchers::utils::array_type::IndexMapType |
Definition at line 27 of file ArrayTypeUtils.h.
typedef std::pair<std::string, std::tuple<std::size_t, std::size_t, std::size_t> > sc_ast_matchers::utils::array_type::IndexPairType |
Definition at line 25 of file ArrayTypeUtils.h.
IndexMapType sc_ast_matchers::utils::array_type::getArrayInstanceIndex | ( | clang::CXXCtorInitializer * | ctor_init | ) |
Returns the indices associated with each element of an array of objects that is instantiated using a constructor.
For example, class A { public: A( std::string s) {} } A array_a[2][3]{ {"0_0", "0_1", "0_2"}, {"1_0", "1_1", "1_2"}, {"2_0", "2_1", "2_2"} };
This should identify the appropriate index for each instance of object A. That is, array_a[0][1] should be associated with instance named "0_1".
Assumption: We will only support 1D, 2D and 3D arrays.
Retrieve the number of initializer lists.
Level 2
Get the constructor argument.
Level 3
Definition at line 13 of file ArrayTypeUtils.cpp.
const clang::MemberExpr * sc_ast_matchers::utils::array_type::getArrayMemberExprName | ( | const clang::Expr * | expr | ) |
Check if it is an ArraySubscriptExpr
Get access to the MemberExpr name.
Definition at line 217 of file ArrayTypeUtils.cpp.
ArraySizesExprType sc_ast_matchers::utils::array_type::getArraySubscripts | ( | const clang::Expr * | expr | ) |
Returns the array subscripts used in an ArraySubscriptExpr. For example, arr[0][1] would return 0, 1.
Check if it is an ArraySubscriptExpr
The index could be an integer or a variable name a[x]. The integer a[4] is represented as an IntegerLiteral, and the variable name uses a DeclRefExpr.
TODO: Need to insert into subscripts, but it should really be Expr that is the value element. So, change subscripts to hold that, and then use it to hold both IntegerLiteral and DeclRefExpr.
INFO: For some reason, dyn_cast on the ArraySubscriptExpr to get the ImplicitCastExpr does not work. So the way to get to it is to call getBase(), which makes sense that it accesses the nested array instance.
Definition at line 174 of file ArrayTypeUtils.cpp.
ArraySizesType sc_ast_matchers::utils::array_type::getConstantArraySizes | ( | const clang::ValueDecl * | fd | ) |
Returns the sizes of an array that are provided when the array is declared.
For example, AType a[4][5]; Would return 4 and 5 in a vector.
Definition at line 149 of file ArrayTypeUtils.cpp.