GCC::TranslationUnit is a Perl module that can parse the output of gcc -fdump-translation-unit.
SYNPOSIS
use GCC::TranslationUnit;
# echo '#include ' > 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 %sn",
$node->name->identifier, $node->source;
}
} continue {
$node = $node->chain;
}
ABSTRACT
Provides a module for reading in the -fdump-translation-unit file from GCC and access methods for the data available from within GCC.
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.
Product's homepage
Requirements:
· Perl