[PATCH] D51990: [DebugInfo] Fix emitting of bit offset for ObjC

Jonas Devlieghere via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 13 02:33:33 PDT 2018


JDevlieghere added inline comments.


================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:2369
+              ? CGM.getObjCRuntime().ComputeBitfieldBitOffset(CGM, ID, Field)
+              : 0;
     } else {
----------------
aprantl wrote:
> JDevlieghere wrote:
> > JDevlieghere wrote:
> > > aprantl wrote:
> > > > aprantl wrote:
> > > > > It might help to attempt some git blame archeology.
> > > > > Judging from the comment, it sounds like the debugger is supposed to query the runtime for the *byte* offset and then add the bit offset from DWARF? Could that make sense?
> > > > If that is the case, we'd need to relax llvm-dwarfdump --verify to accept this and make sure LLDB does the right thing instead.
> > > Ah I see, yeah that sounds reasonable and explains the comment which I interpreted differently. Thanks! 
> > btw it was added in rL167503. 
> We should check whether emitting the offsets like this violates the DWARF spec. If yes, it may be better to emit the static offsets like you are doing here and then still have LLDB ignore everything but the bit-offsets from the dynamic byte offset.
The standard says 

> The member entry corresponding to a data member that is defined in a structure,
> union or class may have either a DW_AT_data_member_location attribute or a
> DW_AT_data_bit_offset attribute.

which to me sounds like they should be mutually exclusive. I ran the lldb test suite with my change and there were no new failures, which leads me to believe that the comment from r167503 still holds and lldb ignores this attribute, at least for Objective-C.


Repository:
  rC Clang

https://reviews.llvm.org/D51990





More information about the cfe-commits mailing list