class AdLint::Exam::CBuiltin::W0114::Visitor
Public Class Methods
new(phase_ctxt)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 2850 def initialize(phase_ctxt) @phase_ctxt = phase_ctxt @logical_op_num = 0 end
Public Instance Methods
visit_c99_for_statement(node)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 2901 def visit_c99_for_statement(node) if node.analysis_target?(traits) @logical_op_num = 0 node.condition_statement.accept(self) check_logical_operation(node.location) node.body_statement.accept(self) end end
visit_conditional_expression(node)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 2947 def visit_conditional_expression(node) if node.analysis_target?(traits) @logical_op_num = 0 node.condition.accept(self) check_logical_operation(node.condition.location) node.then_expression.accept(self) node.else_expression.accept(self) end end
visit_do_statement(node)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 2883 def visit_do_statement(node) if node.analysis_target?(traits) node.statement.accept(self) @logical_op_num = 0 node.expression.accept(self) check_logical_operation(node.location) end end
visit_equality_expression(node)
click to toggle source
Calls superclass method
AdLint::Cc1::SyntaxTreeVisitor#visit_equality_expression
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 2926 def visit_equality_expression(node) if node.analysis_target?(traits) @logical_op_num += 1 super end end
visit_for_statement(node)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 2892 def visit_for_statement(node) if node.analysis_target?(traits) @logical_op_num = 0 node.condition_statement.accept(self) check_logical_operation(node.location) node.body_statement.accept(self) end end
visit_if_else_statement(node)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 2864 def visit_if_else_statement(node) if node.analysis_target?(traits) @logical_op_num = 0 node.expression.accept(self) check_logical_operation(node.location) node.then_statement.accept(self) node.else_statement.accept(self) end end
visit_if_statement(node)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 2855 def visit_if_statement(node) if node.analysis_target?(traits) @logical_op_num = 0 node.expression.accept(self) check_logical_operation(node.location) node.statement.accept(self) end end
visit_logical_and_expression(node)
click to toggle source
Calls superclass method
AdLint::Cc1::SyntaxTreeVisitor#visit_logical_and_expression
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 2933 def visit_logical_and_expression(node) if node.analysis_target?(traits) @logical_op_num += 1 super end end
visit_logical_or_expression(node)
click to toggle source
Calls superclass method
AdLint::Cc1::SyntaxTreeVisitor#visit_logical_or_expression
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 2940 def visit_logical_or_expression(node) if node.analysis_target?(traits) @logical_op_num += 1 super end end
visit_relational_expression(node)
click to toggle source
Calls superclass method
AdLint::Cc1::SyntaxTreeVisitor#visit_relational_expression
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 2919 def visit_relational_expression(node) if node.analysis_target?(traits) @logical_op_num += 1 super end end
visit_unary_arithmetic_expression(node)
click to toggle source
Calls superclass method
AdLint::Cc1::SyntaxTreeVisitor#visit_unary_arithmetic_expression
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 2910 def visit_unary_arithmetic_expression(node) if node.analysis_target?(traits) if node.operator.type == "!" @logical_op_num += 1 end super end end
visit_while_statement(node)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 2874 def visit_while_statement(node) if node.analysis_target?(traits) @logical_op_num = 0 node.expression.accept(self) check_logical_operation(node.location) node.statement.accept(self) end end
Private Instance Methods
check_logical_operation(loc)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 2958 def check_logical_operation(loc) W(loc) if @logical_op_num == 0 end
suppressors()
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 2973 def suppressors @phase_ctxt[:suppressors] end