Re: Re: Re: GCC Plugin TRANSLATION_UNIT_DECL - Parsing global functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 17, 2012 at 3:23 AM, Mario Miller <mario-miller@xxxxxx> wrote:
>
> When I pass the DECL_INITIAL tree to debug_tree it prints out an empty line; so it seems to be NULL.
>
> When I pass the TRANSLATION_UNIT_DECL tree to debug_tree it prints out this:
>
> <translation_unit_decl 0x4051006c D.1 VOID file (null) line 0 col 0
>     align 1>
>
> When I pass the FUNCTION_DECL tree to debug_tree it prints out this:
>
> <function_decl 0x410d9e80 generateOutput
>     type <function_type 0x405158a0
>         type <void_type 0x40508840 void type_6 VOID
>             align 8 symtab 0 alias set -1 canonical type 0x40508840
>             pointer_to_this <pointer_type 0x405088a0>>
>         QI
>         size <integer_cst 0x404f10e0 constant 8>
>         unit size <integer_cst 0x404f1100 constant 1>
>         align 8 symtab 0 alias set -1 canonical type 0x405158a0
>         arg-types <tree_list 0x405020d8 value <void_type 0x40508840 void>>
>         pointer_to_this <pointer_type 0x4089f900>>
>     addressable used public external QI file /usr/doxygen/src/doxygen.h line 146 col 6 align 8 context <translation_unit_decl 0x4051006c D.1>
>     full-name "void generateOutput()"
>     chain <function_decl 0x410d9e00 parseInput>>
>
> I am parsing the main function of Doxygen in main.cpp.
> It calls the global function generateOutput, which is defined and implemented in doxygen.h.
> GCC finds this function, as you can see in the debug_tree of the FUNCTION_DECL.
> But the TRANSLATION_UNIT_DECL of this function looks like it is 0.

OK, so the DECL_CONTEXT of your function is a TRANSLATION_UNIT_DECL,
and that TRANSLATION_UNIT_DECL appears to be empty.  But I don't know
why you are looking at DECL_CONTEXT anyhow--sorry I missed that
earlier.  The tree dump shows that your FUNCTION_DECL has
DECL_EXTERNAL set.  DECL_EXTERNAL means that this is an external
reference to a function defined elsewhere, as in "extern int f();".

Is this function defined in the code you are compiling?

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux