[cfe-commits] r107394 - in /cfe/trunk: include/clang/AST/DeclCXX.h lib/AST/DeclCXX.cpp lib/CodeGen/CGBlocks.cpp lib/CodeGen/CGCXX.cpp lib/CodeGen/CGClass.cpp lib/CodeGen/CGDecl.cpp lib/CodeGen/CGDeclCXX.cpp lib/CodeGen/CGException.cpp lib/CodeGen/CGExpr.cpp lib/CodeGen/CGExprCXX.cpp lib/CodeGen/CGObjC.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclCXX.cpp lib/Sema/SemaExprCXX.cpp lib/Sema/SemaInit.cpp

Douglas Gregor dgregor at apple.com
Thu Jul 1 07:13:13 PDT 2010


Author: dgregor
Date: Thu Jul  1 09:13:13 2010
New Revision: 107394

URL: http://llvm.org/viewvc/llvm-project?rev=107394&view=rev
Log:
Remove unnecessary ASTContext parameter from
CXXRecordDecl::getDestructor(); no functionality change.

Modified:
    cfe/trunk/include/clang/AST/DeclCXX.h
    cfe/trunk/lib/AST/DeclCXX.cpp
    cfe/trunk/lib/CodeGen/CGBlocks.cpp
    cfe/trunk/lib/CodeGen/CGCXX.cpp
    cfe/trunk/lib/CodeGen/CGClass.cpp
    cfe/trunk/lib/CodeGen/CGDecl.cpp
    cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
    cfe/trunk/lib/CodeGen/CGException.cpp
    cfe/trunk/lib/CodeGen/CGExpr.cpp
    cfe/trunk/lib/CodeGen/CGExprCXX.cpp
    cfe/trunk/lib/CodeGen/CGObjC.cpp
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/lib/Sema/SemaExprCXX.cpp
    cfe/trunk/lib/Sema/SemaInit.cpp

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=107394&r1=107393&r2=107394&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Thu Jul  1 09:13:13 2010
@@ -776,7 +776,7 @@
   CXXConstructorDecl *getDefaultConstructor(ASTContext &Context);
 
   /// getDestructor - Returns the destructor decl for this class.
-  CXXDestructorDecl *getDestructor(ASTContext &Context) const;
+  CXXDestructorDecl *getDestructor() const;
 
   /// isLocalClass - If the class is a local class [class.local], returns
   /// the enclosing function declaration.

Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=107394&r1=107393&r2=107394&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Thu Jul  1 09:13:13 2010
@@ -566,7 +566,8 @@
   return 0;
 }
 
-CXXDestructorDecl *CXXRecordDecl::getDestructor(ASTContext &Context) const {
+CXXDestructorDecl *CXXRecordDecl::getDestructor() const {
+  ASTContext &Context = getASTContext();
   QualType ClassType = Context.getTypeDeclType(this);
 
   DeclarationName Name

Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=107394&r1=107393&r2=107394&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Thu Jul  1 09:13:13 2010
@@ -372,8 +372,7 @@
               if (CXXRecordDecl *ClassDecl = 
                     dyn_cast<CXXRecordDecl>(RT->getDecl())) {
                 if (!ClassDecl->hasTrivialDestructor()) {
-                  const CXXDestructorDecl *D = 
-                    ClassDecl->getDestructor(getContext());
+                  const CXXDestructorDecl *D = ClassDecl->getDestructor();
                   assert(D && "BuildBlockLiteralTmp - destructor is nul");
                   {
                     // Normal destruction. 

Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=107394&r1=107393&r2=107394&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Thu Jul  1 09:13:13 2010
@@ -97,7 +97,7 @@
   /// If we don't have a definition for the destructor yet, don't
   /// emit.  We can't emit aliases to declarations; that's just not
   /// how aliases work.
-  const CXXDestructorDecl *BaseD = UniqueBase->getDestructor(getContext());
+  const CXXDestructorDecl *BaseD = UniqueBase->getDestructor();
   if (!BaseD->isImplicit() && !BaseD->getBody())
     return true;
 

Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=107394&r1=107393&r2=107394&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Thu Jul  1 09:13:13 2010
@@ -342,7 +342,7 @@
     // FIXME: Is this OK for C++0x delegating constructors?
     CodeGenFunction::EHCleanupBlock Cleanup(CGF);
 
-    CXXDestructorDecl *DD = BaseClassDecl->getDestructor(CGF.getContext());
+    CXXDestructorDecl *DD = BaseClassDecl->getDestructor();
     CGF.EmitCXXDestructorCall(DD, Dtor_Base, isBaseVirtual, V);
   }
 }
@@ -539,7 +539,7 @@
       llvm::Value *ThisPtr = CGF.LoadCXXThis();
       LValue LHS = CGF.EmitLValueForField(ThisPtr, Field, 0);
 
-      CXXDestructorDecl *DD = RD->getDestructor(CGF.getContext());
+      CXXDestructorDecl *DD = RD->getDestructor();
       CGF.EmitCXXDestructorCall(DD, Dtor_Complete, /*ForVirtualBase=*/false,
                                 LHS.getAddress());
     }
@@ -783,7 +783,7 @@
       // Ignore trivial destructors.
       if (BaseClassDecl->hasTrivialDestructor())
         continue;
-      const CXXDestructorDecl *D = BaseClassDecl->getDestructor(getContext());
+      const CXXDestructorDecl *D = BaseClassDecl->getDestructor();
       llvm::Value *V = 
         GetAddressOfDirectBaseInCompleteClass(LoadCXXThis(),
                                               ClassDecl, BaseClassDecl,
@@ -838,10 +838,10 @@
       BasePtr = llvm::PointerType::getUnqual(BasePtr);
       llvm::Value *BaseAddrPtr =
         Builder.CreateBitCast(LHS.getAddress(), BasePtr);
-      EmitCXXAggrDestructorCall(FieldClassDecl->getDestructor(getContext()),
+      EmitCXXAggrDestructorCall(FieldClassDecl->getDestructor(),
                                 Array, BaseAddrPtr);
     } else
-      EmitCXXDestructorCall(FieldClassDecl->getDestructor(getContext()),
+      EmitCXXDestructorCall(FieldClassDecl->getDestructor(),
                             Dtor_Complete, /*ForVirtualBase=*/false,
                             LHS.getAddress());
   }
@@ -862,7 +862,7 @@
     if (BaseClassDecl->hasTrivialDestructor())
       continue;
 
-    const CXXDestructorDecl *D = BaseClassDecl->getDestructor(getContext());    
+    const CXXDestructorDecl *D = BaseClassDecl->getDestructor();    
     llvm::Value *V = 
       GetAddressOfDirectBaseInCompleteClass(LoadCXXThis(), ClassDecl, 
                                             BaseClassDecl, 

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=107394&r1=107393&r2=107394&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Thu Jul  1 09:13:13 2010
@@ -678,7 +678,7 @@
           Loc = Builder.CreateStructGEP(DeclPtr, getByRefValueLLVMField(&D), 
                                         D.getNameAsString());
         
-        const CXXDestructorDecl *D = ClassDecl->getDestructor(getContext());
+        const CXXDestructorDecl *D = ClassDecl->getDestructor();
         assert(D && "EmitLocalBlockVarDecl - destructor is nul");
         
         if (const ConstantArrayType *Array = 

Modified: cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=107394&r1=107393&r2=107394&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDeclCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDeclCXX.cpp Thu Jul  1 09:13:13 2010
@@ -66,7 +66,7 @@
   if (RD->hasTrivialDestructor())
     return;
   
-  CXXDestructorDecl *Dtor = RD->getDestructor(Context);
+  CXXDestructorDecl *Dtor = RD->getDestructor();
   
   llvm::Constant *DtorFn;
   if (Array) {

Modified: cfe/trunk/lib/CodeGen/CGException.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=107394&r1=107393&r2=107394&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGException.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGException.cpp Thu Jul  1 09:13:13 2010
@@ -304,7 +304,7 @@
   if (const RecordType *RecordTy = ThrowType->getAs<RecordType>()) {
     CXXRecordDecl *Record = cast<CXXRecordDecl>(RecordTy->getDecl());
     if (!Record->hasTrivialDestructor()) {
-      CXXDestructorDecl *DtorD = Record->getDestructor(getContext());
+      CXXDestructorDecl *DtorD = Record->getDestructor();
       Dtor = CGM.GetAddrOfCXXDestructor(DtorD, Dtor_Complete);
       Dtor = llvm::ConstantExpr::getBitCast(Dtor, Int8PtrTy);
     }

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=107394&r1=107393&r2=107394&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Thu Jul  1 09:13:13 2010
@@ -275,7 +275,7 @@
       if (const RecordType *RT = E->getType()->getAs<RecordType>()) {
         CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(RT->getDecl());
         if (!ClassDecl->hasTrivialDestructor())
-          ReferenceTemporaryDtor = ClassDecl->getDestructor(CGF.getContext());
+          ReferenceTemporaryDtor = ClassDecl->getDestructor();
       }
     }
 

Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=107394&r1=107393&r2=107394&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Thu Jul  1 09:13:13 2010
@@ -829,7 +829,7 @@
   if (const RecordType *RT = DeleteTy->getAs<RecordType>()) {
     if (CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(RT->getDecl())) {
       if (!RD->hasTrivialDestructor()) {
-        const CXXDestructorDecl *Dtor = RD->getDestructor(getContext());
+        const CXXDestructorDecl *Dtor = RD->getDestructor();
         if (E->isArrayForm()) {
           llvm::Value *AllocatedObjectPtr;
           llvm::Value *NumElements;

Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=107394&r1=107393&r2=107394&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Thu Jul  1 09:13:13 2010
@@ -461,7 +461,7 @@
                                     LoadObjCSelf(), Ivar, 0);
       const RecordType *RT = FieldType->getAs<RecordType>();
       CXXRecordDecl *FieldClassDecl = cast<CXXRecordDecl>(RT->getDecl());
-      CXXDestructorDecl *Dtor = FieldClassDecl->getDestructor(getContext());
+      CXXDestructorDecl *Dtor = FieldClassDecl->getDestructor();
       if (!Dtor->isTrivial()) {
         if (Array) {
           const llvm::Type *BasePtr = ConvertType(FieldType);

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=107394&r1=107393&r2=107394&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Jul  1 09:13:13 2010
@@ -5951,7 +5951,7 @@
 
   case CXXDestructor:
     if (RD->hasUserDeclaredDestructor()) {
-      SourceLocation DtorLoc = RD->getDestructor(Context)->getLocation();
+      SourceLocation DtorLoc = RD->getDestructor()->getLocation();
       Diag(DtorLoc, diag::note_nontrivial_user_defined) << QT << member;
       return;
     }

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=107394&r1=107393&r2=107394&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Jul  1 09:13:13 2010
@@ -2230,7 +2230,7 @@
     if (FieldClassDecl->hasTrivialDestructor())
       continue;
 
-    CXXDestructorDecl *Dtor = FieldClassDecl->getDestructor(Context);
+    CXXDestructorDecl *Dtor = FieldClassDecl->getDestructor();
     CheckDestructorAccess(Field->getLocation(), Dtor,
                           PDiag(diag::err_access_dtor_field)
                             << Field->getDeclName()
@@ -2256,7 +2256,7 @@
     if (BaseClassDecl->hasTrivialDestructor())
       continue;
 
-    CXXDestructorDecl *Dtor = BaseClassDecl->getDestructor(Context);
+    CXXDestructorDecl *Dtor = BaseClassDecl->getDestructor();
 
     // FIXME: caret should be on the start of the class name
     CheckDestructorAccess(Base->getSourceRange().getBegin(), Dtor,
@@ -2283,7 +2283,7 @@
     if (BaseClassDecl->hasTrivialDestructor())
       continue;
 
-    CXXDestructorDecl *Dtor = BaseClassDecl->getDestructor(Context);
+    CXXDestructorDecl *Dtor = BaseClassDecl->getDestructor();
     CheckDestructorAccess(ClassDecl->getLocation(), Dtor,
                           PDiag(diag::err_access_dtor_vbase)
                             << VBase->getType());
@@ -2893,7 +2893,7 @@
          B != BEnd; ++B) {
       if (const RecordType *BaseType = B->getType()->getAs<RecordType>())
         ExceptSpec.CalledDecl(
-              cast<CXXRecordDecl>(BaseType->getDecl())->getDestructor(Context));
+                    cast<CXXRecordDecl>(BaseType->getDecl())->getDestructor());
     }
          
     // Virtual base-class destructors.
@@ -2902,7 +2902,7 @@
          B != BEnd; ++B) {
       if (const RecordType *BaseType = B->getType()->getAs<RecordType>())
         ExceptSpec.CalledDecl(
-              cast<CXXRecordDecl>(BaseType->getDecl())->getDestructor(Context));
+                    cast<CXXRecordDecl>(BaseType->getDecl())->getDestructor());
     }
 
     // Field destructors.
@@ -2912,7 +2912,7 @@
       if (const RecordType *RecordTy
                 = Context.getBaseElementType(F->getType())->getAs<RecordType>())
         ExceptSpec.CalledDecl(
-              cast<CXXRecordDecl>(RecordTy->getDecl())->getDestructor(Context));
+                    cast<CXXRecordDecl>(RecordTy->getDecl())->getDestructor());
     }
     
     QualType Ty = Context.getFunctionType(Context.VoidTy,
@@ -5057,7 +5057,7 @@
   CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(Record->getDecl());
   if (!ClassDecl->isInvalidDecl() && !VD->isInvalidDecl() &&
       !ClassDecl->hasTrivialDestructor() && !ClassDecl->isDependentContext()) {
-    CXXDestructorDecl *Destructor = ClassDecl->getDestructor(Context);
+    CXXDestructorDecl *Destructor = ClassDecl->getDestructor();
     MarkDeclarationReferenced(VD->getLocation(), Destructor);
     CheckDestructorAccess(VD->getLocation(), Destructor,
                           PDiag(diag::err_access_dtor_var)
@@ -6529,7 +6529,7 @@
                                                         ->getAs<RecordType>()) {
                     CXXRecordDecl *RD = cast<CXXRecordDecl>(RecordTy->getDecl());
         if (CXXDestructorDecl *Destructor
-              = const_cast<CXXDestructorDecl*>(RD->getDestructor(Context))) {
+                        = const_cast<CXXDestructorDecl*>(RD->getDestructor())) {
           MarkDeclarationReferenced(Field->getLocation(), Destructor);
           CheckDestructorAccess(Field->getLocation(), Destructor,
                             PDiag(diag::err_access_dtor_ivar)

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=107394&r1=107393&r2=107394&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Thu Jul  1 09:13:13 2010
@@ -473,8 +473,8 @@
   if (RD->hasTrivialDestructor())
     return false;
 
-  CXXDestructorDecl *Destructor =
-    const_cast<CXXDestructorDecl*>(RD->getDestructor(Context));
+  CXXDestructorDecl *Destructor 
+    = const_cast<CXXDestructorDecl*>(RD->getDestructor());
   if (!Destructor)
     return false;
 
@@ -1475,7 +1475,7 @@
         return ExprError();
       
       if (!RD->hasTrivialDestructor())
-        if (const CXXDestructorDecl *Dtor = RD->getDestructor(Context))
+        if (const CXXDestructorDecl *Dtor = RD->getDestructor())
           MarkDeclarationReferenced(StartLoc,
                                     const_cast<CXXDestructorDecl*>(Dtor));
     }
@@ -2639,11 +2639,10 @@
   if (RD->hasTrivialDestructor())
     return Owned(E);
 
-  CXXTemporary *Temp = CXXTemporary::Create(Context,
-                                            RD->getDestructor(Context));
+  CXXTemporary *Temp = CXXTemporary::Create(Context, RD->getDestructor());
   ExprTemporaries.push_back(Temp);
   if (CXXDestructorDecl *Destructor =
-        const_cast<CXXDestructorDecl*>(RD->getDestructor(Context))) {
+        const_cast<CXXDestructorDecl*>(RD->getDestructor())) {
     MarkDeclarationReferenced(E->getExprLoc(), Destructor);
     CheckDestructorAccess(E->getExprLoc(), Destructor,
                           PDiag(diag::err_access_dtor_temp)

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=107394&r1=107393&r2=107394&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Thu Jul  1 09:13:13 2010
@@ -3709,7 +3709,7 @@
         QualType T = CurInitExpr->getType();
         if (const RecordType *Record = T->getAs<RecordType>()) {
           CXXDestructorDecl *Destructor
-            = cast<CXXRecordDecl>(Record->getDecl())->getDestructor(S.Context);
+            = cast<CXXRecordDecl>(Record->getDecl())->getDestructor();
           S.CheckDestructorAccess(CurInitExpr->getLocStart(), Destructor, 
                                   S.PDiag(diag::err_access_dtor_temp) << T);
           S.MarkDeclarationReferenced(CurInitExpr->getLocStart(), Destructor);





More information about the cfe-commits mailing list