class AdLint::Exam::CBuiltin::W0115
Public Class Methods
new(phase_ctxt)
click to toggle source
Calls superclass method
AdLint::Examination::new
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 2989 def initialize(phase_ctxt) super @interp = phase_ctxt[:cc1_interpreter] @interp.on_shift_expr_evaled += T(:check) end
Private Instance Methods
check(shift_expr, lhs_var, rhs_var, *)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 2996 def check(shift_expr, lhs_var, rhs_var, *) op = shift_expr.operator.type return unless op == "<<" || op == "<<=" if lhs_var.type.unsigned? lhs_limit = scalar_value_of(lhs_var.type.max) >> rhs_var.value test = lhs_var.value.test_must_be_greater_than(lhs_limit) if test.true? W(shift_expr.location, *test.evidence.emit_context_messages(self, shift_expr.location)) end end end
interpreter()
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 3010 def interpreter @interp end