class AdLint::Exam::CBuiltin::W0624
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 14633 def initialize(phase_ctxt) super trav = phase_ctxt[:cc1_ast_traversal] trav.enter_ansi_function_definition += T(:check) trav.enter_kandr_function_definition += T(:check) @dires = collect_define_lines(phase_ctxt[:cpp_ast]) + collect_undef_lines(phase_ctxt[:cpp_ast]) end
Private Instance Methods
check(fun_def)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 14643 def check(fun_def) @dires.select { |node| in_block?(fun_def.function_body, node) }.each { |node| W(node.location) } end
in_block?(outer_node, inner_node)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 14649 def in_block?(outer_node, inner_node) outer_node.location.fpath == inner_node.location.fpath && outer_node.head_token.location.line_no < inner_node.location.line_no && outer_node.tail_token.location.line_no > inner_node.location.line_no end