[clang] [CIR] Initial support for sanitizer attributes (PR #220625)
Henrich Lauko via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 3 01:53:38 PDT 2026
================
@@ -2136,6 +2136,35 @@ def CIR_AnnotationArrayAttr
: CIR_TypedArrayAttrBase<CIR_AnnotationAttr,
"array of cir.annotation attributes">;
+//===----------------------------------------------------------------------===//
+// SanitizeAttr
+//===----------------------------------------------------------------------===//
+
+def CIR_SanitizeKind : CIR_I32EnumAttr<"SanitizeKind", "sanitize kind", [
+ I32EnumAttrCase<"Address", 0, "address">,
+]> {
+ let genSpecializedAttr = 0;
+}
+
+def CIR_SanitizeAttr : CIR_Attr<"Sanitize", "sanitize"> {
----------------
xlauko wrote:
Why an array of kinds rather than a bit enum? A duplicate-free set of flags is what `I64BitEnumAttr` is for, and modeling it that way would delete most of this patch: the `SanitizeAttr` class, the `genVerifyDecl`/`SanitizeAttr::verify` duplicate check, the `clang/test/CIR/IR/sanitize.cir `test that exists only to exercise it, and format. It would also make the cir.func spelling sanitize(address) via the existing `parseCIRKeyword` helper instead of the less readable `sanitize(#cir.sanitize<[address]>)`.
https://github.com/llvm/llvm-project/pull/220625
More information about the cfe-commits
mailing list