22 Jul 21:34
Re: How to determine if a decl is a class member in GCC
From: Benjamin Smedberg <bsmedberg <at> mozilla.com>
Subject: Re: How to determine if a decl is a class member in GCC
Newsgroups: gmane.comp.gcc.devel
Date: 2008-07-22 19:34:55 GMT
Subject: Re: How to determine if a decl is a class member in GCC
Newsgroups: gmane.comp.gcc.devel
Date: 2008-07-22 19:34:55 GMT
Le-Chun Wu wrote:
> Hi,
>
> I haven't heard anything back on my questions. Can any of C++ frontend
> maintainers please shed some light (or comment on my proposed patch)?
> Thanks a lot.
>
> Le-chun
>
> On Fri, Jul 18, 2008 at 10:22 AM, Le-Chun Wu <lcwu <at> google.com> wrote:
>> Hi,
>>
>> In my attribute handlers that handle the new thread-safety attributes
>> (in c-common.c), I need to check if a decl is a class member. How do
>> people do that? My original code was checking if a decl is a
>> FIELD_DECL but that doesn't work for static members. I also tried to
>> use DECL_CONTEXT but it is not set (in the C++ front-end) for data
>> members. (I was able to use DECL_CONTEXT for member functions,
>> though.) Is there any other way that I should use?
I created a simple testcase for treehydra and it seems that DECL_CONTEXT was
set and correct for all of the following in 4.3.0:
struct A {
int a;
int f();
static int sa;
static int sf();
};
Are you saying that you don't see a proper DECL_CONTEXT for "a" and "sa"?
--BDS
RSS Feed