Class: Rubycc::Front::AST::BuiltinOffsetof
- Inherits:
-
Data
- Object
- Data
- Rubycc::Front::AST::BuiltinOffsetof
- Defined in:
- lib/rubycc/front/ast.rb
Overview
"__builtin_offsetof ( type-name , member-designator )": the byte offset of
a member within a struct/union, folded to a size_t constant. Unlike the
traditional "((size_t)&(((t*)0)->m))" macro, it is a genuine
constant-expression, so it holds in a static initializer, an array bound
or a case label — the reason gcc/clang provide it. type is the resolved
aggregate type; designator is the parsed member-designator, a non-empty
array whose first element is always an OffsetofMember (the leading member
name carries no "."). Each element is either an OffsetofMember (".name",
or the leading bare name) or an OffsetofIndex ("[ constant-expression ]"),
so a nested field ("a.b.c") reaches its target one element at a time.
token is the builtin keyword, locating every diagnostic.
Instance Attribute Summary collapse
-
#designator ⇒ Object
readonly
Returns the value of attribute designator.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Attribute Details
#designator ⇒ Object (readonly)
Returns the value of attribute designator
376 377 378 |
# File 'lib/rubycc/front/ast.rb', line 376 def designator @designator end |
#token ⇒ Object (readonly)
Returns the value of attribute token
376 377 378 |
# File 'lib/rubycc/front/ast.rb', line 376 def token @token end |
#type ⇒ Object (readonly)
Returns the value of attribute type
376 377 378 |
# File 'lib/rubycc/front/ast.rb', line 376 def type @type end |