llvm.org GIT mirror llvm / 0f65dfd
[dwarfdump] Prettyprint DW_AT_APPLE_property_attribute bitfield values. This change depends on the ApplePropertyString helper that I sent spearately. Not sure how you want this tested: as a tool test by adding a binary to dump, or as an llvm test starting from an IR file? Reviewers: dblaikie, samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5689 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219507 91177308-0d34-0410-b5e6-96231b3b80d8 Frederic Riss 5 years ago
4 changed file(s) with 75 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
1111 #include "DWARFContext.h"
1212 #include "DWARFDebugAbbrev.h"
1313 #include "llvm/DebugInfo/DWARFFormValue.h"
14 #include "llvm/Support/DataTypes.h"
1415 #include "llvm/Support/Debug.h"
1516 #include "llvm/Support/Dwarf.h"
1617 #include "llvm/Support/Format.h"
6970 OS.indent(indent) << "NULL\n";
7071 }
7172 }
73 }
74
75 static void dumpApplePropertyAttribute(raw_ostream &OS, uint64_t Val) {
76 OS << " (";
77 do {
78 uint64_t Bit = 1ULL << countTrailingZeros(Val);
79 if (const char *PropName = ApplePropertyString(Bit))
80 OS << PropName;
81 else
82 OS << format("DW_APPLE_PROPERTY_0x%" PRIx64, Bit);
83 if (!(Val ^= Bit))
84 break;
85 OS << ", ";
86 } while (true);
87 OS << ")";
7288 }
7389
7490 void DWARFDebugInfoEntryMinimal::dumpAttribute(raw_ostream &OS,
129145 if (const DWARFUnit *RefU = findUnitAndExtractFast(DIE, u, &Ref))
130146 if (const char *Ref = DIE.getName(RefU, DINameKind::LinkageName))
131147 OS << " \"" << Ref << '\"';
148 } else if (attr == DW_AT_APPLE_property_attribute) {
149 if (Optional OptVal = formValue.getAsUnsignedConstant())
150 dumpApplePropertyAttribute(OS, *OptVal);
132151 }
133152
134153 OS << ")\n";
0 // Compile with clang -g dwarfdump-objc.m -c -Wno-objc-root-class
1
2 @interface NSObject {} @end
3
4
5 @interface TestInterface
6 @property (readonly) int ReadOnly;
7 @property (assign) int Assign;
8 @property (readwrite) int ReadWrite;
9 @property (retain) NSObject *Retain;
10 @property (copy) NSObject *Copy;
11 @property (nonatomic) int NonAtomic;
12 @end
13
14 @implementation TestInterface
15 @end
0 RUN: llvm-dwarfdump %p/Inputs/dwarfdump-objc.x86_64.o | FileCheck %s
1
2 CHECK: .debug_info contents:
3
4 CHECK: DW_TAG_APPLE_property
5 CHECK-NOT: TAG
6 CHECK: DW_AT_APPLE_property_name {{.*}} "ReadOnly"
7 CHECK-NOT: TAG
8 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x01 (DW_APPLE_PROPERTY_readonly))
9
10 CHECK: DW_TAG_APPLE_property
11 CHECK-NOT: TAG
12 CHECK: DW_AT_APPLE_property_name {{.*}} "Assign"
13 CHECK-NOT: TAG
14 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x0c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite))
15
16 CHECK: DW_TAG_APPLE_property
17 CHECK-NOT: TAG
18 CHECK: DW_AT_APPLE_property_name {{.*}} "ReadWrite"
19 CHECK-NOT: TAG
20 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x0c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite))
21
22 CHECK: DW_TAG_APPLE_property
23 CHECK-NOT: TAG
24 CHECK: DW_AT_APPLE_property_name {{.*}} "Retain"
25 CHECK-NOT: TAG
26 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x18 (DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_retain))
27
28 CHECK: DW_TAG_APPLE_property
29 CHECK-NOT: TAG
30 CHECK: DW_AT_APPLE_property_name {{.*}} "Copy"
31 CHECK-NOT: TAG
32 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x28 (DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_copy))
33
34 CHECK: DW_TAG_APPLE_property
35 CHECK-NOT: TAG
36 CHECK: DW_AT_APPLE_property_name {{.*}} "NonAtomic"
37 CHECK-NOT: TAG
38 CHECK: DW_AT_APPLE_property_attribute {{.*}} (0x4c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_nonatomic))
39