]> granicus.if.org Git - clang/commitdiff
Eliminate the ASTContext argument to CXXConstructorDecl::isCopyConstructor, since...
authorDouglas Gregor <dgregor@apple.com>
Tue, 22 Dec 2009 00:34:07 +0000 (00:34 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 22 Dec 2009 00:34:07 +0000 (00:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91862 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclCXX.h
lib/AST/DeclCXX.cpp
lib/CodeGen/CGCXX.cpp
lib/CodeGen/CodeGenFunction.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaInit.cpp
lib/Sema/SemaOverload.cpp

index 5507e99e45a9cc2edbbf47873ee58e0661f3c17f..c1975505372b88ef1ee4387b07e313d26c0da5c2 100644 (file)
@@ -1178,14 +1178,14 @@ public:
   ///   X(const X&);
   /// };
   /// @endcode
-  bool isCopyConstructor(ASTContext &Context, unsigned &TypeQuals) const;
+  bool isCopyConstructor(unsigned &TypeQuals) const;
 
   /// isCopyConstructor - Whether this constructor is a copy
   /// constructor (C++ [class.copy]p2, which can be used to copy the
   /// class.
-  bool isCopyConstructor(ASTContext &Context) const {
+  bool isCopyConstructor() const {
     unsigned TypeQuals = 0;
-    return isCopyConstructor(Context, TypeQuals);
+    return isCopyConstructor(TypeQuals);
   }
 
   /// isConvertingConstructor - Whether this constructor is a
index 986b81c0f85b79f2e9cc89bfa7f9ea1499cb93a6..bbbb19a35b4a8460081c48c6a2edaa8226de746b 100644 (file)
@@ -164,8 +164,7 @@ CXXConstructorDecl *CXXRecordDecl::getCopyConstructor(ASTContext &Context,
     if (isa<FunctionTemplateDecl>(*Con))
       continue;
 
-    if (cast<CXXConstructorDecl>(*Con)->isCopyConstructor(Context,
-                                                          FoundTQs)) {
+    if (cast<CXXConstructorDecl>(*Con)->isCopyConstructor(FoundTQs)) {
       if (((TypeQuals & Qualifiers::Const) == (FoundTQs & Qualifiers::Const)) ||
           (!(TypeQuals & Qualifiers::Const) && (FoundTQs & Qualifiers::Const)))
         return cast<CXXConstructorDecl>(*Con);
@@ -246,7 +245,7 @@ CXXRecordDecl::addedConstructor(ASTContext &Context,
 
   // Note when we have a user-declared copy constructor, which will
   // suppress the implicit declaration of a copy constructor.
-  if (ConDecl->isCopyConstructor(Context)) {
+  if (ConDecl->isCopyConstructor()) {
     UserDeclaredCopyConstructor = true;
 
     // C++ [class.copy]p6:
@@ -757,8 +756,7 @@ bool CXXConstructorDecl::isDefaultConstructor() const {
 }
 
 bool
-CXXConstructorDecl::isCopyConstructor(ASTContext &Context,
-                                      unsigned &TypeQuals) const {
+CXXConstructorDecl::isCopyConstructor(unsigned &TypeQuals) const {
   // C++ [class.copy]p2:
   //   A non-template constructor for class X is a copy constructor
   //   if its first parameter is of type X&, const X&, volatile X& or
@@ -779,6 +777,8 @@ CXXConstructorDecl::isCopyConstructor(ASTContext &Context,
     return false;
 
   // Is it a reference to our class type?
+  ASTContext &Context = getASTContext();
+  
   CanQualType PointeeType
     = Context.getCanonicalType(ParamRefType->getPointeeType());
   CanQualType ClassTy 
index 0237a322a526eab0f87ccef1be9f17c13dbb9f49..edc899eb57f55b05945d7cfbe7c79e92750a0127 100644 (file)
@@ -508,7 +508,7 @@ CodeGenFunction::EmitCXXConstructorCall(const CXXConstructorDecl *D,
                                         llvm::Value *This,
                                         CallExpr::const_arg_iterator ArgBeg,
                                         CallExpr::const_arg_iterator ArgEnd) {
-  if (D->isCopyConstructor(getContext())) {
+  if (D->isCopyConstructor()) {
     const CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(D->getDeclContext());
     if (ClassDecl->hasTrivialCopyConstructor()) {
       assert(!ClassDecl->hasUserDeclaredCopyConstructor() &&
@@ -564,7 +564,7 @@ CodeGenFunction::EmitCXXConstructExpr(llvm::Value *Dest,
     getContext().getAsConstantArrayType(E->getType());
   // For a copy constructor, even if it is trivial, must fall thru so
   // its argument is code-gen'ed.
-  if (!CD->isCopyConstructor(getContext())) {
+  if (!CD->isCopyConstructor()) {
     QualType InitType = E->getType();
     if (Array)
       InitType = getContext().getBaseElementType(Array);
index 28df9e4d78613baeab85ecb5e198eb8cdd7a6d0a..f904f043caa48ef1bbaab613d4d98c9926f73b22 100644 (file)
@@ -331,7 +331,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD,
     if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(FD)) {
       // FIXME: For C++0x, we want to look for implicit *definitions* of
       // these special member functions, rather than implicit *declarations*.
-      if (CD->isCopyConstructor(getContext())) {
+      if (CD->isCopyConstructor()) {
         assert(!ClassDecl->hasUserDeclaredCopyConstructor() &&
                "Cannot synthesize a non-implicit copy constructor");
         SynthesizeCXXCopyConstructor(CD, GD.getCtorType(), Fn, Args);
index d83f8527486b292d7bfd8fc897d4959cee83e837..a1792651302aeb921ed1e62cdbdfedf1bb235f29 100644 (file)
@@ -800,7 +800,7 @@ static Sema::CXXSpecialMember getSpecialMember(ASTContext &Ctx,
   if (const CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(MD)) {
     if (Ctor->isDefaultConstructor())
       return Sema::CXXDefaultConstructor;
-    if (Ctor->isCopyConstructor(Ctx))
+    if (Ctor->isCopyConstructor())
       return Sema::CXXCopyConstructor;
   } 
   
index 7343e9f2e7381e7c93f3498621571ef78a9e3b21..1f3fbba629efbcebdca148e5db85f4752a0885f6 100644 (file)
@@ -3732,7 +3732,7 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
                                    CXXConstructorDecl *CopyConstructor,
                                    unsigned TypeQuals) {
   assert((CopyConstructor->isImplicit() &&
-          CopyConstructor->isCopyConstructor(Context, TypeQuals) &&
+          CopyConstructor->isCopyConstructor(TypeQuals) &&
           !CopyConstructor->isUsed()) &&
          "DefineImplicitCopyConstructor - call it for implicit copy ctor");
 
@@ -3784,7 +3784,7 @@ Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
   //   all, even if the class copy constructor or destructor have side effects.
 
   // FIXME: Is this enough?
-  if (Constructor->isCopyConstructor(Context)) {
+  if (Constructor->isCopyConstructor()) {
     Expr *E = ((Expr **)ExprArgs.get())[0];
     if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E))
       if (ICE->getCastKind() == CastExpr::CK_NoOp)
index f67a7a6bb9d9dc7cc6569014f16b709d1f439877..f8afd0f33e4f41a5c1de70682081732301b12795 100644 (file)
@@ -7011,7 +7011,7 @@ void Sema::MarkDeclarationReferenced(SourceLocation Loc, Decl *D) {
         if (!Constructor->isUsed())
           DefineImplicitDefaultConstructor(Loc, Constructor);
     } else if (Constructor->isImplicit() &&
-               Constructor->isCopyConstructor(Context, TypeQuals)) {
+               Constructor->isCopyConstructor(TypeQuals)) {
       if (!Constructor->isUsed())
         DefineImplicitCopyConstructor(Loc, Constructor, TypeQuals);
     }
index 2a27466a55ee7e45d148d8a55d3685d411f5b5b7..3ff2588356589460dc217df19568cd1b1e21d4d0 100644 (file)
@@ -3096,7 +3096,7 @@ static Sema::OwningExprResult CopyIfRequiredForEntity(Sema &S,
     // Find the constructor (which may be a template).
     CXXConstructorDecl *Constructor = dyn_cast<CXXConstructorDecl>(*Con);
     if (!Constructor || Constructor->isInvalidDecl() ||
-        !Constructor->isCopyConstructor(S.Context))
+        !Constructor->isCopyConstructor())
       continue;
     
     S.AddOverloadCandidate(Constructor, &CurInitExpr, 1, CandidateSet);
index 66aa4845b125b32dd31bded959cc6b4e7d89bf94..8236ad7eecb7a1c8c47ab7167b9e3adb381938f2 100644 (file)
@@ -451,7 +451,7 @@ Sema::TryImplicitConversion(Expr* From, QualType ToType,
       QualType FromCanon
         = Context.getCanonicalType(From->getType().getUnqualifiedType());
       QualType ToCanon = Context.getCanonicalType(ToType).getUnqualifiedType();
-      if (Constructor->isCopyConstructor(Context) &&
+      if (Constructor->isCopyConstructor() &&
           (FromCanon == ToCanon || IsDerivedFrom(FromCanon, ToCanon))) {
         // Turn this into a "standard" conversion sequence, so that it
         // gets ranked with standard conversion sequences.