This is the mail archive of the gcc@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]

Re: How to determine if a decl is a class member in GCC


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@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


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