aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-01-07 19:46:03 +0000
committerDouglas Gregor <dgregor@apple.com>2009-01-07 19:46:03 +0000
commit6b3945f4bc757bdadd3e443180cf32c2cccb52a0 (patch)
treef5c67895a9e956ac2d92e869e8a4c5e28e2bb14d /lib/AST/Decl.cpp
parent39cbfaadbcd0008492fc1ea967b6cc1301a938a1 (diff)
Finished semantic analysis of anonymous unions in C++.
Duplicate-member checking within classes is still a little messy, and anonymous unions are still completely broken in C. We'll need to unify the handling of fields in C and C++ to make this code applicable in both languages. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61878 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r--lib/AST/Decl.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index bfe8a184e8..b3f19a25b8 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -97,6 +97,15 @@ FieldDecl *FieldDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
return new (Mem) FieldDecl(Decl::Field, DC, L, Id, T, BW, Mutable, PrevDecl);
}
+bool FieldDecl::isAnonymousStructOrUnion() const {
+ if (!isImplicit() || getDeclName())
+ return false;
+
+ if (const RecordType *Record = getType()->getAsRecordType())
+ return Record->getDecl()->isAnonymousStructOrUnion();
+
+ return false;
+}
EnumConstantDecl *EnumConstantDecl::Create(ASTContext &C, EnumDecl *CD,
SourceLocation L,