From: Adrian Prantl Date: Thu, 14 Jul 2016 00:41:18 +0000 (+0000) Subject: Synchronize LLVM and clang's ObjCDeclSpec::ObjCPropertyAttributeKind. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0418ef2691110903254f98214a869ddd682a31e7;p=platform%2Fupstream%2Fllvm.git 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. llvm-svn: 275354 --- diff --git a/llvm/docs/SourceLevelDebugging.rst b/llvm/docs/SourceLevelDebugging.rst index fb70745..1815ee3 100644 --- a/llvm/docs/SourceLevelDebugging.rst +++ b/llvm/docs/SourceLevelDebugging.rst @@ -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 ----------------------- diff --git a/llvm/include/llvm/Support/Dwarf.h b/llvm/include/llvm/Support/Dwarf.h index 79731ae..86b1967 100644 --- a/llvm/include/llvm/Support/Dwarf.h +++ b/llvm/include/llvm/Support/Dwarf.h @@ -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 diff --git a/llvm/lib/Support/Dwarf.cpp b/llvm/lib/Support/Dwarf.cpp index 230a3da..7aea05d 100644 --- a/llvm/lib/Support/Dwarf.cpp +++ b/llvm/lib/Support/Dwarf.cpp @@ -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; } diff --git a/llvm/test/DebugInfo/Inputs/dwarfdump-objc.m b/llvm/test/DebugInfo/Inputs/dwarfdump-objc.m index 54fbee2..805384c 100644 --- a/llvm/test/DebugInfo/Inputs/dwarfdump-objc.m +++ b/llvm/test/DebugInfo/Inputs/dwarfdump-objc.m @@ -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 diff --git a/llvm/test/DebugInfo/Inputs/dwarfdump-objc.x86_64.o b/llvm/test/DebugInfo/Inputs/dwarfdump-objc.x86_64.o index 6b55d38..8c0dcd5 100644 Binary files a/llvm/test/DebugInfo/Inputs/dwarfdump-objc.x86_64.o and b/llvm/test/DebugInfo/Inputs/dwarfdump-objc.x86_64.o differ diff --git a/llvm/test/DebugInfo/dwarfdump-accel.test b/llvm/test/DebugInfo/dwarfdump-accel.test index 7c18388..c6a971a 100644 --- a/llvm/test/DebugInfo/dwarfdump-accel.test +++ b/llvm/test/DebugInfo/dwarfdump-accel.test @@ -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 the accelerators point to the right DIEs. +CHECK: Name:{{.*}}"-[TestInterface ReadOnly]" +CHECK-NOT: Name +CHECK: {Atom[0]: [[READONLY]]} + Check that empty buckets are handled correctly. -CHECK: Bucket[2] -CHECK: EMPTY CHECK: Bucket[3] +CHECK: EMPTY +CHECK: Bucket[4] Check that the accelerators point to the right DIEs. -CHECK: Name:{{.*}}"-[TestInterface ReadOnly]" +CHECK: Name:{{.*}}"-[TestInterface Assign]" CHECK-NOT: Name -CHECK: {Atom[0]: [[READONLY]]} +CHECK: {Atom[0]: [[ASSIGN]]} CHECK: Name:{{.*}}"-[TestInterface setAssign:]" CHECK-NOT: Name CHECK: {Atom[0]: [[SETASSIGN]]} -CHECK: Name:{{.*}}"-[TestInterface Assign]" -CHECK-NOT: Name -CHECK: {Atom[0]: [[ASSIGN]]} 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 diff --git a/llvm/test/DebugInfo/dwarfdump-objc.test b/llvm/test/DebugInfo/dwarfdump-objc.test index 6890c3a..60d0d2f 100644 --- a/llvm/test/DebugInfo/dwarfdump-objc.test +++ b/llvm/test/DebugInfo/dwarfdump-objc.test @@ -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))