diff options
| -rw-r--r-- | clang/lib/CodeGen/CGObjC.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGOpenMPRuntime.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 5 | ||||
| -rw-r--r-- | clang/test/CodeGenObjCXX/synthesized-property-cleanup.mm | 25 | 
4 files changed, 32 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index 14391f3b129..6db05391722 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -981,7 +981,7 @@ void CodeGenFunction::GenerateObjCGetter(ObjCImplementationDecl *IMP,    generateObjCGetterBody(IMP, PID, OMD, AtomicHelperFn); -  FinishFunction(); +  FinishFunction(OMD->getEndLoc());  }  static bool hasTrivialGetExpr(const ObjCPropertyImplDecl *propImpl) { @@ -1515,7 +1515,7 @@ void CodeGenFunction::GenerateObjCSetter(ObjCImplementationDecl *IMP,    generateObjCSetterBody(IMP, PID, AtomicHelperFn); -  FinishFunction(); +  FinishFunction(OMD->getEndLoc());  }  namespace { diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 8ce403c8dab..9f1b907e89d 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -6189,7 +6189,7 @@ static llvm::Value *emitReduceFiniFunction(CodeGenModule &CGM,    // Emit the finalizer body:    // <destroy>(<type>* %0)    RCG.emitCleanups(CGF, N, PrivateAddr); -  CGF.FinishFunction(); +  CGF.FinishFunction(Loc);    return Fn;  } diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index fd3020835a4..a25383f6e15 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -377,9 +377,12 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) {    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);    } diff --git a/clang/test/CodeGenObjCXX/synthesized-property-cleanup.mm b/clang/test/CodeGenObjCXX/synthesized-property-cleanup.mm new file mode 100644 index 00000000000..805766b23bd --- /dev/null +++ b/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 + +@interface NSObject ++ (id)alloc; +@end + +@interface NSString : NSObject +@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 + +@interface MyData : NSObject +struct Data { +    NSString *name; +}; +@property struct Data data; +@end +@implementation MyData +@end  | 

