Class: AdLint::Exam::CBuiltin::FN_UNRC

Inherits:
MetricMeasurement show all
Defined in:
lib/adlint/exam/c_builtin/cc1_metric.rb

Instance Method Summary collapse

Methods inherited from MetricMeasurement

required?

Methods inherited from AdLint::Examination

catalog, #execute, registrant_phase_class, required?

Methods included from LogUtil

#log_debug, #log_error, #log_fatal, #log_info, #log_warn

Methods included from ReportUtil

#create_context_message, #write_FL_FUNC, #write_FL_STMT, #write_FN_CALL, #write_FN_CSUB, #write_FN_CYCM, #write_FN_GOTO, #write_FN_LINE, #write_FN_NEST, #write_FN_PARA, #write_FN_PATH, #write_FN_RETN, #write_FN_STMT, #write_FN_UELS, #write_FN_UNRC, #write_FN_UNUV, #write_assignment, #write_error_message, #write_funcall, #write_fundcl, #write_fundef, #write_gvardcl, #write_include, #write_initialization, #write_labeldef, #write_literal, #write_macrodef, #write_pp_directive, #write_typedcl, #write_vardef, #write_warning_message, #write_xref_function, #write_xref_variable

Constructor Details

#initialize(phase_ctxt) ⇒ FN_UNRC



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/adlint/exam/c_builtin/cc1_metric.rb', line 170

def initialize(phase_ctxt)
  super
  @fpath = phase_ctxt[:sources].first.fpath
  trav = phase_ctxt[:cc1_ast_traversal]
  trav.enter_ansi_function_definition  += T(:enter_function)
  trav.leave_ansi_function_definition  += T(:leave_function)
  trav.enter_kandr_function_definition += T(:enter_function)
  trav.leave_kandr_function_definition += T(:leave_function)
  trav.enter_error_statement           += T(:count_statement)
  trav.enter_generic_labeled_statement += T(:count_statement)
  trav.enter_case_labeled_statement    += T(:count_statement)
  trav.enter_default_labeled_statement += T(:count_statement)
  trav.enter_expression_statement      += T(:count_statement)
  trav.enter_if_statement              += T(:count_statement)
  trav.enter_if_else_statement         += T(:count_statement)
  trav.enter_switch_statement          += T(:count_statement)
  trav.enter_while_statement           += T(:count_statement)
  trav.enter_do_statement              += T(:count_statement)
  trav.enter_for_statement             += T(:count_statement)
  trav.enter_c99_for_statement         += T(:count_statement)
  trav.enter_goto_statement            += T(:count_statement)
  trav.enter_continue_statement        += T(:count_statement)
  trav.enter_break_statement           += T(:count_statement)
  trav.enter_return_statement          += T(:count_statement)
  @cur_fun = nil
  @unreached_stmt_cnt = 0
end