How to associate metadata with a class that can be picked up in an AST parser?

I was hoping to be able to use custom attributes in my source code and be able to see them in the AST, but even though there are some mentions on the internet saying this can work, it doesn’t seem to.

If I say

class [[random_attribute]] Foo {};

I see nothing in -ast-dump, but if I change it to [[deprecated]], it shows up.

Assuming this isn’t possible, is there another approach with similar behavior that I can use in a clang plugin to see that I’m “interested” in a class which doesn’t otherwise change its behavior (or require me to modify and recompile clang)?

Thank you.


That said, I did manage to get a plugin working that prints out all the class names it sees. After fighting with a lot of boilerplate, the actual logic part is pretty nice with matchers!