summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.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
commitf4d332797bdbcba64b182b0438aa7ae4c5657dd0 (patch)
treef74614310058867f5c1457a59d0770647974c652 /clang/lib/Sema/SemaDeclCXX.cpp
parent289f59f233fe05d609c37a5e41c4171d0deb15de (diff)
downloadbcm5719-llvm-f4d332797bdbcba64b182b0438aa7ae4c5657dd0.tar.gz
bcm5719-llvm-f4d332797bdbcba64b182b0438aa7ae4c5657dd0.zip
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. llvm-svn: 61878
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 19582c0d798..c5e5aa2f3d2 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -427,9 +427,12 @@ void Sema::ActOnStartCXXClassDef(Scope *S, DeclTy *D, SourceLocation LBrace) {
// class itself; this is known as the injected-class-name. For
// purposes of access checking, the injected-class-name is treated
// as if it were a public member name.
- PushOnScopeChains(CXXRecordDecl::Create(Context, Dcl->getTagKind(),
- CurContext, Dcl->getLocation(),
- Dcl->getIdentifier(), Dcl), S);
+ RecordDecl *InjectedClassName
+ = CXXRecordDecl::Create(Context, Dcl->getTagKind(),
+ CurContext, Dcl->getLocation(),
+ Dcl->getIdentifier(), Dcl);
+ InjectedClassName->setImplicit();
+ PushOnScopeChains(InjectedClassName, S);
}
}
@@ -789,6 +792,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
/*isInline=*/true,
/*isImplicitlyDeclared=*/true);
DefaultCon->setAccess(AS_public);
+ DefaultCon->setImplicit();
ClassDecl->addDecl(Context, DefaultCon);
// Notify the class that we've added a constructor.
@@ -860,6 +864,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
/*isInline=*/true,
/*isImplicitlyDeclared=*/true);
CopyConstructor->setAccess(AS_public);
+ CopyConstructor->setImplicit();
// Add the parameter to the constructor.
ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyConstructor,
@@ -936,6 +941,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
false, 0),
/*isStatic=*/false, /*isInline=*/true, 0);
CopyAssignment->setAccess(AS_public);
+ CopyAssignment->setImplicit();
// Add the parameter to the operator.
ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyAssignment,
@@ -964,6 +970,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
/*isInline=*/true,
/*isImplicitlyDeclared=*/true);
Destructor->setAccess(AS_public);
+ Destructor->setImplicit();
ClassDecl->addDecl(Context, Destructor);
}
}
OpenPOWER on IntegriCloud