[llvm] r219507 - [dwarfdump] Prettyprint DW_AT_APPLE_property_attribute bitfield values.

Manuel Klimek klimek at google.com
Mon Oct 13 01:27:08 PDT 2014


On Fri Oct 10 2014 at 6:51:06 PM David Blaikie <dblaikie at gmail.com> wrote:

> On Fri, Oct 10, 2014 at 9:44 AM, Frédéric Riss <friss at apple.com> wrote:
>
>>
>> On 10 Oct 2014, at 09:32, David Blaikie <dblaikie at gmail.com> wrote:
>>
>>
>>
>> On Fri, Oct 10, 2014 at 8:51 AM, Frederic Riss <friss at apple.com> wrote:
>>
>>> Author: friss
>>> Date: Fri Oct 10 10:51:10 2014
>>> New Revision: 219507
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=219507&view=rev
>>> Log:
>>> [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?
>>>
>>
>> ^ 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)
>>
>>
>> I’ve seen that just after having the ‘git svn dcommit’ finishing… I
>> usually ‘git log HEAD…origin/master’ just before pushing to check that
>> everything’s fine, don’t I didn’t this time. I’d really prefer that
>> phab/arc had a way to differentiate the commit log from the review
>> comments/questions (in the original submission), it would prevent this sort
>> of errors.
>>
>
> Yep, that would be nice. (and/or a way to set a default option for arc
> that will open the commit message in an editor every time rather than just
> using what you put in for the review - but maybe there's ano ption for that
> already, I haven't looked)
>

I'm not sure which features are wished for here exactly, but usually the
best way to get them is to just file an upstream phabricator feature
request :)


>
>
>>
>> Fred
>>
>>
>>
>>>
>>> Reviewers: dblaikie, samsonov
>>>
>>> Subscribers: llvm-commits
>>>
>>
>> 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)
>>
>>
>>>
>>> Differential Revision: http://reviews.llvm.org/D5689
>>>
>>> Added:
>>>     llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.m
>>>     llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.x86_64.o
>>>     llvm/trunk/test/DebugInfo/dwarfdump-objc.test
>>> Modified:
>>>     llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp
>>>
>>> Modified: llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp?rev=219507&r1=219506&r2=219507&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp (original)
>>> +++ llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp Fri Oct 10 10:51:10
>>> 2014
>>> @@ -12,6 +12,7 @@
>>>  #include "DWARFContext.h"
>>>  #include "DWARFDebugAbbrev.h"
>>>  #include "llvm/DebugInfo/DWARFFormValue.h"
>>> +#include "llvm/Support/DataTypes.h"
>>>  #include "llvm/Support/Debug.h"
>>>  #include "llvm/Support/Dwarf.h"
>>>  #include "llvm/Support/Format.h"
>>> @@ -72,6 +73,21 @@ void DWARFDebugInfoEntryMinimal::dump(ra
>>>    }
>>>  }
>>>
>>> +static void dumpApplePropertyAttribute(raw_ostream &OS, uint64_t Val) {
>>> +  OS << " (";
>>> +  do {
>>> +    uint64_t Bit = 1ULL << countTrailingZeros(Val);
>>> +    if (const char *PropName = ApplePropertyString(Bit))
>>> +      OS << PropName;
>>> +    else
>>> +      OS << format("DW_APPLE_PROPERTY_0x%" PRIx64, Bit);
>>> +    if (!(Val ^= Bit))
>>> +      break;
>>> +    OS << ", ";
>>> +  } while (true);
>>> +  OS << ")";
>>> +}
>>> +
>>>  void DWARFDebugInfoEntryMinimal::dumpAttribute(raw_ostream &OS,
>>>                                                 DWARFUnit *u,
>>>                                                 uint32_t *offset_ptr,
>>> @@ -130,6 +146,9 @@ void DWARFDebugInfoEntryMinimal::dumpAtt
>>>      if (const DWARFUnit *RefU = findUnitAndExtractFast(DIE, u, &Ref))
>>>        if (const char *Ref = DIE.getName(RefU, DINameKind::LinkageName))
>>>          OS << " \"" << Ref << '\"';
>>> +  } else if (attr == DW_AT_APPLE_property_attribute) {
>>> +    if (Optional<uint64_t> OptVal = formValue.getAsUnsignedConstant())
>>> +      dumpApplePropertyAttribute(OS, *OptVal);
>>>    }
>>>
>>>    OS << ")\n";
>>>
>>> Added: llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.m
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.m?rev=219507&view=auto
>>>
>>> ==============================================================================
>>> --- llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.m (added)
>>> +++ llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.m Fri Oct 10
>>> 10:51:10 2014
>>> @@ -0,0 +1,16 @@
>>> +// Compile with clang -g dwarfdump-objc.m -c -Wno-objc-root-class
>>> +
>>> + at interface NSObject {} @end
>>> +
>>> +
>>> + at interface TestInterface
>>> + at property (readonly) int ReadOnly;
>>> + at property (assign) int Assign;
>>> + at property (readwrite) int ReadWrite;
>>> + at property (retain) NSObject *Retain;
>>> + at property (copy) NSObject *Copy;
>>> + at property (nonatomic) int NonAtomic;
>>> + at end
>>> +
>>> + at implementation TestInterface
>>> + at end
>>>
>>> Added: llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.x86_64.o
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/dwarfdump-objc.x86_64.o?rev=219507&view=auto
>>>
>>> ==============================================================================
>>> 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
>>>
>>> Added: llvm/trunk/test/DebugInfo/dwarfdump-objc.test
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-objc.test?rev=219507&view=auto
>>>
>>> ==============================================================================
>>> --- llvm/trunk/test/DebugInfo/dwarfdump-objc.test (added)
>>> +++ llvm/trunk/test/DebugInfo/dwarfdump-objc.test Fri Oct 10 10:51:10
>>> 2014
>>> @@ -0,0 +1,40 @@
>>> +RUN: llvm-dwarfdump %p/Inputs/dwarfdump-objc.x86_64.o | FileCheck %s
>>> +
>>> +CHECK:      .debug_info contents:
>>> +
>>> +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_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_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_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_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_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))
>>> +
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141013/20479b07/attachment.html>


More information about the llvm-commits mailing list