Skip to content

Commit bdd02c8

Browse files
authored
Merge pull request #11757 from swiftlang/objc-property-fixes-to-21.x
2 parents 6466fd2 + 5db3ca6 commit bdd02c8

File tree

16 files changed

+389
-104
lines changed

16 files changed

+389
-104
lines changed

clang/test/DebugInfo/ObjC/property-2.m

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
2+
3+
// CHECK-NOT: setter
4+
// CHECK-NOT: getter
5+
6+
@interface I1
7+
@property int p1;
8+
@end
9+
10+
@implementation I1
11+
@end
12+
13+
void foo(I1 *ptr) {}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Checks basic debug-info generation for property. Makes sure we
2+
// create a DIObjCProperty for the synthesized property.
3+
4+
// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
5+
6+
// CHECK: !DIObjCProperty(name: "p1"
7+
// CHECK-SAME: attributes: 2316
8+
// CHECK-SAME: type: ![[P1_TYPE:[0-9]+]]
9+
//
10+
// CHECK: ![[P1_TYPE]] = !DIBasicType(name: "int"
11+
12+
@interface I1 {
13+
int p1;
14+
}
15+
@property int p1;
16+
@end
17+
18+
@implementation I1
19+
@synthesize p1;
20+
@end
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
2+
3+
// CHECK: !DIObjCProperty(name: "baseInt"
4+
// CHECK-SAME: setter: "mySetBaseInt:"
5+
// CHECK-SAME: getter: "myGetBaseInt"
6+
// CHECK-SAME: attributes: 2446
7+
// CHECK-SAME: type: ![[P1_TYPE:[0-9]+]]
8+
//
9+
// CHECK: ![[P1_TYPE]] = !DIBasicType(name: "int"
10+
11+
@interface BaseClass2
12+
{
13+
int _baseInt;
14+
}
15+
- (int) myGetBaseInt;
16+
- (void) mySetBaseInt: (int) in_int;
17+
@property(getter=myGetBaseInt,setter=mySetBaseInt:) int baseInt;
18+
@end
19+
20+
@implementation BaseClass2
21+
22+
- (int) myGetBaseInt
23+
{
24+
return _baseInt;
25+
}
26+
27+
- (void) mySetBaseInt: (int) in_int
28+
{
29+
_baseInt = 2 * in_int;
30+
}
31+
@end
32+
33+
34+
void foo(BaseClass2 *ptr) {}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
2+
3+
// CHECK: ![[BASE_PROP:[0-9]+]] = !DIObjCProperty(name: "base"
4+
// CHECK-SAME: attributes: 2316
5+
// CHECK-SAME: type: ![[P1_TYPE:[0-9]+]]
6+
//
7+
// CHECK: ![[P1_TYPE]] = !DIBasicType(name: "int"
8+
//
9+
// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "_customIvar"
10+
// CHECK-SAME: extraData: ![[BASE_PROP]]
11+
12+
@interface C {
13+
int _customIvar;
14+
}
15+
@property int base;
16+
@end
17+
18+
@implementation C
19+
@synthesize base = _customIvar;
20+
@end
21+
22+
void foo(C *cptr) {}

clang/test/DebugInfo/ObjC/property.m

Lines changed: 0 additions & 15 deletions
This file was deleted.

clang/test/DebugInfo/ObjC/property2.m

Lines changed: 0 additions & 15 deletions
This file was deleted.

clang/test/DebugInfo/ObjC/property4.m

Lines changed: 0 additions & 18 deletions
This file was deleted.

clang/test/DebugInfo/ObjC/property5.m

Lines changed: 0 additions & 33 deletions
This file was deleted.

llvm/lib/AsmParser/LLParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6257,8 +6257,8 @@ bool LLParser::parseDIObjCProperty(MDNode *&Result, bool IsDistinct) {
62576257
#undef VISIT_MD_FIELDS
62586258

62596259
Result = GET_OR_DISTINCT(DIObjCProperty,
6260-
(Context, name.Val, file.Val, line.Val, setter.Val,
6261-
getter.Val, attributes.Val, type.Val));
6260+
(Context, name.Val, file.Val, line.Val, getter.Val,
6261+
setter.Val, attributes.Val, type.Val));
62626262
return false;
62636263
}
62646264

0 commit comments

Comments
 (0)