Class: Rubycc::Front::AST::BuiltinOffsetof

Inherits:
Data
  • Object
show all
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

Instance Attribute Details

#designatorObject (readonly)

Returns the value of attribute designator

Returns:

  • (Object)

    the current value of designator



376
377
378
# File 'lib/rubycc/front/ast.rb', line 376

def designator
  @designator
end

#tokenObject (readonly)

Returns the value of attribute token

Returns:

  • (Object)

    the current value of token



376
377
378
# File 'lib/rubycc/front/ast.rb', line 376

def token
  @token
end

#typeObject (readonly)

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



376
377
378
# File 'lib/rubycc/front/ast.rb', line 376

def type
  @type
end