From: Fariborz Jahanian Date: Tue, 23 Jun 2009 23:42:10 +0000 (+0000) Subject: Some changes to accomodate Doug's comment for X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=220a0f3412dad46d7dadf8b6042783016c029564;p=clang 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 --- 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(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(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(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(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(FieldClassType->getDecl()); if (CXXConstructorDecl *FieldCopyCtor = FieldClassDecl->getCopyConstructor(Context, TypeQuals)) - if (FieldCopyCtor->isImplicit() && !FieldCopyCtor->isUsed()) - MarkDeclarationReferenced(CurrentLocation, FieldCopyCtor); + MarkDeclarationReferenced(CurrentLocation, FieldCopyCtor); } } CopyConstructor->setUsed();