<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 10, 2014 at 8:51 AM, Frederic Riss <span dir="ltr"><<a href="mailto:friss@apple.com" target="_blank">friss@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: friss<br>
Date: Fri Oct 10 10:51:10 2014<br>
New Revision: 219507<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=219507&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=219507&view=rev</a><br>
Log:<br>
[dwarfdump] Prettyprint DW_AT_APPLE_property_attribute bitfield values.<br>
<br>
This change depends on the ApplePropertyString helper that I sent spearately.<br>
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?<br></blockquote><div><br></div><div>^ probably worth updating the commit message before committing when it contains comments more intended for review rather than for the commit itself. (just for next time)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Reviewers: dblaikie, samsonov<br>
<br>
Subscribers: llvm-commits<br></blockquote><div><br></div><div>I usually at least drop the "Subscribers" line from the commit message too. Sometimes even the Reviewers, since someone can consult the review thread for that context. (but sometimes it's nice/useful to note the reviewers)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Differential Revision: <a href="http://reviews.llvm.org/D5689" target="_blank">http://reviews.llvm.org/D5689</a><br>
<br>
Added:<br>
    llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.m<br>
    llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.x86_64.o<br>
    llvm/trunk/test/DebugInfo/dwarfdump-objc.test<br>
Modified:<br>
    llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp<br>
<br>
Modified: llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp?rev=219507&r1=219506&r2=219507&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp?rev=219507&r1=219506&r2=219507&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp (original)<br>
+++ llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp Fri Oct 10 10:51:10 2014<br>
@@ -12,6 +12,7 @@<br>
 #include "DWARFContext.h"<br>
 #include "DWARFDebugAbbrev.h"<br>
 #include "llvm/DebugInfo/DWARFFormValue.h"<br>
+#include "llvm/Support/DataTypes.h"<br>
 #include "llvm/Support/Debug.h"<br>
 #include "llvm/Support/Dwarf.h"<br>
 #include "llvm/Support/Format.h"<br>
@@ -72,6 +73,21 @@ void DWARFDebugInfoEntryMinimal::dump(ra<br>
   }<br>
 }<br>
<br>
+static void dumpApplePropertyAttribute(raw_ostream &OS, uint64_t Val) {<br>
+  OS << " (";<br>
+  do {<br>
+    uint64_t Bit = 1ULL << countTrailingZeros(Val);<br>
+    if (const char *PropName = ApplePropertyString(Bit))<br>
+      OS << PropName;<br>
+    else<br>
+      OS << format("DW_APPLE_PROPERTY_0x%" PRIx64, Bit);<br>
+    if (!(Val ^= Bit))<br>
+      break;<br>
+    OS << ", ";<br>
+  } while (true);<br>
+  OS << ")";<br>
+}<br>
+<br>
 void DWARFDebugInfoEntryMinimal::dumpAttribute(raw_ostream &OS,<br>
                                                DWARFUnit *u,<br>
                                                uint32_t *offset_ptr,<br>
@@ -130,6 +146,9 @@ void DWARFDebugInfoEntryMinimal::dumpAtt<br>
     if (const DWARFUnit *RefU = findUnitAndExtractFast(DIE, u, &Ref))<br>
       if (const char *Ref = DIE.getName(RefU, DINameKind::LinkageName))<br>
         OS << " \"" << Ref << '\"';<br>
+  } else if (attr == DW_AT_APPLE_property_attribute) {<br>
+    if (Optional<uint64_t> OptVal = formValue.getAsUnsignedConstant())<br>
+      dumpApplePropertyAttribute(OS, *OptVal);<br>
   }<br>
<br>
   OS << ")\n";<br>
<br>
Added: llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.m<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.m?rev=219507&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.m?rev=219507&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.m (added)<br>
+++ llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.m Fri Oct 10 10:51:10 2014<br>
@@ -0,0 +1,16 @@<br>
+// Compile with clang -g dwarfdump-objc.m -c -Wno-objc-root-class<br>
+<br>
+@interface NSObject {} @end<br>
+<br>
+<br>
+@interface TestInterface<br>
+@property (readonly) int ReadOnly;<br>
+@property (assign) int Assign;<br>
+@property (readwrite) int ReadWrite;<br>
+@property (retain) NSObject *Retain;<br>
+@property (copy) NSObject *Copy;<br>
+@property (nonatomic) int NonAtomic;<br>
+@end<br>
+<br>
+@implementation TestInterface<br>
+@end<br>
<br>
Added: llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.x86_64.o<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.x86_64.o?rev=219507&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.x86_64.o?rev=219507&view=auto</a><br>
==============================================================================<br>
Binary files llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.x86_64.o (added) and llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.x86_64.o Fri Oct 10 10:51:10 2014 differ<br>
<br>
Added: llvm/trunk/test/DebugInfo/dwarfdump-objc.test<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-objc.test?rev=219507&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-objc.test?rev=219507&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/DebugInfo/dwarfdump-objc.test (added)<br>
+++ llvm/trunk/test/DebugInfo/dwarfdump-objc.test Fri Oct 10 10:51:10 2014<br>
@@ -0,0 +1,40 @@<br>
+RUN: llvm-dwarfdump %p/Inputs/dwarfdump-objc.x86_64.o | FileCheck %s<br>
+<br>
+CHECK:      .debug_info contents:<br>
+<br>
+CHECK: DW_TAG_APPLE_property<br>
+CHECK-NOT: TAG<br>
+CHECK:    DW_AT_APPLE_property_name {{.*}} "ReadOnly"<br>
+CHECK-NOT: TAG<br>
+CHECK:    DW_AT_APPLE_property_attribute {{.*}} (0x01 (DW_APPLE_PROPERTY_readonly))<br>
+<br>
+CHECK: DW_TAG_APPLE_property<br>
+CHECK-NOT: TAG<br>
+CHECK:   DW_AT_APPLE_property_name {{.*}} "Assign"<br>
+CHECK-NOT: TAG<br>
+CHECK:   DW_AT_APPLE_property_attribute {{.*}} (0x0c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite))<br>
+<br>
+CHECK: DW_TAG_APPLE_property<br>
+CHECK-NOT: TAG<br>
+CHECK:   DW_AT_APPLE_property_name {{.*}} "ReadWrite"<br>
+CHECK-NOT: TAG<br>
+CHECK:   DW_AT_APPLE_property_attribute {{.*}} (0x0c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite))<br>
+<br>
+CHECK: DW_TAG_APPLE_property<br>
+CHECK-NOT: TAG<br>
+CHECK:   DW_AT_APPLE_property_name {{.*}} "Retain"<br>
+CHECK-NOT: TAG<br>
+CHECK:   DW_AT_APPLE_property_attribute {{.*}} (0x18 (DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_retain))<br>
+<br>
+CHECK: DW_TAG_APPLE_property<br>
+CHECK-NOT: TAG<br>
+CHECK:   DW_AT_APPLE_property_name {{.*}} "Copy"<br>
+CHECK-NOT: TAG<br>
+CHECK:   DW_AT_APPLE_property_attribute {{.*}} (0x28 (DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_copy))<br>
+<br>
+CHECK: DW_TAG_APPLE_property<br>
+CHECK-NOT: TAG<br>
+CHECK:   DW_AT_APPLE_property_name {{.*}} "NonAtomic"<br>
+CHECK-NOT: TAG<br>
+CHECK:   DW_AT_APPLE_property_attribute {{.*}} (0x4c (DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite, DW_APPLE_PROPERTY_nonatomic))<br>
+<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>