SageInterface::get_C_array_dimensions
returns the array dimensions in an array as defined for arrtype
Synopsis
Declared in <SageIII/sageInterface/sageInterface.h>
std::vector<SgExpression*>
get_C_array_dimensions(
SgArrayType const& arrtype,
SgVarRefExp const& varref);
Description
int x[][3] = { 1, 2, 3, 4, 5, 6 };
the entry for the first dimension will be:
// 3 ... size of 2nd dimension
sizeof(x) / (sizeof(int) * 3)
Return Value
an array that contains an expression indicating each dimension's size. OWNERSHIP of the expressions is TRANSFERED TO the CALLER (which becomes responsible for freeing the expressions). If the first array dimension was not specified an expression that indicates that size is generated.
Parameters
Name |
Description |
arrtype |
the type of a C/C++ array |
varref |
a reference to an array variable (the variable of type arrtype) |
Preconditions
-
arrtype is the array‐type of varref
Postconditions
-
return‐value.empty() == false
-
return‐value[]!= NULL (no nullptr in the returned vector)
-
!isSgNullExpression(return‐value[])
Created with MrDocs