Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Debug Info: Nest Objective-C property function decls inside their con…
…tainer. This has the nice side-effect of also fixing a crash in Clang. Starting with DWARF 5 we are emitting ObjC method declarations as children of their containing entity. This worked for interfaces, but didn't consider the case of synthessized properties. When a property of a protocol is synthesized in an interface implementation the ObjCMethodDecl that was passed to CGF::StartFunction was the property *declaration* which obviously couldn't have a containing interface. This patch passes the containing interface all the way through to CGDebugInfo, so the function declaration can be created with the correct parent (= the class implementing the protocol). rdar://problem/53782400 Differential Revision: https://reviews.llvm.org/D66121 (cherry picked from commit 901cc4a)
- Loading branch information
1 parent
ef6f270
commit ff9842c
Showing
3 changed files
with
82 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -dwarf-version=5 %s -o - | FileCheck %s | ||
|
||
@protocol NSObject | ||
@end | ||
|
||
@interface NSObject <NSObject> {} | ||
@end | ||
|
||
struct Bar {}; | ||
|
||
@protocol BarProto | ||
@property struct Bar *bar; | ||
@end | ||
|
||
@interface Foo <BarProto> | ||
@end | ||
|
||
@implementation Foo {} | ||
@synthesize bar = _bar; | ||
- (void)f {} | ||
@end | ||
|
||
// CHECK: ![[FOO:[0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Foo" | ||
|
||
// CHECK: ![[DECL:[0-9]+]] = !DISubprogram(name: "-[Foo setBar:]", | ||
// CHECK-SAME: scope: ![[FOO]] | ||
|
||
// CHECK: distinct !DISubprogram(name: "-[Foo setBar:]", | ||
// CHECK-SAME: declaration: ![[DECL:[0-9]+]] |