aprantl created this revision.
aprantl added reviewers: vsk, shafik.
aprantl added a project: debug-info.
aprantl updated this revision to Diff 248190.
aprantl updated this revision to Diff 248192.

Block copy/destroy helpers are now `linkonce_odr` functions, meant to be 
uniqued, and thus attaching debug information from one translation unit (or 
even just from one instance of many inside one translation unit) would be 
misleading and wrong in the general case.

      

This effectively reverts commit 9c6b6826ce3720ca8bb9bd15f3abf71261e6b911.

      

rdar://problem/59137040


https://reviews.llvm.org/D75615

Files:
  clang/lib/CodeGen/CGBlocks.cpp
  clang/test/CodeGenObjC/debug-info-blocks.m


Index: clang/test/CodeGenObjC/debug-info-blocks.m
===================================================================
--- clang/test/CodeGenObjC/debug-info-blocks.m
+++ clang/test/CodeGenObjC/debug-info-blocks.m
@@ -17,13 +17,15 @@
 // CHECK-NOT: ret
 // CHECK: call {{.*}}, !dbg ![[DBG_LINE:[0-9]+]]
 // CHECK-NOT: ret
-// CHECK: load {{.*}}, !dbg ![[COPY_LINE:[0-9]+]]
-// CHECK: ret void, !dbg ![[COPY_LINE]]
-// CHECK: define {{.*}} @__destroy_helper_block_{{.*}}(i8* %0)
+// CHECK: load {{.*}}, !dbg ![[DBG_LINE]]
+// CHECK: define {{.*}} @__destroy_helper_block_{{.*}}(i8*
 // CHECK-NOT: ret
 // CHECK: load {{.*}}, !dbg ![[DESTROY_LINE:[0-9]+]]
-// CHECK: ret void, !dbg ![[DESTROY_LINE]]
 
+// CHECK-DAG: [[DBG_LINE]] = !DILocation(line: 0, scope: ![[COPY_SP:[0-9]+]])
+// CHECK-DAG: [[COPY_SP]] = distinct !DISubprogram(name: "__copy_helper_block_
+// CHECK-DAG: [[DESTROY_LINE]] = !DILocation(line: 0, scope: 
![[DESTROY_SP:[0-9]+]])
+// CHECK-DAG: [[DESTROY_SP]] = distinct !DISubprogram(name: 
"__destroy_helper_block_
 typedef unsigned int NSUInteger;
 
 @protocol NSObject
@@ -57,11 +59,6 @@
 - (id)init
 {
     if ((self = [super init])) {
-      // CHECK-DAG: [[DBG_LINE]] = !DILocation(line: 0, scope: 
![[COPY_SP:[0-9]+]])
-      // CHECK-DAG: [[COPY_LINE]] = !DILocation(line: [[@LINE+7]], scope: 
![[COPY_SP:[0-9]+]])
-      // CHECK-DAG: [[COPY_SP]] = distinct !DISubprogram(name: 
"__copy_helper_block_8_32o"
-      // CHECK-DAG: [[DESTROY_LINE]] = !DILocation(line: [[@LINE+5]], scope: 
![[DESTROY_SP:[0-9]+]])
-      // CHECK-DAG: [[DESTROY_SP]] = distinct !DISubprogram(name: 
"__destroy_helper_block_8_32o"
       // CHECK-DAG: !DILocalVariable(arg: 1, scope: ![[COPY_SP]], {{.*}}, 
flags: DIFlagArtificial)
       // CHECK-DAG: !DILocalVariable(arg: 2, scope: ![[COPY_SP]], {{.*}}, 
flags: DIFlagArtificial)
       // CHECK-DAG: !DILocalVariable(arg: 1, scope: ![[DESTROY_SP]], {{.*}}, 
flags: DIFlagArtificial)
Index: clang/lib/CodeGen/CGBlocks.cpp
===================================================================
--- clang/lib/CodeGen/CGBlocks.cpp
+++ clang/lib/CodeGen/CGBlocks.cpp
@@ -2036,7 +2036,8 @@
   setBlockHelperAttributesVisibility(blockInfo.CapturesNonExternalType, Fn, FI,
                                      CGM);
   StartFunction(FD, ReturnTy, Fn, FI, args);
-  ApplyDebugLocation NL{*this, blockInfo.getBlockExpr()->getBeginLoc()};
+  auto AL = ApplyDebugLocation::CreateArtificial(*this);
+
   llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo();
 
   Address src = GetAddrOfLocalVar(&SrcDecl);
@@ -2230,7 +2231,7 @@
   StartFunction(FD, ReturnTy, Fn, FI, args);
   markAsIgnoreThreadCheckingAtRuntime(Fn);
 
-  ApplyDebugLocation NL{*this, blockInfo.getBlockExpr()->getBeginLoc()};
+  auto AL = ApplyDebugLocation::CreateArtificial(*this);
 
   llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo();
 


Index: clang/test/CodeGenObjC/debug-info-blocks.m
===================================================================
--- clang/test/CodeGenObjC/debug-info-blocks.m
+++ clang/test/CodeGenObjC/debug-info-blocks.m
@@ -17,13 +17,15 @@
 // CHECK-NOT: ret
 // CHECK: call {{.*}}, !dbg ![[DBG_LINE:[0-9]+]]
 // CHECK-NOT: ret
-// CHECK: load {{.*}}, !dbg ![[COPY_LINE:[0-9]+]]
-// CHECK: ret void, !dbg ![[COPY_LINE]]
-// CHECK: define {{.*}} @__destroy_helper_block_{{.*}}(i8* %0)
+// CHECK: load {{.*}}, !dbg ![[DBG_LINE]]
+// CHECK: define {{.*}} @__destroy_helper_block_{{.*}}(i8*
 // CHECK-NOT: ret
 // CHECK: load {{.*}}, !dbg ![[DESTROY_LINE:[0-9]+]]
-// CHECK: ret void, !dbg ![[DESTROY_LINE]]
 
+// CHECK-DAG: [[DBG_LINE]] = !DILocation(line: 0, scope: ![[COPY_SP:[0-9]+]])
+// CHECK-DAG: [[COPY_SP]] = distinct !DISubprogram(name: "__copy_helper_block_
+// CHECK-DAG: [[DESTROY_LINE]] = !DILocation(line: 0, scope: ![[DESTROY_SP:[0-9]+]])
+// CHECK-DAG: [[DESTROY_SP]] = distinct !DISubprogram(name: "__destroy_helper_block_
 typedef unsigned int NSUInteger;
 
 @protocol NSObject
@@ -57,11 +59,6 @@
 - (id)init
 {
     if ((self = [super init])) {
-      // CHECK-DAG: [[DBG_LINE]] = !DILocation(line: 0, scope: ![[COPY_SP:[0-9]+]])
-      // CHECK-DAG: [[COPY_LINE]] = !DILocation(line: [[@LINE+7]], scope: ![[COPY_SP:[0-9]+]])
-      // CHECK-DAG: [[COPY_SP]] = distinct !DISubprogram(name: "__copy_helper_block_8_32o"
-      // CHECK-DAG: [[DESTROY_LINE]] = !DILocation(line: [[@LINE+5]], scope: ![[DESTROY_SP:[0-9]+]])
-      // CHECK-DAG: [[DESTROY_SP]] = distinct !DISubprogram(name: "__destroy_helper_block_8_32o"
       // CHECK-DAG: !DILocalVariable(arg: 1, scope: ![[COPY_SP]], {{.*}}, flags: DIFlagArtificial)
       // CHECK-DAG: !DILocalVariable(arg: 2, scope: ![[COPY_SP]], {{.*}}, flags: DIFlagArtificial)
       // CHECK-DAG: !DILocalVariable(arg: 1, scope: ![[DESTROY_SP]], {{.*}}, flags: DIFlagArtificial)
Index: clang/lib/CodeGen/CGBlocks.cpp
===================================================================
--- clang/lib/CodeGen/CGBlocks.cpp
+++ clang/lib/CodeGen/CGBlocks.cpp
@@ -2036,7 +2036,8 @@
   setBlockHelperAttributesVisibility(blockInfo.CapturesNonExternalType, Fn, FI,
                                      CGM);
   StartFunction(FD, ReturnTy, Fn, FI, args);
-  ApplyDebugLocation NL{*this, blockInfo.getBlockExpr()->getBeginLoc()};
+  auto AL = ApplyDebugLocation::CreateArtificial(*this);
+
   llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo();
 
   Address src = GetAddrOfLocalVar(&SrcDecl);
@@ -2230,7 +2231,7 @@
   StartFunction(FD, ReturnTy, Fn, FI, args);
   markAsIgnoreThreadCheckingAtRuntime(Fn);
 
-  ApplyDebugLocation NL{*this, blockInfo.getBlockExpr()->getBeginLoc()};
+  auto AL = ApplyDebugLocation::CreateArtificial(*this);
 
   llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo();
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to