forked from OSchip/llvm-project
[Blocks] Inherit sanitizer options from parent decl
There is no way to apply sanitizer suppressions to ObjC blocks. A reasonable default is to have blocks inherit their parent's sanitizer options. rdar://32769634 Differential Revision: https://reviews.llvm.org/D40668 llvm-svn: 320132
This commit is contained in:
parent
1c30924420
commit
29477dc82e
|
@ -784,7 +784,9 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const CGBlockInfo &blockInfo,
|
||||||
8);
|
8);
|
||||||
// Using the computed layout, generate the actual block function.
|
// Using the computed layout, generate the actual block function.
|
||||||
bool isLambdaConv = blockInfo.getBlockDecl()->isConversionFromLambda();
|
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);
|
CurGD, blockInfo, LocalDeclMap, isLambdaConv, blockInfo.CanBeGlobal);
|
||||||
if (InvokeF)
|
if (InvokeF)
|
||||||
*InvokeF = InvokeFn;
|
*InvokeF = InvokeFn;
|
||||||
|
|
|
@ -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
|
@interface I0 @end
|
||||||
@implementation I0
|
@implementation I0
|
||||||
// CHECK-NOT: sanitize_address
|
// CHECK-NOT: sanitize_address
|
||||||
- (void) im0: (int) a0 __attribute__((no_sanitize("address"))) {
|
- (void) im0: (int) a0 __attribute__((no_sanitize("address"))) {
|
||||||
|
int (^blockName)() = ^int() { return 0; };
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in New Issue