class AdLint::Exam::CBuiltin::W0591

Public Class Methods

new(phase_ctxt) click to toggle source
Calls superclass method AdLint::Examination::new
# File lib/adlint/exam/c_builtin/ld_check.rb, line 113
def initialize(phase_ctxt)
  super
  phase_ctxt[:ld_function_traversal].on_definition += T(:check)
  @xref_graph = phase_ctxt[:ld_xref_graph]
end

Private Instance Methods

check(fun) click to toggle source
# File lib/adlint/exam/c_builtin/ld_check.rb, line 120
def check(fun)
  if fun.extern?
    direct_refs = @xref_graph.direct_referrers_of(fun)
    if !direct_refs.empty? &&
        direct_refs.all? { |ref| ref.location.fpath == fun.location.fpath }
      W(fun.location, fun.signature)
    end
  end
end