How to get custom __declspec using clang API


Recently, I am using clang API using C++ to parse VC in Windows, but I want to add new custom attribute(GUN) or __declspec(MS) for somehow adding new features to C++ in order to do automatic code generation. Are there anything methods(API) or suggestions?‍‍
The following are my test result:

class __declspec(“test”) Test_Class{};

The AST printer result of above code does not contain a clang:Attr, while I look inside the ‘ParseDecl.cpp’, it actually parse the __declspec(“test”) and add it to the AttributeList. How can I get it?‍‍


Unknown attributes are not retained. The declaration parser will
create an AttributeList entry for it, but the semantics engine will
issue an unknown attribute warning and drop the attribute instead of
attaching it to the declaration. We do not currently have a way for
you to retain this information in the AST.