diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-01 02:35:44 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-01 02:35:44 +0000 |
commit | e5411b7c9af683dab6b035825b71c284bfec364d (patch) | |
tree | aee404b2be90afbb4386431f1180e4e654459df5 /lib/Sema/SemaDeclCXX.cpp | |
parent | 19c8ce0cf534caa909955ba9a17b7841f574a3be (diff) |
Consistently use 'needsImplicit<special member>' to determine whether we need
an implicit special member, rather than sometimes using '!hasDeclared<special
member>'. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169075 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 96dc1c9dee..f3a6fb5ab2 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -7342,7 +7342,7 @@ CXXDestructorDecl *Sema::DeclareImplicitDestructor(CXXRecordDecl *ClassDecl) { // If a class has no user-declared destructor, a destructor is // declared implicitly. An implicitly-declared destructor is an // inline public member of its class. - assert(!ClassDecl->hasDeclaredDestructor()); + assert(ClassDecl->needsImplicitDestructor()); DeclaringSpecialMember DSM(*this, ClassDecl, CXXDestructor); if (DSM.isAlreadyBeingDeclared()) @@ -7829,7 +7829,7 @@ CXXMethodDecl *Sema::DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl) { // constructor rules. Note that virtual bases are not taken into account // for determining the argument type of the operator. Note also that // operators taking an object instead of a reference are allowed. - assert(!ClassDecl->hasDeclaredCopyAssignment()); + assert(ClassDecl->needsImplicitCopyAssignment()); DeclaringSpecialMember DSM(*this, ClassDecl, CXXCopyAssignment); if (DSM.isAlreadyBeingDeclared()) @@ -8203,14 +8203,18 @@ hasMoveOrIsTriviallyCopyable(Sema &S, QualType Type, bool IsConstructor) { return true; if (IsConstructor) { + // FIXME: Need this because otherwise hasMoveConstructor isn't guaranteed to + // give the right answer. if (ClassDecl->needsImplicitMoveConstructor()) S.DeclareImplicitMoveConstructor(ClassDecl); - return ClassDecl->hasDeclaredMoveConstructor(); + return ClassDecl->hasMoveConstructor(); } + // FIXME: Need this because otherwise hasMoveAssignment isn't guaranteed to + // give the right answer. if (ClassDecl->needsImplicitMoveAssignment()) S.DeclareImplicitMoveAssignment(ClassDecl); - return ClassDecl->hasDeclaredMoveAssignment(); + return ClassDecl->hasMoveAssignment(); } /// Determine whether all non-static data members and direct or virtual bases @@ -8613,7 +8617,7 @@ CXXConstructorDecl *Sema::DeclareImplicitCopyConstructor( // C++ [class.copy]p4: // If the class definition does not explicitly declare a copy // constructor, one is declared implicitly. - assert(!ClassDecl->hasDeclaredCopyConstructor()); + assert(ClassDecl->needsImplicitCopyConstructor()); DeclaringSpecialMember DSM(*this, ClassDecl, CXXCopyConstructor); if (DSM.isAlreadyBeingDeclared()) |