From 29477dc82e9f6e35a91210daa834c59d8216d308 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Fri, 8 Dec 2017 02:47:58 +0000 Subject: [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 --- clang/lib/CodeGen/CGBlocks.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/CGBlocks.cpp') diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index 850681471df..5f73d4cf791 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -784,7 +784,9 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const CGBlockInfo &blockInfo, 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; -- cgit v1.2.3