class AdLint::Exam::CBuiltin::FunDclExtraction

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 102
def initialize(phase_ctxt)
  super
  interp = phase_ctxt[:cc1_interpreter]
  interp.on_explicit_function_declared += T(:extract_explicit_dcl)
  interp.on_implicit_function_declared += T(:extract_implicit_dcl)
  interp.on_block_started              += T(:enter_block)
  interp.on_block_ended                += T(:leave_block)
  @block_level = 0
end

Private Instance Methods

do_execute(*) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_code.rb, line 114
def do_execute(*) end
do_prepare(*) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_code.rb, line 113
def do_prepare(*) end
enter_block(*) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_code.rb, line 137
def enter_block(*)
  @block_level += 1
end
extract_explicit_dcl(fun_dcl, fun) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_code.rb, line 116
def extract_explicit_dcl(fun_dcl, fun)
  if fun.declared_as_extern?
    FUNDCL(fun_dcl.identifier.location, "X",
           @block_level == 0 ? "F" : "B", "E",
           FunctionId.new(fun_dcl.identifier.value,
                          fun_dcl.signature.to_s))
  else
    FUNDCL(fun_dcl.identifier.location, "I",
           @block_level == 0 ? "F" : "B", "E",
           FunctionId.new(fun_dcl.identifier.value,
                          fun_dcl.signature.to_s))
  end
end
extract_implicit_dcl(expr, fun) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_code.rb, line 130
def extract_implicit_dcl(expr, fun)
  if fun.named?
    FUNDCL(expr.location, "X", "F", "I",
           FunctionId.new(fun.name, fun.signature.to_s))
  end
end
leave_block(*) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_code.rb, line 141
def leave_block(*)
  @block_level -= 1
end