]> granicus.if.org Git - clang/commitdiff
Use marginally more appropriate functions to detect if we should declare an
authorRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 13 May 2016 18:48:05 +0000 (18:48 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 13 May 2016 18:48:05 +0000 (18:48 +0000)
implicit copy constructor/assignment, and other minor cleanups. No
functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269457 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaLookup.cpp

index 96c47e29ef3632e8e77d4f2c3682677c4d72f140..ee81bbc2872af30b3db0c92310c1293c3adffa07 100644 (file)
@@ -6463,7 +6463,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
       ClassDecl->hasInheritedConstructor())
     DeclareImplicitDefaultConstructor(ClassDecl);
 
-  if (!ClassDecl->hasUserDeclaredCopyConstructor()) {
+  if (ClassDecl->needsImplicitCopyConstructor()) {
     ++ASTContext::NumImplicitCopyConstructors;
 
     // If the properties or semantics of the copy constructor couldn't be
@@ -6482,7 +6482,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
       DeclareImplicitMoveConstructor(ClassDecl);
   }
 
-  if (!ClassDecl->hasUserDeclaredCopyAssignment()) {
+  if (ClassDecl->needsImplicitCopyAssignment()) {
     ++ASTContext::NumImplicitCopyAssignmentOperators;
 
     // If we have a dynamic class, then the copy assignment operator may be
@@ -6505,7 +6505,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
       DeclareImplicitMoveAssignment(ClassDecl);
   }
 
-  if (!ClassDecl->hasUserDeclaredDestructor()) {
+  if (ClassDecl->needsImplicitDestructor()) {
     ++ASTContext::NumImplicitDestructors;
 
     // If we have a dynamic class, then the destructor may be virtual, so we
@@ -8946,6 +8946,7 @@ void Sema::CheckImplicitSpecialMemberDeclaration(Scope *S, FunctionDecl *FD) {
     if (auto *Acceptable = R.getAcceptableDecl(D))
       R.addDecl(Acceptable);
   R.resolveKind();
+  R.suppressDiagnostics();
 
   CheckFunctionDeclaration(S, FD, R, /*IsExplicitSpecialization*/false);
 }
index 75d9eecf563015e227a9df583adc00d0a16fd85b..647055f5f0845dfff5c6115d011071aaa59ac44a 100644 (file)
@@ -738,11 +738,11 @@ void Sema::ForceDeclarationOfImplicitMembers(CXXRecordDecl *Class) {
   if (getLangOpts().CPlusPlus11) {
     // If the move constructor has not yet been declared, do so now.
     if (Class->needsImplicitMoveConstructor())
-      DeclareImplicitMoveConstructor(Class); // might not actually do it
+      DeclareImplicitMoveConstructor(Class);
 
     // If the move assignment operator has not yet been declared, do so now.
     if (Class->needsImplicitMoveAssignment())
-      DeclareImplicitMoveAssignment(Class); // might not actually do it
+      DeclareImplicitMoveAssignment(Class);
   }
 
   // If the destructor has not yet been declared, do so now.