Index: lib/CodeGen/CGBlocks.cpp =================================================================== --- lib/CodeGen/CGBlocks.cpp +++ lib/CodeGen/CGBlocks.cpp @@ -784,7 +784,9 @@ 8); // Using the computed layout, generate the actual block function. bool isLambdaConv = blockInfo.getBlockDecl()->isConversionFromLambda(); - auto *InvokeFn = CodeGenFunction(CGM, true).GenerateBlockFunction( + CodeGenFunction BlockCGF{CGM, true}; + BlockCGF.SanOpts = SanOpts; + auto *InvokeFn = BlockCGF.GenerateBlockFunction( CurGD, blockInfo, LocalDeclMap, isLambdaConv, blockInfo.CanBeGlobal); if (InvokeF) *InvokeF = InvokeFn; Index: test/CodeGenObjC/no-sanitize.m =================================================================== --- test/CodeGenObjC/no-sanitize.m +++ test/CodeGenObjC/no-sanitize.m @@ -1,8 +1,9 @@ -// RUN: %clang_cc1 %s -emit-llvm -fsanitize=address -o - | FileCheck %s +// RUN: %clang_cc1 %s -emit-llvm -fsanitize=address -fblocks -o - | FileCheck %s @interface I0 @end @implementation I0 // CHECK-NOT: sanitize_address - (void) im0: (int) a0 __attribute__((no_sanitize("address"))) { + int (^blockName)() = ^int() { return 0; }; } @end