Class: Rubycc::Type::Member
- Inherits:
-
Data
- Object
- Data
- Rubycc::Type::Member
- Defined in:
- lib/rubycc/type.rb
Overview
One laid-out member of a struct: its name, its declared Type and the
byte offset of its first byte from the start of the enclosing struct.
A bit-field member carries two extra fields (both nil for a plain member):
bit_width, the declared width in bits, and bit_offset, the field's bit
position measured from the start of the enclosing aggregate. offset for a
bit-field is the byte containing its first bit (bit_offset / 8), kept only
so ABI classification and diagnostics have a byte anchor — this subset
diagnoses every bit-field access, so no read or write ever consults these
bit fields to extract a value (recorded M2 debt). An unnamed bit-field
declares no member and is never recorded here; it only shapes the layout.
Instance Attribute Summary collapse
-
#bit_offset ⇒ Object
readonly
Returns the value of attribute bit_offset.
-
#bit_width ⇒ Object
readonly
Returns the value of attribute bit_width.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#bitfield? ⇒ Boolean
Whether this member is a bit-field, distinguishing it from a plain member occupying whole bytes; the generator consults it to diagnose an access.
-
#initialize(name:, type:, offset:, bit_width: nil, bit_offset: nil) ⇒ Member
constructor
A new instance of Member.
Constructor Details
#initialize(name:, type:, offset:, bit_width: nil, bit_offset: nil) ⇒ Member
Returns a new instance of Member.
758 759 760 |
# File 'lib/rubycc/type.rb', line 758 def initialize(name:, type:, offset:, bit_width: nil, bit_offset: nil) super end |
Instance Attribute Details
#bit_offset ⇒ Object (readonly)
Returns the value of attribute bit_offset
757 758 759 |
# File 'lib/rubycc/type.rb', line 757 def bit_offset @bit_offset end |
#bit_width ⇒ Object (readonly)
Returns the value of attribute bit_width
757 758 759 |
# File 'lib/rubycc/type.rb', line 757 def bit_width @bit_width end |
#name ⇒ Object (readonly)
Returns the value of attribute name
757 758 759 |
# File 'lib/rubycc/type.rb', line 757 def name @name end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset
757 758 759 |
# File 'lib/rubycc/type.rb', line 757 def offset @offset end |
#type ⇒ Object (readonly)
Returns the value of attribute type
757 758 759 |
# File 'lib/rubycc/type.rb', line 757 def type @type end |
Instance Method Details
#bitfield? ⇒ Boolean
Whether this member is a bit-field, distinguishing it from a plain member occupying whole bytes; the generator consults it to diagnose an access.
764 765 766 |
# File 'lib/rubycc/type.rb', line 764 def bitfield? !bit_width.nil? end |