Class: AdLint::Cc1::ScopedVariable

Inherits:
Variable show all
Defined in:
lib/adlint/cc1/object.rb

Direct Known Subclasses

OuterVariable

Instance Attribute Summary collapse

Attributes inherited from TypedObject

#type

Attributes inherited from Object

#declarations_and_definitions

Attributes included from Bindable

#binding

Instance Method Summary collapse

Methods inherited from Variable

#assign!, #begin_value_versioning, #end_value_versioning, #enter_value_versioning_group, #function?, #inner?, #leave_value_versioning_group, #name, #named?, #narrow_value_domain!, #outer?, #rollback_all_value_versions!, #thin_latest_value_version!, #uninitialize!, #value, #variable?, #widen_value_domain!

Methods inherited from TypedObject

#to_pointer, #to_pointer_value, #to_value, #to_variable

Methods inherited from Object

#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(mem, dcl_or_def, type, scope) ⇒ ScopedVariable

Returns a new instance of ScopedVariable.



311
312
313
314
# File 'lib/adlint/cc1/object.rb', line 311

def initialize(mem, dcl_or_def, type, scope)
  super(mem, dcl_or_def, type)
  @scope = scope
end

Instance Attribute Details

#scopeObject

Returns the value of attribute scope.



316
317
318
# File 'lib/adlint/cc1/object.rb', line 316

def scope
  @scope
end

Instance Method Details

#declared_as_auto?Boolean

Returns:

  • (Boolean)


326
327
328
329
330
331
332
333
# File 'lib/adlint/cc1/object.rb', line 326

def declared_as_auto?
  if @scope.global?
    super
  else
    sc_spec = first_storage_class_specifier
    sc_spec.nil? || sc_spec.type == :AUTO
  end
end

#declared_as_extern?Boolean

Returns:

  • (Boolean)


318
319
320
321
322
323
324
# File 'lib/adlint/cc1/object.rb', line 318

def declared_as_extern?
  if @scope.global?
    super
  else
  sc_spec = first_storage_class_specifier and sc_spec.type == :EXTERN
  end
end