clang has generic "annotate" attribute with arbitrary string as value. And you can stick it on variables/functions/arguments/structures/members and it will be available in AST tree.
1
2
3
4
5
6
7
8
9
10
11
12 | __attribute__((annotate("function")))
void f(
int arg0 __attribute__((annotate("arg0")))
)
{
}
struct __attribute__((annotate("struct"))) S
S
{
int x __attribute__((annotate("struct member")));
};
|
For simpler syntax you can create macro for it.