The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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

SYNPOSIS

  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

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

DESCRIPTION

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

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

AUTHOR

Ashley Winters <awinters@users.sourceforge.net>

COPYRIGHT AND LICENSE

Copyright 2003 by Ashley Winters

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.