================
@@ -522,6 +522,23 @@ void CIRGenFunction::startFunction(GlobalDecl gd, QualType 
returnType,
   const auto *fd = dyn_cast_or_null<FunctionDecl>(d);
   curFuncDecl = (d ? d->getNonClosureContext() : nullptr);
 
+  if (d) {
+    SanitizerMask noSanitizeMask;
+    for (const auto *attr : d->specific_attrs<NoSanitizeAttr>())
+      noSanitizeMask |= attr->getMask();
+    sanOpts.Mask &= ~noSanitizeMask;
+
+    assert(!cir::MissingFeatures::sanitizers());
+  }
+
+  llvm::SmallVector<cir::SanitizeKind> sanitizerKinds;
+  if (sanOpts.has(SanitizerKind::Address))
+    sanitizerKinds.push_back(cir::SanitizeKind::Address);
+  assert(!cir::MissingFeatures::sanitizers());
+  if (!sanitizerKinds.empty())
+    fn.setSanitizeAttr(
+        cir::SanitizeAttr::get(&getMLIRContext(), sanitizerKinds));
----------------
xlauko wrote:

do these need to be per function, cannot we rederive it from what we put on 
module? Or vice versa, does module need to know it since it is nowhere read at 
the moment?

https://github.com/llvm/llvm-project/pull/220625
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to