class AdLint::Exam::CBuiltin::W0593

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 134
def initialize(phase_ctxt)
  super
  phase_ctxt[:ld_variable_traversal].on_definition += T(:check)
  @xref_graph = phase_ctxt[:ld_xref_graph]
end

Private Instance Methods

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