[PATCH] D71042: [DebugInfo] Ensure fallback artificial location is available for cleanups

Adrian Prantl via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 5 12:47:47 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rGce7d35988d1c: Debug Info: Assert that location is available for cleanups (authored by aprantl).
Herald added a project: clang.

Changed prior to commit:
  https://reviews.llvm.org/D71042?vs=232431&id=232435#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71042/new/

https://reviews.llvm.org/D71042

Files:
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/test/CodeGenObjCXX/synthesized-property-cleanup.mm


Index: clang/test/CodeGenObjCXX/synthesized-property-cleanup.mm
===================================================================
--- /dev/null
+++ clang/test/CodeGenObjCXX/synthesized-property-cleanup.mm
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -triple arm64e-apple-ios13.0 -debug-info-kind=standalone -fobjc-arc \
+// RUN:   %s -emit-llvm -o - | FileCheck %s
+
+ at interface NSObject
++ (id)alloc;
+ at end
+
+ at interface NSString : NSObject
+ at end
+
+// CHECK: define {{.*}}@"\01-[MyData setData:]"
+// CHECK: [[DATA:%.*]] = alloca %struct.Data
+// CHECK: call %struct.Data* @_ZN4DataD1Ev(%struct.Data* [[DATA]]){{.*}}, !dbg [[LOC:![0-9]+]]
+// CHECK-NEXT: ret void
+
+// [[LOC]] = !DILocation(line: 0
+
+ at interface MyData : NSObject
+struct Data {
+    NSString *name;
+};
+ at property struct Data data;
+ at end
+ at implementation MyData
+ at end
Index: clang/lib/CodeGen/CodeGenFunction.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenFunction.cpp
+++ clang/lib/CodeGen/CodeGenFunction.cpp
@@ -377,9 +377,12 @@
   if (HasCleanups) {
     // Make sure the line table doesn't jump back into the body for
     // the ret after it's been at EndLoc.
-    if (CGDebugInfo *DI = getDebugInfo())
+    if (CGDebugInfo *DI = getDebugInfo()) {
       if (OnlySimpleReturnStmts)
         DI->EmitLocation(Builder, EndLoc);
+      else
+        assert(EndLoc.isValid() && "no location for inlineable cleanup calls");
+    }
 
     PopCleanupBlocks(PrologueCleanupDepth);
   }
Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp
===================================================================
--- clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -6189,7 +6189,7 @@
   // Emit the finalizer body:
   // <destroy>(<type>* %0)
   RCG.emitCleanups(CGF, N, PrivateAddr);
-  CGF.FinishFunction();
+  CGF.FinishFunction(Loc);
   return Fn;
 }
 
Index: clang/lib/CodeGen/CGObjC.cpp
===================================================================
--- clang/lib/CodeGen/CGObjC.cpp
+++ clang/lib/CodeGen/CGObjC.cpp
@@ -981,7 +981,7 @@
 
   generateObjCGetterBody(IMP, PID, OMD, AtomicHelperFn);
 
-  FinishFunction();
+  FinishFunction(OMD->getEndLoc());
 }
 
 static bool hasTrivialGetExpr(const ObjCPropertyImplDecl *propImpl) {
@@ -1515,7 +1515,7 @@
 
   generateObjCSetterBody(IMP, PID, AtomicHelperFn);
 
-  FinishFunction();
+  FinishFunction(OMD->getEndLoc());
 }
 
 namespace {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71042.232435.patch
Type: text/x-patch
Size: 2436 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191205/56160132/attachment.bin>


More information about the cfe-commits mailing list