class AdLint::Cpp::Prepare1Phase

Public Class Methods

new(phase_ctxt) click to toggle source
Calls superclass method AdLint::Cpp::CppPhase::new
# File lib/adlint/cpp/phase.rb, line 48
def initialize(phase_ctxt)
  super(phase_ctxt, "pr1")
end

Private Instance Methods

do_execute(phase_ctxt, *) click to toggle source
# File lib/adlint/cpp/phase.rb, line 53
def do_execute(phase_ctxt, *)
  root_src = phase_ctxt[:sources].first
  phase_ctxt[:cc1_source]        = PreprocessedSource.new(root_src)
  phase_ctxt[:cpp_macro_table]   = MacroTable.new
  phase_ctxt[:cpp_interpreter]   = Preprocessor.new
  phase_ctxt[:cpp_ast_traversal] = SyntaxTreeMulticastVisitor.new
  register_annotation_parser
end
parse_annotation(comment, loc) click to toggle source
# File lib/adlint/cpp/phase.rb, line 68
def parse_annotation(comment, loc)
  if annot = Annotation.parse(comment, loc)
    @phase_ctxt[:annotations].push(annot)
    if annot.message_suppression_specifier? &&
        traits.of_message.individual_suppression
      @phase_ctxt[:suppressors].add(annot.create_suppressor)
    end
  end
end
register_annotation_parser() click to toggle source
# File lib/adlint/cpp/phase.rb, line 62
def register_annotation_parser
  parser = method(:parse_annotation)
  @phase_ctxt[:cpp_interpreter].on_line_comment_found  += parser
  @phase_ctxt[:cpp_interpreter].on_block_comment_found += parser
end