GCC::TranslationUnit - Parse the output of gcc -fdump-translation-unit


GCC-TranslationUnit documentation  | view source Contained in the GCC-TranslationUnit distribution.

Index


NAME

Top

GCC::TranslationUnit - Parse the output of gcc -fdump-translation-unit

SYNPOSIS

Top

  use GCC::TranslationUnit;

  # echo '#include <stdio.h>' > stdio.c
  # gcc -fdump-translation-unit -c stdio.c
  $node = GCC::TranslationUnit::Parser->parsefile('stdio.c.tu')->root;

  # list every function/variable name
  while($node) {
    if($node->isa('GCC::Node::function_decl') or
       $node->isa('GCC::Node::var_decl')) {
      printf "%s declared in %s\n",
        $node->name->identifier, $node->source;
    }
  } continue {
    $node = $node->chain;
  }

ABSTRACT

Top

Provides a module for reading in the -fdump-translation-unit file from GCC and access methods for the data available from within GCC.

DESCRIPTION

Top

Once you read in the file using the Parser, you can traverse the entire structure of the parse tree using methods defined in the GCC::Node::* modules. Look there for information. Each node is blessed into a GCC::Node::* class with that name.

SEE ALSO

Top

See the source for the GCC::Node modules, and the source to GCC itself

AUTHOR

Top

Ashley Winters <awinters@users.sourceforge.net>

COPYRIGHT AND LICENSE

Top


GCC-TranslationUnit documentation  | view source Contained in the GCC-TranslationUnit distribution.