Class: AdLint::Cc1::ValueDomainNarrowing
- Inherits:
-
Object
- Object
- AdLint::Cc1::ValueDomainNarrowing
- Extended by:
- Forwardable
- Includes:
- Conversion, InterpreterMediator, NotifierMediator
- Defined in:
- lib/adlint/cc1/ctrlexpr.rb
Direct Known Subclasses
DelayedObjectDerivation, LogicalAnd, LogicalOr, StrictObjectDerivation, ValueComparison
Instance Attribute Summary collapse
-
#narrowed_values ⇒ Object
readonly
Returns the value of attribute narrowed_values.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #ensure_result_equal_to(val) ⇒ Object
- #execute! ⇒ Object
-
#initialize(manip, node, *children) ⇒ ValueDomainNarrowing
constructor
A new instance of ValueDomainNarrowing.
- #load_original_values!(manip) ⇒ Object
Methods included from Conversion
#do_conversion, #do_default_argument_promotion, #do_integer_promotion, #do_usual_arithmetic_conversion, #untyped_pointer_conversion?
Methods included from InterpreterMediator
#constant_expression?, #current_branch, #object_to_pointer, #object_to_variable, #pointer_value_of, #reset_environment, #scalar_value_of, #scalar_value_of_arbitrary, #scalar_value_of_false, #scalar_value_of_null, #scalar_value_of_true, #value_of
Methods included from InterpSyntaxBridge
Methods included from InterpObjectBridge
Methods included from ArithmeticAccessor
#arithmetic, #logical_right_shift?
Methods included from FunctionTableMediator
#declare_explicit_function, #declare_implicit_function, #define_anonymous_function, #define_explicit_function
Methods included from VariableTableMediator
#create_tmpvar, #local_variables
Methods included from MemoryPoolMediator
Constructor Details
#initialize(manip, node, *children) ⇒ ValueDomainNarrowing
Returns a new instance of ValueDomainNarrowing.
567 568 569 570 571 572 573 574 |
# File 'lib/adlint/cc1/ctrlexpr.rb', line 567 def initialize(manip, node, *children) @manipulator = manip @node = node @children = children @original_values = {} @narrowed_values = {} @result = nil end |
Instance Attribute Details
#narrowed_values ⇒ Object (readonly)
Returns the value of attribute narrowed_values.
577 578 579 |
# File 'lib/adlint/cc1/ctrlexpr.rb', line 577 def narrowed_values @narrowed_values end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
576 577 578 |
# File 'lib/adlint/cc1/ctrlexpr.rb', line 576 def node @node end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
578 579 580 |
# File 'lib/adlint/cc1/ctrlexpr.rb', line 578 def result @result end |
Instance Method Details
#ensure_result_equal_to(val) ⇒ Object
599 600 601 602 603 604 605 |
# File 'lib/adlint/cc1/ctrlexpr.rb', line 599 def ensure_result_equal_to(val) if @result.variable? && @result.designated_by_lvalue? if @result.value.scalar? && val.scalar? ensure_relation(@result, Operator::EQ, val) end end end |
#execute! ⇒ Object
585 586 587 588 589 590 591 592 593 594 595 596 597 |
# File 'lib/adlint/cc1/ctrlexpr.rb', line 585 def execute! @result = do_narrowing @children.each do |manip| @narrowed_values = manip.narrowed_values.merge(@narrowed_values) end ensure if @result && @result.variable? notify_variable_value_referred(node, @result) end if seqp = node.subsequent_sequence_point notify_sequence_point_reached(seqp) end end |
#load_original_values!(manip) ⇒ Object
580 581 582 583 |
# File 'lib/adlint/cc1/ctrlexpr.rb', line 580 def load_original_values!(manip) @original_values = manip.narrowed_values @children.each { |child| child.load_original_values!(manip) } end |