Class: AdLint::Cc1::PhantomVariable

Inherits:
AliasVariable show all
Defined in:
lib/adlint/cc1/ctrlexpr.rb

Instance Attribute Summary

Attributes included from Nameable

#name

Attributes inherited from OuterVariable

#representative_element

Attributes inherited from ScopedVariable

#scope

Attributes inherited from TypedObject

#type

Attributes inherited from Object

#declarations_and_definitions

Attributes included from Bindable

#binding

Instance Method Summary collapse

Methods inherited from NamedVariable

#designated_by_lvalue?, #temporary?

Methods included from Nameable

#named?

Methods inherited from OuterVariable

#begin_value_versioning, #end_value_versioning, #enter_value_versioning_group, #inner?, #inner_variable_at, #inner_variable_named, #leave_value_versioning_group, #rollback_all_value_versions!, #thin_latest_value_version!

Methods inherited from ScopedVariable

#declared_as_auto?, #declared_as_extern?

Methods inherited from Variable

#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!, #variable?, #widen_value_domain!

Methods inherited from TypedObject

#to_pointer, #to_pointer_value, #to_value, #to_variable

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(named_var, phantom_val = nil) ⇒ PhantomVariable

Returns a new instance of PhantomVariable.



916
917
918
919
920
# File 'lib/adlint/cc1/ctrlexpr.rb', line 916

def initialize(named_var, phantom_val = nil)
  super(named_var)
  @base_var    = named_var
  @phantom_val = phantom_val ? phantom_val : named_var.memory.read.dup
end

Instance Method Details

#assign!(val) ⇒ Object



926
927
928
# File 'lib/adlint/cc1/ctrlexpr.rb', line 926

def assign!(val, *)
  @phantom_val = val
end

#pretty_print(pp) ⇒ Object



934
935
936
# File 'lib/adlint/cc1/ctrlexpr.rb', line 934

def pretty_print(pp)
  Summary.new(object_id, name, type, @phantom_val).pretty_print(pp)
end

#to_named_variableObject



930
931
932
# File 'lib/adlint/cc1/ctrlexpr.rb', line 930

def to_named_variable
  @base_var.to_named_variable
end

#valueObject



922
923
924
# File 'lib/adlint/cc1/ctrlexpr.rb', line 922

def value
  @phantom_val
end