[PATCH] D40668: [Blocks] Inherit sanitizer options from parent decl
This revision was automatically updated to reflect the committed changes. Closed by commit rC320132: [Blocks] Inherit sanitizer options from parent decl (authored by vedantk). Repository: rC Clang https://reviews.llvm.org/D40668 Files: lib/CodeGen/CGBlocks.cpp test/CodeGenObjC/no-sanitize.m 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 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 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D40668: [Blocks] Inherit sanitizer options from parent decl
vsk added a comment. In https://reviews.llvm.org/D40668#949096, @zaks.anna wrote: > LGTM. > > Thanks! > > I was wondering if there are other places where this propagation needs to be > added, for example, other calls to GenerateBlockFunction. Thanks for the review :). Yes there is one other site which calls GenerateBlockFunction, but that is done in CodeGenModule, where there are no SanOpts to inherit *except* those from the CGM, which is already the default behavior. (You can apply suppressions to those by specifying "_block_invoke*" in your blacklist.) So I think this is all that's needed. https://reviews.llvm.org/D40668 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D40668: [Blocks] Inherit sanitizer options from parent decl
zaks.anna accepted this revision. zaks.anna added a comment. This revision is now accepted and ready to land. LGTM. Thanks! I was wondering if there are other places where this propagation needs to be added, for example, other calls to GenerateBlockFunction. https://reviews.llvm.org/D40668 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D40668: [Blocks] Inherit sanitizer options from parent decl
vsk added a comment. Friendly ping. https://reviews.llvm.org/D40668 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D40668: [Blocks] Inherit sanitizer options from parent decl
vsk created this revision. 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 https://reviews.llvm.org/D40668 Files: lib/CodeGen/CGBlocks.cpp test/CodeGenObjC/no-sanitize.m 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 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 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; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits