Re: Plugin: global vs global static in c/c++ AST representation

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

 



On Thu, May 23, 2013 at 9:47 PM, gcc frickler
<gccfrickler@xxxxxxxxxxxxxxxx> wrote:
> Hi,
> does anybody know how to distinguish a global from a global static
> variable while walking the AST in the plugin?
>
> eg.
> int glob;
> static int moduleGlob;
> void f() {static int inner;}
>
> All of them go into the bss segment but the static int moduleGlob is
> exported with a mangled name to a .so (so it doesn't conflict at link time)
>
>
> It does not seem to be a attribute of a VAR_DECL
> The static predicate in the bitfield is just saying it goes in the bss
> segment (true in all of the above cases) and has got nothing to do with
> the static keyword which just controls visibility on link time.
>
> At which pass should this be examined?

The name is handled entirely in the frontend.  I don't think there is
anything in the tree structure that tells you that the variable got a
mangled name.  That kind of information is C++ frontend specific.

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