[cfe-dev] How to find the type used as index of an VarDecl (enum type - got int)
Jan Smets via cfe-dev
cfe-dev at lists.llvm.org
Fri Oct 28 04:19:31 PDT 2016
Hi
I have an AST checker that visits VarDecl. (Checker<check::ASTDecl<VarDecl>>)
Given this code snippet,
typedef struct table {
char *name;
} tableType;
tableType InfoTbl = { "Table Info" };
tableType SystemTbl = { "Table System" };
typedef enum {
Min = 0,
Info = 0,
A,
System,
B,C,D,E,
Max,
} eType;
tableType *Tbl[Max] = {
[Info] = &InfoTbl, // 0
[System] = &SystemTbl, // 2
};
I would be interested in finding:
a) the type used for dimensioning of the array. Which is the EnumDecl
'eType'. (all I can find is 'int')
b) for each element of the initializer, the name of the
EnumConstantDecl used as index, that is "Info", "System".
(b) can be easily found when one has (a), but I have no idea how to get to (a).
It seems as if this information is not available any more in Clang,
and that is was simply 'resolved' to an int.
Can someone please point me in the right direction?
Thank you.
Jan
--
Smets Jan
jan at smets.cx
More information about the cfe-dev
mailing list