[llvm-branch-commits] [clang] [Clang] Add __builtin_allow_sanitize_check() (PR #172030)

Marco Elver via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Dec 17 11:51:03 PST 2025


================
@@ -3549,6 +3549,38 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
         llvm::MetadataAsValue::get(Ctx, llvm::MDString::get(Ctx, Kind)));
     return RValue::get(Allow);
   }
+  case Builtin::BI__builtin_allow_sanitize_check: {
+    Intrinsic::ID IntrID = Intrinsic::not_intrinsic;
+    StringRef SanitizerName =
+        cast<StringLiteral>(E->getArg(0)->IgnoreParenCasts())->getString();
+
+    if (SanitizerName == "address" || SanitizerName == "kernel-address") {
----------------
melver wrote:

I checked, and we appear to allow that for no_sanitize deliberately as well (and in the kernel code we actually use `no_sanitize("address")` and not `no_sanitize("kernel-address")`).

For consistency, I think we have to allow the interchangeable behaviour. I added a comment above to refer to the no_sanitize attribute.

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


More information about the llvm-branch-commits mailing list