[llvm-branch-commits] [clang] [compiler-rt] clang: also check alloc_align and assume_aligned claims in return (PR #239729)

Reid Kleckner via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Nov 12 20:21:53 PST 2026


================
@@ -4630,6 +4630,29 @@ void CodeGenFunction::EmitReturnValueCheck(llvm::Value *RV) {
   if (ReturnBlock.isValid() && ReturnBlock.getBlock()->use_empty())
     return;
 
+  if (SanOpts.has(SanitizerKind::Alignment)) {
+    if (const AllocAlignAttr *AA = CurCodeDecl->getAttr<AllocAlignAttr>()) {
+      if (isa<FunctionDecl>(CurCodeDecl)) {
----------------
rnk wrote:

Any reason why the alloc_align attribute can't apply to ObjC method decls or Blocks? Those are the non-FunctionDecl code constructs I can remember, but there might a couple others. It's probably easiest to construct a test using C and `-fblocks`, although normally we don't usually bother to test each and every IRGen feature with non-FunctionDecl code constructs.

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


More information about the llvm-branch-commits mailing list