llvm.org GIT mirror llvm / 57df85b
Synchronize LLVM and clang's ObjCDeclSpec::ObjCPropertyAttributeKind. This adds Clang-specific DWARF constants for nullability and ObjC class properties that are already generated by clang. This patch adds dwarfdump support and a more comprehensive testcase. <rdar://problem/27335745> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275354 91177308-0d34-0410-b5e6-96231b3b80d8 Adrian Prantl 3 years ago
7 changed file(s) with 78 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
680680 | DW_APPLE_PROPERTY_strong | 0x400 |
681681 +--------------------------------------+-------+
682682 | DW_APPLE_PROPERTY_unsafe_unretained | 0x800 |
683 +--------------------------------+-----+-------+
683 +--------------------------------------+-------+
684 | DW_APPLE_PROPERTY_nullability | 0x1000|
685 +--------------------------------------+-------+
686 | DW_APPLE_PROPERTY_null_resettable | 0x2000|
687 +--------------------------------------+-------+
688 | DW_APPLE_PROPERTY_class | 0x4000|
689 +--------------------------------------+-------+
684690
685691 Name Accelerator Tables
686692 -----------------------
537537 DW_LLE_offset_pair_entry
538538 };
539539
540 /// Contstants for the DW_APPLE_PROPERTY_attributes attribute.
540 /// Constants for the DW_APPLE_PROPERTY_attributes attribute.
541541 /// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind.
542542 enum ApplePropertyAttributes {
543543 // Apple Objective-C Property Attributes
552552 DW_APPLE_PROPERTY_atomic = 0x100,
553553 DW_APPLE_PROPERTY_weak = 0x200,
554554 DW_APPLE_PROPERTY_strong = 0x400,
555 DW_APPLE_PROPERTY_unsafe_unretained = 0x800
555 DW_APPLE_PROPERTY_unsafe_unretained = 0x800,
556 DW_APPLE_PROPERTY_nullability = 0x1000,
557 DW_APPLE_PROPERTY_null_resettable = 0x2000,
558 DW_APPLE_PROPERTY_class = 0x4000
556559 };
557560
558561 // Constants for the DWARF5 Accelerator Table Proposal
544544 return "DW_APPLE_PROPERTY_strong";
545545 case DW_APPLE_PROPERTY_unsafe_unretained:
546546 return "DW_APPLE_PROPERTY_unsafe_unretained";
547 case DW_APPLE_PROPERTY_nullability:
548 return "DW_APPLE_PROPERTY_nullability";
549 case DW_APPLE_PROPERTY_null_resettable:
550 return "DW_APPLE_PROPERTY_null_resettable";
551 case DW_APPLE_PROPERTY_class:
552 return "DW_APPLE_PROPERTY_class";
547553 }
548554 return nullptr;
549555 }
99 @property (retain) NSObject *Retain;
1010 @property (copy) NSObject *Copy;
1111 @property (nonatomic) int NonAtomic;
12 @property (atomic) int Atomic;
13 @property (strong) NSObject *Strong;
14 @property (unsafe_unretained) id UnsafeUnretained;
15 @property (nullable) NSObject *Nullability;
16 @property (null_resettable) NSObject *NullResettable;
17 @property (class) int ClassProperty;
1218 @end
1319
1420 @implementation TestInterface
2020 CHECK: Magic = 0x48415348
2121 CHECK: Version = 0x0001
2222 CHECK: Hash function = 0x00000000
23 CHECK: Bucket count = 11
24 CHECK: Hashes count = 22
23 CHECK: Bucket count = 21
24 CHECK: Hashes count = 42
2525 CHECK: HeaderData length = 12
2626 CHECK: DIE offset base = 0
2727 CHECK: Number of atoms = 1
2828 CHECK: Atom[0] Type: DW_ATOM_die_offset Form: DW_FORM_data4
2929
30 Check that empty buckets are handled correctly.
31 CHECK: Bucket[2]
32 CHECK: EMPTY
33 CHECK: Bucket[3]
34
3530 Check that the accelerators point to the right DIEs.
3631 CHECK: Name:{{.*}}"-[TestInterface ReadOnly]"
3732 CHECK-NOT: Name
3833 CHECK: {Atom[0]: [[READONLY]]}
34
35 Check that empty buckets are handled correctly.
36 CHECK: Bucket[3]
37 CHECK: EMPTY
38 CHECK: Bucket[4]
39
40 Check that the accelerators point to the right DIEs.
41 CHECK: Name:{{.*}}"-[TestInterface Assign]"
42 CHECK-NOT: Name
43 CHECK: {Atom[0]: [[ASSIGN]]}
3944 CHECK: Name:{{.*}}"-[TestInterface setAssign:]"
4045 CHECK-NOT: Name
4146 CHECK: {Atom[0]: [[SETASSIGN]]}
42 CHECK: Name:{{.*}}"-[TestInterface Assign]"
43 CHECK-NOT: Name
44 CHECK: {Atom[0]: [[ASSIGN]]}
4547
4648 Check that types are referenced correctly.
4749 CHECK: .apple_types contents:
4951 CHECK-NOT: Name
5052 CHECK: {Atom[0]: [[TESTINTERFACE]]}
5153
52 Check that an empty ecceleratorsection is handled correctly.
54 Check that an empty accelerator section is handled correctly.
5355 CHECK: .apple_namespaces contents:
5456 CHECK-NOT: Magic
5557
55 CHECK-NOT: TAG
66 CHECK: DW_AT_APPLE_property_name {{.*}} "ReadOnly"
77 CHECK-NOT: TAG
8 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x01 (DW_APPLE_PROPERTY_readonly))
8 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x0101 (DW_APPLE_PROPERTY_readonly, DW_APPLE_PROPERTY_atomic))
99
1010 CHECK: DW_TAG_APPLE_property
1111 CHECK-NOT: TAG
1212 CHECK: DW_AT_APPLE_property_name {{.*}} "Assign"
1313 CHECK-NOT: TAG
14 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x0c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite))
14 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x090c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_atomic, DW_APPLE_PROPERTY_unsafe_unretained))
1515
1616 CHECK: DW_TAG_APPLE_property
1717 CHECK-NOT: TAG
1818 CHECK: DW_AT_APPLE_property_name {{.*}} "ReadWrite"
1919 CHECK-NOT: TAG
20 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x0c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite))
20 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x090c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_atomic, DW_APPLE_PROPERTY_unsafe_unretained))
2121
2222 CHECK: DW_TAG_APPLE_property
2323 CHECK-NOT: TAG
2424 CHECK: DW_AT_APPLE_property_name {{.*}} "Retain"
2525 CHECK-NOT: TAG
26 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x18 (DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_retain))
26 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x0118 (DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_retain, DW_APPLE_PROPERTY_atomic))
2727
2828 CHECK: DW_TAG_APPLE_property
2929 CHECK-NOT: TAG
3030 CHECK: DW_AT_APPLE_property_name {{.*}} "Copy"
3131 CHECK-NOT: TAG
32 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x28 (DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_copy))
32 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x0128 (DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_copy, DW_APPLE_PROPERTY_atomic))
3333
3434 CHECK: DW_TAG_APPLE_property
3535 CHECK-NOT: TAG
3636 CHECK: DW_AT_APPLE_property_name {{.*}} "NonAtomic"
3737 CHECK-NOT: TAG
38 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x4c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_nonatomic))
38 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x084c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_nonatomic, DW_APPLE_PROPERTY_unsafe_unretained))
3939
40 CHECK: DW_TAG_APPLE_property
41 CHECK-NOT: TAG
42 CHECK: DW_AT_APPLE_property_name {{.*}} "Atomic"
43 CHECK-NOT: TAG
44 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x090c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_atomic, DW_APPLE_PROPERTY_unsafe_unretained))
45
46 CHECK: DW_TAG_APPLE_property
47 CHECK-NOT: TAG
48 CHECK: DW_AT_APPLE_property_name {{.*}} "Strong"
49 CHECK-NOT: TAG
50 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x0508 (DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_atomic, DW_APPLE_PROPERTY_strong))
51
52 CHECK: DW_TAG_APPLE_property
53 CHECK-NOT: TAG
54 CHECK: DW_AT_APPLE_property_name {{.*}} "UnsafeUnretained"
55 CHECK-NOT: TAG
56 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x090c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_atomic, DW_APPLE_PROPERTY_unsafe_unretained))
57
58 CHECK: DW_TAG_APPLE_property
59 CHECK-NOT: TAG
60 CHECK: DW_AT_APPLE_property_name {{.*}} "Nullability"
61 CHECK-NOT: TAG
62 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x190c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_atomic, DW_APPLE_PROPERTY_unsafe_unretained, DW_APPLE_PROPERTY_nullability))
63
64 CHECK: DW_TAG_APPLE_property
65 CHECK-NOT: TAG
66 CHECK: DW_AT_APPLE_property_name {{.*}} "NullResettable"
67 CHECK-NOT: TAG
68 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x390c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_atomic, DW_APPLE_PROPERTY_unsafe_unretained, DW_APPLE_PROPERTY_nullability, DW_APPLE_PROPERTY_null_resettable))
69
70 CHECK: DW_TAG_APPLE_property
71 CHECK-NOT: TAG
72 CHECK: DW_AT_APPLE_property_name {{.*}} "ClassProperty"
73 CHECK-NOT: TAG
74 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x490c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_atomic, DW_APPLE_PROPERTY_unsafe_unretained, DW_APPLE_PROPERTY_class))