]> granicus.if.org Git - clang/commitdiff
Make it so that we actually generate definitions for explicitly
authorSean Hunt <scshunt@csclub.uwaterloo.ca>
Thu, 12 May 2011 03:51:51 +0000 (03:51 +0000)
committerSean Hunt <scshunt@csclub.uwaterloo.ca>
Thu, 12 May 2011 03:51:51 +0000 (03:51 +0000)
defaulted default constructors.

As it happens, making sure that we handle out-of-line defaulted
functions properly will involved making sure that we actually parse them
correctly, so that's coming after.

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

lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaInit.cpp

index 8ef3463f424fd768d494525749ea904647fbf726..13e2819f7bdd58c4a6f6fa580b2152e079199326 100644 (file)
@@ -5263,6 +5263,7 @@ CXXConstructorDecl *Sema::DeclareImplicitDefaultConstructor(
                                  /*isInline=*/true,
                                  /*isImplicitlyDeclared=*/true);
   DefaultCon->setAccess(AS_public);
+  DefaultCon->setDefaulted();
   DefaultCon->setImplicit();
   DefaultCon->setTrivial(ClassDecl->hasTrivialDefaultConstructor());
   
@@ -5283,7 +5284,7 @@ CXXConstructorDecl *Sema::DeclareImplicitDefaultConstructor(
 
 void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation,
                                             CXXConstructorDecl *Constructor) {
-  assert((Constructor->isImplicit() && Constructor->isDefaultConstructor() &&
+  assert((Constructor->isDefaulted() && Constructor->isDefaultConstructor() &&
           !Constructor->isUsed(false) && !Constructor->isDeleted()) &&
     "DefineImplicitDefaultConstructor - call it for implicit default ctor");
 
index 1597152b6ce6a1b4b18bd1f3109f644149ac9558..e2426952b2d19ce225ad7edce771ae884d07ea94 100644 (file)
@@ -9853,8 +9853,8 @@ void Sema::MarkDeclarationReferenced(SourceLocation Loc, Decl *D) {
   // Note that this declaration has been used.
   if (CXXConstructorDecl *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
     unsigned TypeQuals;
-    if (Constructor->isImplicit() && Constructor->isDefaultConstructor()) {
-      if (Constructor->getParent()->hasTrivialDefaultConstructor())
+    if (Constructor->isDefaulted() && Constructor->isDefaultConstructor()) {
+      if (Constructor->isTrivial())
         return;
       if (!Constructor->isUsed(false))
         DefineImplicitDefaultConstructor(Loc, Constructor);
index be3cd34f75d04cd593f860df68590bb5970c414b..26d030419a2212622aa5d369a8836103e5900bfd 100644 (file)
@@ -4019,7 +4019,7 @@ InitializationSequence::Perform(Sema &S,
         // the definition for completely trivial constructors.
         CXXRecordDecl *ClassDecl = Constructor->getParent();
         assert(ClassDecl && "No parent class for constructor.");
-        if (Constructor->isImplicit() && Constructor->isDefaultConstructor() &&
+        if (Constructor->isDefaulted() && Constructor->isDefaultConstructor() &&
             ClassDecl->hasTrivialDefaultConstructor() &&
             !Constructor->isUsed(false))
           S.DefineImplicitDefaultConstructor(Loc, Constructor);