This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Obtaining a list of a function's aliases in GCC-4.7+


Hi all,
I'm starting the process of upgrading gcc-bridge's GCC plugin from
gcc-4.6 first to gcc-4.7 and possibly to gcc-4.8.

In moving to 4.7, the only thing I can't quite figure out is how to
obtain a list of aliases for a given function. For 4.6, this worked:

    struct cgraph_node *cgn = cgraph_node(cfun->decl);
    struct cgraph_node *n;
    for (n = cgn->same_body; n; n = n->next)
        json_string_value(IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(n->decl)));

I've managed to update this to the following for 4.7:

    struct cgraph_node *cgn = cgraph_get_node(cfun->decl);
    struct cgraph_node *n;

    FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(n)
        if(cgraph_alias_aliased_node(n) == cgn) {
            if(DECL_ASSEMBLER_NAME_SET_P(n->decl)) {

json_string_value(IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(n->decl)));
            }
        }

But the expression DECL_ASSEMBLER_NAME(n->decl) leads to a segfault.

I think I must be misunderstanding something critical here. Is the
call graph still the best place to find a function's aliases? Is
DECL_ASSEMBLER_NAME_SET_P the wrong predicate?

Many thanks for any pointers!!

Alex


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]