For fix-its that insert [[clang::unsafe_buffer_usage]] attributes, they will lookup existing macros defined for [[clang::unsafe_buffer_usage]] and use the (last defined such) macro directly. Fix-its will use raw [[clang::unsafe_buffer_usage]] if no such macro is defined.
For example,
// Suppose `foo` uses `p` in an unsafe way... void foo(int *p); // A fix-it will insert "[[clang::unsafe_buffer_usage]] " right before the declaration as there is no macro for the attribute defined here #define MACRO [[clang::unsafe_buffer_usage]] void foo(int *p); // A fix-it will insert "MACRO " right before the declaration
The implementation mimics how a similar machine for the [[fallthrough]] attribute was implemented. (Mentioned here https://reviews.llvm.org/D143048#inline-1435398 )
This #include may be avoided since you declare class clang::Sema.