How to get field name/array index of a init list expression?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to get field name/array index of a init list expression?

Tom Stellard via cfe-dev
Say I have code below:

char *init[] = {
    "string1", "string2"
}

When I visit expression StringLiteral "string1", I need something like "init[0]".

struct _thestruct {
    char str[20];
    int foo;
};

_thestruct var[] = { {"string1", 2},  {"string2", 3} };

When I visit expression StringLiteral "string2", I need "var[1].str".

How do I implement this?

Thanks.

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev