Class: AdLint::Cc1::TypedObject
- Inherits:
-
Object
- Object
- Object
- AdLint::Cc1::TypedObject
show all
- Defined in:
- lib/adlint/cc1/object.rb
Instance Attribute Summary collapse
Attributes inherited from Object
#declarations_and_definitions
Attributes included from Bindable
#binding
Instance Method Summary
collapse
Methods inherited from Object
#declared_as_auto?, #declared_as_extern?, #declared_as_register?, #declared_as_static?, #designated_by_lvalue?, #function?, #named?, #storage_class_specifiers, #temporary?, #variable?
Methods included from Bindable
#be_alias_to, #bind_to
Constructor Details
#initialize(type, dcl_or_def = nil) ⇒ TypedObject
Returns a new instance of TypedObject.
163
164
165
166
|
# File 'lib/adlint/cc1/object.rb', line 163
def initialize(type, dcl_or_def = nil)
super(dcl_or_def)
@type = type
end
|
Instance Attribute Details
Returns the value of attribute type.
168
169
170
|
# File 'lib/adlint/cc1/object.rb', line 168
def type
@type
end
|
Instance Method Details
#to_pointer(interp_bridge) ⇒ Object
178
179
180
181
182
183
184
185
|
# File 'lib/adlint/cc1/object.rb', line 178
def to_pointer(interp_bridge)
if @type.array?
ptr_type = @type.type_table.pointer_type(@type.base_type)
else
ptr_type = @type.type_table.pointer_type(@type)
end
interp_bridge[:create_tmpvar][ptr_type, to_pointer_value(interp_bridge)]
end
|
#to_pointer_value(interp_bridge) ⇒ Object
195
196
197
|
# File 'lib/adlint/cc1/object.rb', line 195
def to_pointer_value(interp_bridge)
interp_bridge[:scalar_value_of][binding.memory.address]
end
|
#to_value(interp_bridge) ⇒ Object
187
188
189
190
191
192
193
|
# File 'lib/adlint/cc1/object.rb', line 187
def to_value(interp_bridge)
if @type.array? || @type.function?
to_pointer_value(interp_bridge)
else
value.to_single_value
end
end
|
#to_variable(interp_bridge) ⇒ Object
170
171
172
173
174
175
176
|
# File 'lib/adlint/cc1/object.rb', line 170
def to_variable(interp_bridge)
if function? or variable? && @type.array?
to_pointer(interp_bridge)
else
self
end
end
|