class AdLint::Ld::PreparePhase

Public Class Methods

new(phase_ctxt) click to toggle source
Calls superclass method AdLint::Ld::LdPhase::new
# File lib/adlint/ld/phase.rb, line 135
def initialize(phase_ctxt)
  super(phase_ctxt, "pre")
end

Private Instance Methods

collect_annotations() click to toggle source
# File lib/adlint/ld/phase.rb, line 150
def collect_annotations
  composing_fpaths.each do |fpath|
    lexer = Cpp::Lexer.new(
      Source.new(fpath, traits.of_project.file_encoding), traits)

    parser = method(:parse_annotation)
    lexer.on_line_comment_found  += parser
    lexer.on_block_comment_found += parser
    while lexer.next_token; end
  end
end
composing_fpaths() click to toggle source
# File lib/adlint/ld/phase.rb, line 162
def composing_fpaths
  @phase_ctxt[:ld_function_map].composing_fpaths +
    @phase_ctxt[:ld_variable_map].composing_fpaths +
    @phase_ctxt[:ld_typedef_map].composing_fpaths
end
do_execute(phase_ctxt, *) click to toggle source
# File lib/adlint/ld/phase.rb, line 140
def do_execute(phase_ctxt, *)
  collect_annotations
  phase_ctxt[:ld_typedef_traversal] =
    TypedefTraversal.new(phase_ctxt[:ld_typedef_map])
  phase_ctxt[:ld_function_traversal] =
    FunctionTraversal.new(phase_ctxt[:ld_function_map])
  phase_ctxt[:ld_variable_traversal] =
    VariableTraversal.new(phase_ctxt[:ld_variable_map])
end
parse_annotation(comment, loc) click to toggle source
# File lib/adlint/ld/phase.rb, line 168
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