How can a new keyword be added to clang? The new keyword should be a function qualifier. Where would the declaration part go?
Thanks.
You have to add it to include/clang/Basic/TokenKinds.def, and then add a new case to ParseDeclarationSpecifiers(...).
Probably an easier option would be to define a new attribute, and then use
#define your_new_qualifier __attribute__((your_new_attribute))
Otherwise you'd have to add this qualifier support to the AST, which could be error-prone, whereas attributes are propagated automatically across various declarations of the same function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With