[clang-format] Allow configuring list of macros that map to attributes
This adds a `AttributeMacros` configuration option that causes certain identifiers to be parsed like a __attribute__((foo)) annotation. This is motivated by our CHERI C/C++ fork which adds a __capability qualifier for pointer/reference. Without this change clang-format parses many type declarations as multiplications/bitwise-and instead. I initially considered adding "__capability" as a new clang-format keyword, but having a list of macros that should be treated as attributes is more flexible since it can be used e.g. for static analyzer annotations or other language extensions. Example: std::vector<foo * __capability> -> std::vector<foo *__capability> Depends on D86775 (to apply cleanly) Reviewed By: MyDeveloperDay, jrtc27 Differential Revision: https://reviews.llvm.org/D86782
Loading
Please sign in to comment