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
This commit is contained in:
Adrian Prantl 2016-07-14 00:41:18 +00:00
parent 5daf897d80
commit 57df85bcd9
7 changed files with 78 additions and 20 deletions

View File

@ -681,7 +681,13 @@ New DWARF Constants
| DW_APPLE_PROPERTY_strong | 0x400 |
+--------------------------------------+-------+
| DW_APPLE_PROPERTY_unsafe_unretained | 0x800 |
+--------------------------------+-----+-------+
+--------------------------------------+-------+
| DW_APPLE_PROPERTY_nullability | 0x1000|
+--------------------------------------+-------+
| DW_APPLE_PROPERTY_null_resettable | 0x2000|
+--------------------------------------+-------+
| DW_APPLE_PROPERTY_class | 0x4000|
+--------------------------------------+-------+
Name Accelerator Tables
-----------------------

View File

@ -538,7 +538,7 @@ enum LocationListEntry : unsigned char {
DW_LLE_offset_pair_entry
};
/// Contstants for the DW_APPLE_PROPERTY_attributes attribute.
/// Constants for the DW_APPLE_PROPERTY_attributes attribute.
/// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind.
enum ApplePropertyAttributes {
// Apple Objective-C Property Attributes
@ -553,7 +553,10 @@ enum ApplePropertyAttributes {
DW_APPLE_PROPERTY_atomic = 0x100,
DW_APPLE_PROPERTY_weak = 0x200,
DW_APPLE_PROPERTY_strong = 0x400,
DW_APPLE_PROPERTY_unsafe_unretained = 0x800
DW_APPLE_PROPERTY_unsafe_unretained = 0x800,
DW_APPLE_PROPERTY_nullability = 0x1000,
DW_APPLE_PROPERTY_null_resettable = 0x2000,
DW_APPLE_PROPERTY_class = 0x4000
};
// Constants for the DWARF5 Accelerator Table Proposal

View File

@ -545,6 +545,12 @@ const char *llvm::dwarf::ApplePropertyString(unsigned Prop) {
return "DW_APPLE_PROPERTY_strong";
case DW_APPLE_PROPERTY_unsafe_unretained:
return "DW_APPLE_PROPERTY_unsafe_unretained";
case DW_APPLE_PROPERTY_nullability:
return "DW_APPLE_PROPERTY_nullability";
case DW_APPLE_PROPERTY_null_resettable:
return "DW_APPLE_PROPERTY_null_resettable";
case DW_APPLE_PROPERTY_class:
return "DW_APPLE_PROPERTY_class";
}
return nullptr;
}

View File

@ -10,6 +10,12 @@
@property (retain) NSObject *Retain;
@property (copy) NSObject *Copy;
@property (nonatomic) int NonAtomic;
@property (atomic) int Atomic;
@property (strong) NSObject *Strong;
@property (unsafe_unretained) id UnsafeUnretained;
@property (nullable) NSObject *Nullability;
@property (null_resettable) NSObject *NullResettable;
@property (class) int ClassProperty;
@end
@implementation TestInterface

View File

@ -21,28 +21,30 @@ CHECK: .apple_names contents:
CHECK: Magic = 0x48415348
CHECK: Version = 0x0001
CHECK: Hash function = 0x00000000
CHECK: Bucket count = 11
CHECK: Hashes count = 22
CHECK: Bucket count = 21
CHECK: Hashes count = 42
CHECK: HeaderData length = 12
CHECK: DIE offset base = 0
CHECK: Number of atoms = 1
CHECK: Atom[0] Type: DW_ATOM_die_offset Form: DW_FORM_data4
Check that empty buckets are handled correctly.
CHECK: Bucket[2]
CHECK: EMPTY
CHECK: Bucket[3]
Check that the accelerators point to the right DIEs.
CHECK: Name:{{.*}}"-[TestInterface ReadOnly]"
CHECK-NOT: Name
CHECK: {Atom[0]: [[READONLY]]}
CHECK: Name:{{.*}}"-[TestInterface setAssign:]"
CHECK-NOT: Name
CHECK: {Atom[0]: [[SETASSIGN]]}
Check that empty buckets are handled correctly.
CHECK: Bucket[3]
CHECK: EMPTY
CHECK: Bucket[4]
Check that the accelerators point to the right DIEs.
CHECK: Name:{{.*}}"-[TestInterface Assign]"
CHECK-NOT: Name
CHECK: {Atom[0]: [[ASSIGN]]}
CHECK: Name:{{.*}}"-[TestInterface setAssign:]"
CHECK-NOT: Name
CHECK: {Atom[0]: [[SETASSIGN]]}
Check that types are referenced correctly.
CHECK: .apple_types contents:
@ -50,7 +52,7 @@ CHECK: Name{{.*}}"TestInterface"
CHECK-NOT: Name
CHECK: {Atom[0]: [[TESTINTERFACE]]}
Check that an empty ecceleratorsection is handled correctly.
Check that an empty accelerator section is handled correctly.
CHECK: .apple_namespaces contents:
CHECK-NOT: Magic

View File

@ -6,35 +6,70 @@ CHECK: DW_TAG_APPLE_property
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_name {{.*}} "ReadOnly"
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x01 (DW_APPLE_PROPERTY_readonly))
CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x0101 (DW_APPLE_PROPERTY_readonly, DW_APPLE_PROPERTY_atomic))
CHECK: DW_TAG_APPLE_property
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_name {{.*}} "Assign"
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x0c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite))
CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x090c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_atomic, DW_APPLE_PROPERTY_unsafe_unretained))
CHECK: DW_TAG_APPLE_property
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_name {{.*}} "ReadWrite"
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x0c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite))
CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x090c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_atomic, DW_APPLE_PROPERTY_unsafe_unretained))
CHECK: DW_TAG_APPLE_property
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_name {{.*}} "Retain"
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x18 (DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_retain))
CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x0118 (DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_retain, DW_APPLE_PROPERTY_atomic))
CHECK: DW_TAG_APPLE_property
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_name {{.*}} "Copy"
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x28 (DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_copy))
CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x0128 (DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_copy, DW_APPLE_PROPERTY_atomic))
CHECK: DW_TAG_APPLE_property
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_name {{.*}} "NonAtomic"
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x4c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_nonatomic))
CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x084c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_nonatomic, DW_APPLE_PROPERTY_unsafe_unretained))
CHECK: DW_TAG_APPLE_property
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_name {{.*}} "Atomic"
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x090c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_atomic, DW_APPLE_PROPERTY_unsafe_unretained))
CHECK: DW_TAG_APPLE_property
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_name {{.*}} "Strong"
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x0508 (DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_atomic, DW_APPLE_PROPERTY_strong))
CHECK: DW_TAG_APPLE_property
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_name {{.*}} "UnsafeUnretained"
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x090c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_atomic, DW_APPLE_PROPERTY_unsafe_unretained))
CHECK: DW_TAG_APPLE_property
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_name {{.*}} "Nullability"
CHECK-NOT: TAG
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))
CHECK: DW_TAG_APPLE_property
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_name {{.*}} "NullResettable"
CHECK-NOT: TAG
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))
CHECK: DW_TAG_APPLE_property
CHECK-NOT: TAG
CHECK: DW_AT_APPLE_property_name {{.*}} "ClassProperty"
CHECK-NOT: TAG
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))