r186553 - Don't generate bogus line table entries for __copy_helper_block_ and

Eric Christopher echristo at gmail.com
Wed Jul 17 17:35:44 PDT 2013


Without looking too hard on my end I think this is something we might
want to use in EmitFunctionStart if we don't have a valid loc for the
function?

-eric

On Wed, Jul 17, 2013 at 5:28 PM, Adrian Prantl <aprantl at apple.com> wrote:
> Author: adrian
> Date: Wed Jul 17 19:28:05 2013
> New Revision: 186553
>
> URL: http://llvm.org/viewvc/llvm-project?rev=186553&view=rev
> Log:
> Don't generate bogus line table entries for __copy_helper_block_ and
> __destroy_helper_block_, but do generate scope information.
>
> Modified:
>     cfe/trunk/lib/CodeGen/CGBlocks.cpp
>     cfe/trunk/test/CodeGenObjC/debug-info-blocks.m
>
> Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=186553&r1=186552&r2=186553&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Wed Jul 17 19:28:05 2013
> @@ -1314,6 +1314,8 @@ CodeGenFunction::GenerateCopyHelperFunct
>                                            false,
>                                            false);
>    StartFunction(FD, C.VoidTy, Fn, FI, args, SourceLocation());
> +  // Don't emit any line table entries for the body of this function.
> +  BuiltinLocation BL(*this, Builder);
>
>    llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo();
>
> @@ -1487,6 +1489,8 @@ CodeGenFunction::GenerateDestroyHelperFu
>                                            SC_Static,
>                                            false, false);
>    StartFunction(FD, C.VoidTy, Fn, FI, args, SourceLocation());
> +  // Don't emit any line table entries for the body of this function.
> +  BuiltinLocation BL(*this, Builder);
>
>    llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo();
>
>
> Modified: cfe/trunk/test/CodeGenObjC/debug-info-blocks.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info-blocks.m?rev=186553&r1=186552&r2=186553&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGenObjC/debug-info-blocks.m (original)
> +++ cfe/trunk/test/CodeGenObjC/debug-info-blocks.m Wed Jul 17 19:28:05 2013
> @@ -2,16 +2,28 @@
>
>  // rdar://problem/9279956
>  // Test that we generate the proper debug location for a captured self.
> -// The second half of this patch is in llvm/tests/DebugInfo/debug-info-blocks.ll
> +// The second half of this test is in llvm/tests/DebugInfo/debug-info-blocks.ll
>
>  // CHECK: define {{.*}}_block_invoke
>  // CHECK: %[[BLOCK:.*]] = bitcast i8* %.block_descriptor to <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>*, !dbg
>  // CHECK-NEXT: store <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %[[BLOCK]], <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>** %[[ALLOCA:.*]], align
>  // CHECK-NEXT: call void @llvm.dbg.declare(metadata !{<{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>** %[[ALLOCA]]}, metadata ![[SELF:[0-9]+]])
>  // CHECK-NEXT: call void @llvm.dbg.declare(metadata !{%1** %d}, metadata ![[D:[0-9]+]])
> -// CHECK: ![[SELF]] = {{.*}} [ DW_TAG_auto_variable ] [self] [line 51]
> -// CHECK: ![[D]] = {{.*}} [d] [line 49]
>
> +// rdar://problem/14386148
> +// Test that we don't emit bogus line numbers for the helper functions.
> +// Test that we do emit scope info for the helper functions.
> +// CHECK: define {{.*}} @__copy_helper_block_{{.*}}(i8*, i8*)
> +// CHECK-NOT: ret
> +// CHECK: load {{.*}}, !dbg ![[COPY_LINE:[0-9]+]]
> +// CHECK: define {{.*}} @__destroy_helper_block_{{.*}}(i8*)
> +// CHECK-NOT: ret
> +// CHECK: load {{.*}}, !dbg ![[DESTROY_LINE:[0-9]+]]
> +
> +// CHECK-DAG: [[COPY_LINE]] = metadata !{i32 0, i32 0, metadata ![[COPY_SP:[0-9]+]], null}
> +// CHECK-DAG: [[COPY_SP]] = {{.*}}[ DW_TAG_subprogram ]{{.*}}[__copy_helper_block_]
> +// CHECK-DAG: [[DESTROY_LINE]] = metadata !{i32 0, i32 0, metadata ![[DESTROY_SP:[0-9]+]], null}
> +// CHECK-DAG: [[DESTROY_SP]] = {{.*}}[ DW_TAG_subprogram ]{{.*}}[__destroy_helper_block_]
>  typedef unsigned int NSUInteger;
>
>  @protocol NSObject
> @@ -46,6 +58,8 @@ static void run(void (^block)(void))
>  {
>      if ((self = [super init])) {
>        run(^{
> +          // CHECK-DAG: ![[SELF]] = {{.*}} [ DW_TAG_auto_variable ] [self] [line [[@LINE+4]]]
> +          // CHECK-DAG: ![[D]] = {{.*}} [d] [line [[@LINE+1]]]
>            NSMutableDictionary *d = [[NSMutableDictionary alloc] init];
>            ivar = 42 + (int)[d count];
>          });
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list