[cfe-commits] r81606 - in /cfe/trunk: clang.xcodeproj/project.pbxproj lib/CodeGen/CGCXX.cpp lib/CodeGen/CGExprScalar.cpp lib/CodeGen/CodeGenFunction.h

Anders Carlsson andersca at mac.com
Fri Sep 11 21:26:36 PDT 2009


Author: andersca
Date: Fri Sep 11 23:26:35 2009
New Revision: 81606

URL: http://llvm.org/viewvc/llvm-project?rev=81606&view=rev
Log:
Rename AddressCXXOfBaseClass to GetAddressCXXOfBaseClass. Add a NullCheckValue argument (currently unused).

Modified:
    cfe/trunk/clang.xcodeproj/project.pbxproj
    cfe/trunk/lib/CodeGen/CGCXX.cpp
    cfe/trunk/lib/CodeGen/CGExprScalar.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=81606&r1=81605&r2=81606&view=diff

==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Fri Sep 11 23:26:35 2009
@@ -362,7 +362,7 @@
 		1A32C17E0E1C87AD00A6B483 /* ExprConstant.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = ExprConstant.cpp; path = lib/AST/ExprConstant.cpp; sourceTree = "<group>"; tabWidth = 2; };
 		1A376A2C0D4AED9B002A1C52 /* CGExprConstant.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGExprConstant.cpp; path = lib/CodeGen/CGExprConstant.cpp; sourceTree = "<group>"; tabWidth = 2; };
 		1A471AB40F437BC500753CE8 /* CGBlocks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGBlocks.cpp; path = lib/CodeGen/CGBlocks.cpp; sourceTree = "<group>"; tabWidth = 2; };
-		1A4C41BE105B4C0B0047B5E7 /* CGCXXClass.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CGCXXClass.cpp; path = lib/CodeGen/CGCXXClass.cpp; sourceTree = "<group>"; };
+		1A4C41BE105B4C0B0047B5E7 /* CGCXXClass.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGCXXClass.cpp; path = lib/CodeGen/CGCXXClass.cpp; sourceTree = "<group>"; tabWidth = 2; };
 		1A5119C30FBDF71000A1FF22 /* SemaTemplateInstantiateStmt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = SemaTemplateInstantiateStmt.cpp; path = lib/Sema/SemaTemplateInstantiateStmt.cpp; sourceTree = "<group>"; tabWidth = 2; };
 		1A5D5E570E5E81010023C059 /* CGCXX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGCXX.cpp; path = lib/CodeGen/CGCXX.cpp; sourceTree = "<group>"; tabWidth = 2; };
 		1A649E1D0F9599D9005B965E /* CGBlocks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CGBlocks.h; path = lib/CodeGen/CGBlocks.h; sourceTree = "<group>"; };

Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=81606&r1=81605&r2=81606&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Fri Sep 11 23:26:35 2009
@@ -1498,8 +1498,10 @@
                         const CXXRecordDecl *ClassDecl,
                         const CXXRecordDecl *BaseClassDecl, QualType Ty) {
   if (ClassDecl) {
-    Dest = AddressCXXOfBaseClass(Dest, ClassDecl, BaseClassDecl);
-    Src = AddressCXXOfBaseClass(Src, ClassDecl, BaseClassDecl) ;
+    Dest = GetAddressCXXOfBaseClass(Dest, ClassDecl, BaseClassDecl,
+                                    /*NullCheckValue=*/false);
+    Src = GetAddressCXXOfBaseClass(Src, ClassDecl, BaseClassDecl,
+                                   /*NullCheckValue=*/false);
   }
   if (BaseClassDecl->hasTrivialCopyConstructor()) {
     EmitAggregateCopy(Dest, Src, Ty);
@@ -1535,8 +1537,10 @@
                                         const CXXRecordDecl *BaseClassDecl,
                                         QualType Ty) {
   if (ClassDecl) {
-    Dest = AddressCXXOfBaseClass(Dest, ClassDecl, BaseClassDecl);
-    Src = AddressCXXOfBaseClass(Src, ClassDecl, BaseClassDecl) ;
+    Dest = GetAddressCXXOfBaseClass(Dest, ClassDecl, BaseClassDecl,
+                                    /*NullCheckValue=*/false);
+    Src = GetAddressCXXOfBaseClass(Src, ClassDecl, BaseClassDecl,
+                                   /*NullCheckValue=*/false);
   }
   if (BaseClassDecl->hasTrivialCopyAssignment()) {
     EmitAggregateCopy(Dest, Src, Ty);
@@ -1774,8 +1778,9 @@
       Type *BaseType = Member->getBaseClass();
       CXXRecordDecl *BaseClassDecl =
         cast<CXXRecordDecl>(BaseType->getAs<RecordType>()->getDecl());
-      llvm::Value *V = AddressCXXOfBaseClass(LoadOfThis, ClassDecl,
-                                             BaseClassDecl);
+      llvm::Value *V = GetAddressCXXOfBaseClass(LoadOfThis, ClassDecl,
+                                                BaseClassDecl,
+                                                /*NullCheckValue=*/false);
       EmitCXXConstructorCall(Member->getConstructor(),
                              Ctor_Complete, V,
                              Member->const_arg_begin(),
@@ -1858,8 +1863,9 @@
       if (CXXConstructorDecl *BaseCX =
             BaseClassDecl->getDefaultConstructor(getContext())) {
         LoadOfThis = LoadCXXThis();
-        llvm::Value *V = AddressCXXOfBaseClass(LoadOfThis, ClassDecl,
-                                               BaseClassDecl);
+        llvm::Value *V = GetAddressCXXOfBaseClass(LoadOfThis, ClassDecl,
+                                                  BaseClassDecl,
+                                                  /*NullCheckValue=*/false);
         EmitCXXConstructorCall(BaseCX, Ctor_Complete, V, 0, 0);
       }
     }
@@ -1954,8 +1960,9 @@
       CXXRecordDecl *BaseClassDecl = cast<CXXRecordDecl>(RT->getDecl());
       if (BaseClassDecl->hasTrivialDestructor())
         continue;
-      llvm::Value *V = AddressCXXOfBaseClass(LoadCXXThis(),
-                                             ClassDecl,BaseClassDecl);
+      llvm::Value *V = GetAddressCXXOfBaseClass(LoadCXXThis(),
+                                                ClassDecl, BaseClassDecl,
+                                                /*NullCheckValue=*/false);
       EmitCXXDestructorCall(BaseClassDecl->getDestructor(getContext()),
                             Dtor_Complete, V);
     }
@@ -2022,8 +2029,9 @@
     return;
   for (int i = DestructedBases.size() -1; i >= 0; --i) {
     CXXRecordDecl *BaseClassDecl = DestructedBases[i];
-    llvm::Value *V = AddressCXXOfBaseClass(LoadCXXThis(),
-                                           ClassDecl,BaseClassDecl);
+    llvm::Value *V = GetAddressCXXOfBaseClass(LoadCXXThis(),
+                                              ClassDecl,BaseClassDecl, 
+                                              /*NullCheckValue=*/false);
     EmitCXXDestructorCall(BaseClassDecl->getDestructor(getContext()),
                           Dtor_Complete, V);
   }

Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=81606&r1=81605&r2=81606&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Fri Sep 11 23:26:35 2009
@@ -468,11 +468,13 @@
     // The source value may be an integer, or a pointer.
     if (isa<llvm::PointerType>(Src->getType())) {
       // Some heavy lifting for derived to base conversion.
+      // FIXME: This should be handled by EmitCast.
       if (const CXXRecordDecl *ClassDecl =
             SrcType->getCXXRecordDeclForPointerType())
         if (const CXXRecordDecl *BaseClassDecl =
               DstType->getCXXRecordDeclForPointerType())
-          Src = CGF.AddressCXXOfBaseClass(Src, ClassDecl, BaseClassDecl);
+          Src = CGF.GetAddressCXXOfBaseClass(Src, ClassDecl, BaseClassDecl,
+                                             /*NullCheckValue=*/false);
       return Builder.CreateBitCast(Src, DstTy, "conv");
     }
     assert(SrcType->isIntegerType() && "Not ptr->ptr or int->ptr conversion?");

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=81606&r1=81605&r2=81606&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Fri Sep 11 23:26:35 2009
@@ -573,13 +573,14 @@
   /// generating code for an C++ member function.
   llvm::Value *LoadCXXThis();
 
-  /// AddressCXXOfBaseClass - This function will add the necessary delta
+  /// GetAddressCXXOfBaseClass - This function will add the necessary delta
   /// to the load of 'this' and returns address of the base class.
   // FIXME. This currently only does a derived to non-virtual base conversion.
   // Other kinds of conversions will come later.
-  llvm::Value *AddressCXXOfBaseClass(llvm::Value *ThisValue,
-                                     const CXXRecordDecl *ClassDecl,
-                                     const CXXRecordDecl *BaseClassDecl);
+  llvm::Value *GetAddressCXXOfBaseClass(llvm::Value *BaseValue,
+                                        const CXXRecordDecl *ClassDecl,
+                                        const CXXRecordDecl *BaseClassDecl,
+                                        bool NullCheckValue);
 
   void EmitClassAggrMemberwiseCopy(llvm::Value *DestValue,
                                    llvm::Value *SrcValue,





More information about the cfe-commits mailing list