[clang] [Clang] Add the `annotate_decl` attribute. (PR #122431)
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 10 02:10:33 PST 2025
================
@@ -8146,14 +8146,45 @@ and copied back to the argument after the callee returns.
}];
}
+def AnnotateDeclDocs : Documentation {
+ let Category = DocCatType;
+ let Heading = "annotate_decl";
+ let Content = [{
+This attribute is used to add annotations to declarations, typically for use by
+static analysis tools that are not integrated into the core Clang compiler
+(e.g., Clang-Tidy checks or out-of-tree Clang-based tools). See also the
+`annotate_type` attribute, which serves the same purpose, but for types.
+
+The attribute takes a mandatory string literal argument specifying the
+annotation category and an arbitrary number of optional arguments that provide
+additional information specific to the annotation category. The optional
+arguments must be constant expressions of arbitrary type.
----------------
zmodem wrote:
Are there any special semantics for the "category" argument? Otherwise it sounds like this could be simplified to say that the attribute takes at least one argument, the first of which needs to be a string literal.
https://github.com/llvm/llvm-project/pull/122431
More information about the cfe-commits
mailing list