[clang] [CIR] Initial support for sanitizer attributes (PR #220625)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 3 05:56:34 PDT 2026


================
@@ -144,6 +144,15 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &mlirContext,
   theModule->setAttr(cir::CIRDialect::getIntTypeWidthAttrName(),
                      builder.getI32IntegerAttr(target.getIntWidth()));
 
+  llvm::SmallVector<cir::SanitizeKind> sanitizerKinds;
+  if (getLangOpts().Sanitize.has(SanitizerKind::Address))
----------------
erichkeane wrote:

yeah, this definitely needs a `getSanitizerAttr` type function that takes the SanitizerMask and converts it.

ONE thing we might try to do is put the options in the same order as Clang's SanitizerMask so that we can do this with a static-cast.  I did that for a different attribute (along with the full set of static_asserts to make sure they stay in sync), and I think that would be sensible here.

https://github.com/llvm/llvm-project/pull/220625


More information about the cfe-commits mailing list