Getting strcut member attributes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting strcut member attributes

Raghavendra K

Hi,

I need a help,

#define OPT
#define MAN

struct A
{
   int i;
   char* c;
 };


struct B
{
  OPT A a;
  MAN int i;
};

After parsing the above .h file,   how to get the attributes of B members specifically
for member A which is prefixed with OPT...

So far am able to get type of a as A but unable to OPT...as it might be preprocessed and as it is empty
it may discarded or...



regards
ragha
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Getting strcut member attributes

Duncan Sands
Hi ragha, as this is a clang question I suggest you ask on the clang mailing
list.

Best wishes, Duncan.

On 10/07/13 16:50, Raghavendra K wrote:

>
> Hi,
>
> I need a help,
>
> #define OPT
> #define MAN
>
> struct A
> {
>     int i;
>     char* c;
>   };
>
>
> struct B
> {
>    OPT A a;
>    MAN int i;
> };
>
> After parsing the above .h file,   how to get the attributes of B members specifically
> for member A which is prefixed with OPT...
>
> So far am able to get type of a as A but unable to OPT...as it might be preprocessed and as it is empty
> it may discarded or...
>
>
>
> regards
> ragha
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Getting strcut member attributes

Raghavendra K
In reply to this post by Raghavendra K

Hi,

I need a help,

#define OPT
#define MAN

struct A
{
   int i;
   char* c;
 };


struct B
{
  OPT A a;
  MAN int i;
};

After parsing the above .h file,   how to get the attributes of B members specifically
for member A which is prefixed with OPT...

So far am able to get type of a as A but unable to OPT...as it might be preprocessed and as it is empty
it may discarded or...



regards
ragha
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Getting strcut member attributes

Sebastian Redl
On 2013-07-11 10:40, Raghavendra K wrote:

> #define OPT
> #define MAN
>
> struct A
> {
>     int i;
>     char* c;
>   };
>
>
> struct B
> {
>    OPT A a;
>    MAN int i;
> };
>
> After parsing the above .h file,   how to get the attributes of B members specifically
> for member A which is prefixed with OPT...
>
> So far am able to get type of a as A but unable to OPT...as it might be preprocessed and as it is empty
> it may discarded or...
>
Are you talking about Clang's AST (in which case you should ask your
question on cfe-dev, not here) or IR?
In either case, empty preprocessor defines are gone. There's no way to
recover them. Instead, define OPT and MAN to be something like
__attribute__((annotate("opt"))), which will be preserved.

Sebastian
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev