[cfe-commits] r73650 - in /cfe/trunk/lib: AST/DeclCXX.cpp Sema/SemaDeclCXX.cpp

Fariborz Jahanian fjahanian at apple.com
Wed Jun 17 15:44:31 PDT 2009


Author: fjahanian
Date: Wed Jun 17 17:44:31 2009
New Revision: 73650

URL: http://llvm.org/viewvc/llvm-project?rev=73650&view=rev
Log:
Removed deadcode related to addition of constructor
decls to a class.

Modified:
    cfe/trunk/lib/AST/DeclCXX.cpp
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp

Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=73650&r1=73649&r2=73650&view=diff

==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Wed Jun 17 17:44:31 2009
@@ -128,36 +128,33 @@
 void
 CXXRecordDecl::addedConstructor(ASTContext &Context, 
                                 CXXConstructorDecl *ConDecl) {
-  if (!ConDecl->isImplicit()) {
-    // Note that we have a user-declared constructor.
-    UserDeclaredConstructor = true;
-
-    // C++ [dcl.init.aggr]p1: 
-    //   An aggregate is an array or a class (clause 9) with no
-    //   user-declared constructors (12.1) [...].
-    Aggregate = false;
-
-    // C++ [class]p4:
-    //   A POD-struct is an aggregate class [...]
-    PlainOldData = false;
-
-    // C++ [class.ctor]p5:
-    //   A constructor is trivial if it is an implicitly-declared default
-    //   constructor.
-    HasTrivialConstructor = false;
+  assert(!ConDecl->isImplicit() && "addedConstructor - not for implicit decl");
+  // Note that we have a user-declared constructor.
+  UserDeclaredConstructor = true;
+
+  // C++ [dcl.init.aggr]p1: 
+  //   An aggregate is an array or a class (clause 9) with no
+  //   user-declared constructors (12.1) [...].
+  Aggregate = false;
+
+  // C++ [class]p4:
+  //   A POD-struct is an aggregate class [...]
+  PlainOldData = false;
+
+  // C++ [class.ctor]p5:
+  //   A constructor is trivial if it is an implicitly-declared default
+  //   constructor.
+  HasTrivialConstructor = false;
     
-    // Note when we have a user-declared copy constructor, which will
-    // suppress the implicit declaration of a copy constructor.
-    if (ConDecl->isCopyConstructor(Context))
-      UserDeclaredCopyConstructor = true;
-  }
+  // Note when we have a user-declared copy constructor, which will
+  // suppress the implicit declaration of a copy constructor.
+  if (ConDecl->isCopyConstructor(Context))
+    UserDeclaredCopyConstructor = true;
 }
 
 void CXXRecordDecl::addedAssignmentOperator(ASTContext &Context,
                                             CXXMethodDecl *OpDecl) {
   // We're interested specifically in copy assignment operators.
-  // Unlike addedConstructor, this method is not called for implicit
-  // declarations.
   const FunctionProtoType *FnType = OpDecl->getType()->getAsFunctionProtoType();
   assert(FnType && "Overloaded operator has no proto function type.");
   assert(FnType->getNumArgs() == 1 && !FnType->isVariadic());

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=73650&r1=73649&r2=73650&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Jun 17 17:44:31 2009
@@ -1034,9 +1034,6 @@
     DefaultCon->setAccess(AS_public);
     DefaultCon->setImplicit();
     ClassDecl->addDecl(Context, DefaultCon);
-
-    // Notify the class that we've added a constructor.
-    ClassDecl->addedConstructor(Context, DefaultCon);
   }
 
   if (!ClassDecl->hasUserDeclaredCopyConstructor()) {
@@ -1113,8 +1110,6 @@
                                                  /*IdentifierInfo=*/0,
                                                  ArgType, VarDecl::None, 0);
     CopyConstructor->setParams(Context, &FromParam, 1);
-
-    ClassDecl->addedConstructor(Context, CopyConstructor);
     ClassDecl->addDecl(Context, CopyConstructor);
   }
 





More information about the cfe-commits mailing list