class AdLint::Exam::CBuiltin::FuncallExtraction

Public Class Methods

new(phase_ctxt) click to toggle source
Calls superclass method AdLint::Examination::new
# File lib/adlint/exam/c_builtin/cc1_code.rb, line 310
def initialize(phase_ctxt)
  super
  interp = phase_ctxt[:cc1_interpreter]
  interp.on_function_started          += T(:update_caller)
  interp.on_function_ended            += T(:clear_caller)
  interp.on_function_call_expr_evaled += T(:extract_function_call)
  @caller = nil
end

Private Instance Methods

clear_caller(*) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_code.rb, line 327
def clear_caller(*)
  @caller = nil
end
do_execute(*) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_code.rb, line 321
def do_execute(*) end
do_prepare(*) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_code.rb, line 320
def do_prepare(*) end
extract_function_call(funcall_expr, fun, *) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_code.rb, line 331
def extract_function_call(funcall_expr, fun, *)
  if fun.named?
    if @caller
      referrer = FunctionId.new(@caller.name, @caller.signature.to_s)
    else
      referrer = FunctionId.of_ctors_section
    end
    FUNCALL(funcall_expr.location, referrer,
            FunctionId.new(fun.name, fun.signature.to_s))
  end
end
update_caller(*, fun) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_code.rb, line 323
def update_caller(*, fun)
  @caller = fun
end