How could I get the Elements in an array from the AST.
Ex : foo[4] = {3,2} , i want to able to tell that in that array i have a 3 and a 2.
void checkASTDecl(const VarDecl *D, AnalysisManager &Mgr, BugReporter &BR)const
{
const clang::Expr * initializerExpr = D->getInit();
initializerExpr->dump();
if(auto t = dyn_cast_or_null<ConstantArrayType>(D->getType().getTypePtr()))
{
t->getSize().dump(); // This gets me the size of the array
t->getElementType().dump();
}
}
This is the code i have so far from playing around with some of the functions on doxygen