aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-06-23 23:42:10 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-06-23 23:42:10 +0000
commit220a0f3412dad46d7dadf8b6042783016c029564 (patch)
tree8b714a014607cc96d19eef5b475626f5000b28e6
parente542c862bdf9a9bcb4f468be8fa6561372430611 (diff)
Some changes to accomodate Doug's comment for
implicit copy constructor definition determination. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74025 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaDeclCXX.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index c9c662671c..f417cdfb9b 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -1890,10 +1890,8 @@ void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation,
= cast<CXXRecordDecl>(Base->getType()->getAsRecordType()->getDecl());
if (!BaseClassDecl->hasTrivialConstructor()) {
if (CXXConstructorDecl *BaseCtor =
- BaseClassDecl->getDefaultConstructor(Context)) {
- if (BaseCtor->isImplicit() && !BaseCtor->isUsed())
- MarkDeclarationReferenced(CurrentLocation, BaseCtor);
- }
+ BaseClassDecl->getDefaultConstructor(Context))
+ MarkDeclarationReferenced(CurrentLocation, BaseCtor);
else {
Diag(CurrentLocation, diag::err_defining_default_ctor)
<< Context.getTagDeclType(ClassDecl) << 1
@@ -1915,10 +1913,8 @@ void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation,
= cast<CXXRecordDecl>(FieldClassType->getDecl());
if (!FieldClassDecl->hasTrivialConstructor())
if (CXXConstructorDecl *FieldCtor =
- FieldClassDecl->getDefaultConstructor(Context)) {
- if (FieldCtor->isImplicit() && !FieldCtor->isUsed())
- MarkDeclarationReferenced(CurrentLocation, FieldCtor);
- }
+ FieldClassDecl->getDefaultConstructor(Context))
+ MarkDeclarationReferenced(CurrentLocation, FieldCtor);
else {
Diag(CurrentLocation, diag::err_defining_default_ctor)
<< Context.getTagDeclType(ClassDecl) << 0 <<
@@ -1956,6 +1952,7 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
CXXRecordDecl *ClassDecl
= cast<CXXRecordDecl>(CopyConstructor->getDeclContext());
assert(ClassDecl && "DefineImplicitCopyConstructor - invalid constructor");
+ // C++ [class.copy] p209
// Before the implicitly-declared copy constructor for a class is
// implicitly defined, all the implicitly-declared copy constructors
// for its base class and its non-static data members shall have been
@@ -1966,8 +1963,7 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
= cast<CXXRecordDecl>(Base->getType()->getAsRecordType()->getDecl());
if (CXXConstructorDecl *BaseCopyCtor =
BaseClassDecl->getCopyConstructor(Context, TypeQuals))
- if (BaseCopyCtor->isImplicit() && !BaseCopyCtor->isUsed())
- MarkDeclarationReferenced(CurrentLocation, BaseCopyCtor);
+ MarkDeclarationReferenced(CurrentLocation, BaseCopyCtor);
}
for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context);
Field != ClassDecl->field_end(Context);
@@ -1980,8 +1976,7 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
= cast<CXXRecordDecl>(FieldClassType->getDecl());
if (CXXConstructorDecl *FieldCopyCtor =
FieldClassDecl->getCopyConstructor(Context, TypeQuals))
- if (FieldCopyCtor->isImplicit() && !FieldCopyCtor->isUsed())
- MarkDeclarationReferenced(CurrentLocation, FieldCopyCtor);
+ MarkDeclarationReferenced(CurrentLocation, FieldCopyCtor);
}
}
CopyConstructor->setUsed();