Hi Nate,
You said something but I feel they are not relevant to “yet without using internal iface/class” directly.
Sent from
Mail for Windows 10
> Question is that how to know a declaration is class/struct/function as detail as possible
> yet without using internal iface/class?
This requires a bit of knowledge about the C++ grammar.
* A class/struct definition will be a simple-declaration with a composite-type-specifier as its decl-specifier, and a declarator with an empty name. (If the declarator has a non-empty name, it's actually declaring a variable of a class/struct type being defined
on the fly).
* A function definition has its own grammar production (not a simple-declaration) and node type (IASTFunctionDefinition).
* A function declaration will be a simple-declaration whose declarator is a function-declarator (IASTFunctionDeclarator).
* A simple-declaration where neither of the above cases apply usually declares a variable, but it could be something else too (e.g. a typedef). You could perform additional syntactic checks to discriminate (e.g. check for presence of typedef specifier), or
resolve the name in the declarator and see what type of binding (e.g. IVariable vs. ITypedef) it resolves to.
Hope that helps,
Nate