diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-08-11 18:49:54 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-08-11 18:49:54 +0000 |
commit | e64941280877d065a27e8cefd2a9038256d0e3ac (patch) | |
tree | eb1f5ece8bd53df7f0ac1d689f4e7a21debd6c59 /include/clang | |
parent | b2fedb46056accb808d42c1754031b9bfa6aa69b (diff) |
ir-gen support for anonymous union data member
copying in copy constructors and used in
default constructor's initializer list.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78700 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/AST/DeclCXX.h | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h index 00e583fa6e..4ca9a8222e 100644 --- a/include/clang/AST/DeclCXX.h +++ b/include/clang/AST/DeclCXX.h @@ -779,9 +779,28 @@ class CXXBaseOrMemberInitializer { Stmt **Args; unsigned NumArgs; - /// CtorToCall - For a base or member needing a constructor for their - /// initialization, this is the constructor to call. - CXXConstructorDecl *CtorToCall; + union { + /// CtorToCall - For a base or member needing a constructor for their + /// initialization, this is the constructor to call. + CXXConstructorDecl *CtorToCall; + + /// AnonUnionMember - When 'BaseOrMember' is class's anonymous union + /// data member, this field holds the FieldDecl for the member of the + /// anonymous union being initialized. + /// @code + /// struct X { + /// X() : au_i1(123) {} + /// union { + /// int au_i1; + /// float au_f1; + /// }; + /// }; + /// @endcode + /// In above example, BaseOrMember holds the field decl. for anonymous union + /// and AnonUnionMember holds field decl for au_i1. + /// + FieldDecl *AnonUnionMember; + }; /// IdLoc - Location of the id in ctor-initializer list. SourceLocation IdLoc; @@ -854,6 +873,17 @@ public: return 0; } + void setMember(FieldDecl * anonUnionField) { + BaseOrMember = reinterpret_cast<uintptr_t>(anonUnionField); + } + + FieldDecl *getAnonUnionMember() const { + return AnonUnionMember; + } + void setAnonUnionMember(FieldDecl *anonMember) { + AnonUnionMember = anonMember; + } + const CXXConstructorDecl *getConstructor() const { return CtorToCall; } SourceLocation getSourceLocation() const { return IdLoc; } |