]> granicus.if.org Git - clang/commitdiff
Use GetAddrOfRTTI everywhere and remove GenerateRTTI and GenerateRTTIRef. With this...
authorAnders Carlsson <andersca@mac.com>
Wed, 16 Dec 2009 07:05:41 +0000 (07:05 +0000)
committerAnders Carlsson <andersca@mac.com>
Wed, 16 Dec 2009 07:05:41 +0000 (07:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91520 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGException.cpp
lib/CodeGen/CGExprCXX.cpp
lib/CodeGen/CGRTTI.cpp
lib/CodeGen/CodeGenModule.h
test/CodeGenCXX/dyncast.cpp

index b15b2e9b3b0f988840c4d2400a33d8edbac9d169..c66bb46bd8c5687f8db82b85a053469481916082 100644 (file)
@@ -264,7 +264,7 @@ void CodeGenFunction::EmitCXXThrowExpr(const CXXThrowExpr *E) {
 
   // Now throw the exception.
   const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(getLLVMContext());
-  llvm::Constant *TypeInfo = CGM.GenerateRTTI(ThrowType);
+  llvm::Constant *TypeInfo = CGM.GetAddrOfRTTI(ThrowType);
   llvm::Constant *Dtor = llvm::Constant::getNullValue(Int8PtrTy);
 
   if (getInvokeDest()) {
@@ -347,8 +347,7 @@ void CodeGenFunction::EmitStartEHSpec(const Decl *D) {
 
   for (unsigned i = 0; i < Proto->getNumExceptions(); ++i) {
     QualType Ty = Proto->getExceptionType(i);
-    llvm::Value *EHType
-      = CGM.GenerateRTTI(Ty.getNonReferenceType());
+    llvm::Value *EHType = CGM.GetAddrOfRTTI(Ty.getNonReferenceType());
     SelectorArgs.push_back(EHType);
   }
   if (Proto->getNumExceptions())
@@ -487,8 +486,8 @@ void CodeGenFunction::EmitCXXTryStmt(const CXXTryStmt &S) {
     const CXXCatchStmt *C = S.getHandler(i);
     VarDecl *CatchParam = C->getExceptionDecl();
     if (CatchParam) {
-      llvm::Value *EHType
-        = CGM.GenerateRTTI(C->getCaughtType().getNonReferenceType());
+      llvm::Value *EHType 
+        = CGM.GetAddrOfRTTI(C->getCaughtType().getNonReferenceType());
       SelectorArgs.push_back(EHType);
     } else {
       // null indicates catch all
index 150f11ebf5753c46b83582b9d534c67633219829..7f827ccd8edc910eabb696f30e0c25e03ae26f45 100644 (file)
@@ -469,9 +469,9 @@ llvm::Value * CodeGenFunction::EmitCXXTypeidExpr(const CXXTypeidExpr *E) {
       V = Builder.CreateLoad(V);
       return V;
     }      
-    return Builder.CreateBitCast(CGM.GenerateRTTI(RD), LTy);
+    return Builder.CreateBitCast(CGM.GetAddrOfRTTI(RD), LTy);
   }
-  return Builder.CreateBitCast(CGM.GenerateRTTI(Ty), LTy);
+  return Builder.CreateBitCast(CGM.GetAddrOfRTTI(Ty), LTy);
 }
 
 llvm::Value *CodeGenFunction::EmitDynamicCast(llvm::Value *V,
@@ -550,8 +550,8 @@ llvm::Value *CodeGenFunction::EmitDynamicCast(llvm::Value *V,
 
     // FIXME: Calculate better hint.
     llvm::Value *hint = llvm::ConstantInt::get(PtrDiffTy, -1ULL);
-    llvm::Value *SrcArg = CGM.GenerateRTTIRef(SrcTy);
-    llvm::Value *DstArg = CGM.GenerateRTTIRef(DstTy);
+    llvm::Value *SrcArg = CGM.GetAddrOfRTTI(SrcTy);
+    llvm::Value *DstArg = CGM.GetAddrOfRTTI(DstTy);
     V = Builder.CreateBitCast(V, PtrToInt8Ty);
     V = Builder.CreateCall4(CGM.CreateRuntimeFunction(FTy, "__dynamic_cast"),
                             V, SrcArg, DstArg, hint);
index 02de00e3d7da020af5e346f668ca55b8df95446a..4b7814bdb0eff1bfdf5f6d3ef7a3f4eee5184662 100644 (file)
@@ -485,21 +485,3 @@ llvm::Constant *CodeGenModule::GetAddrOfRTTI(QualType Ty) {
   
   return RTTIBuilder(*this).BuildType(Ty);
 }
-
-llvm::Constant *CodeGenModule::GenerateRTTIRef(const CXXRecordDecl *RD) {
-  RTTIBuilder b(*this);
-
-  return b.Buildclass_type_infoRef(RD);
-}
-
-llvm::Constant *CodeGenModule::GenerateRTTI(const CXXRecordDecl *RD) {
-  RTTIBuilder b(*this);
-
-  return b.Buildclass_type_info(RD, llvm::GlobalValue::ExternalLinkage);
-}
-
-llvm::Constant *CodeGenModule::GenerateRTTI(QualType Ty) {
-  RTTIBuilder b(*this);
-
-  return b.BuildType(Ty);
-}
index cc7ec9c301602261ec2e834f6ee69f3d1566549e..20c71dc89b8abcd4c6f410a987e4652561d853af 100644 (file)
@@ -219,17 +219,6 @@ public:
   /// decl.
   llvm::Constant *GetAddrOfRTTI(const CXXRecordDecl *RD);
 
-  /// GenerateRTTI - Generate the rtti information for the given type.
-  llvm::Constant *GenerateRTTI(const CXXRecordDecl *RD);
-  
-  /// GenerateRTTIRef - Generate a reference to the rtti information for the
-  /// given type.
-  llvm::Constant *GenerateRTTIRef(const CXXRecordDecl *RD);
-  
-  /// GenerateRTTI - Generate the rtti information for the given
-  /// non-class type.
-  llvm::Constant *GenerateRTTI(QualType Ty);
-  
   llvm::Constant *GetAddrOfThunk(GlobalDecl GD,
                                  const ThunkAdjustment &ThisAdjustment);
   llvm::Constant *GetAddrOfCovariantThunk(GlobalDecl GD,
index 50887b10007515f60cdc9361ab7d214378b2ccfe..a2d116a898726f992f2c6bb199709fdc218290b9 100644 (file)
@@ -97,7 +97,7 @@ void test1() {
 // CHECK-LL-NEXT:  br i1 %4, label %5, label %9
 // CHECK-LL:       ; <label>:5
 // CHECK-LL-NEXT:  %6 = bitcast %class.test1_A* %tmp to i8*
-// CHECK-LL-NEXT:  %7 = call i8* @__dynamic_cast(i8* %6, i8* bitcast ({{.*}} @_ZTI7test1_B to i8*), i8* bitcast (i8** @_ZTI7test1_D to i8*), i64 -1)
+// CHECK-LL-NEXT:  %7 = call i8* @__dynamic_cast(i8* %6, i8* bitcast (%0* @_ZTI7test1_B to i8*), i8* bitcast (%1* @_ZTI7test1_D to i8*), i64 -1) ; <i8*> [#uses=1]
 // CHECK-LL-NEXT:  %8 = bitcast i8* %7 to %class.test1_D*
 // CHECK-LL-NEXT:  br label %10
 // CHECK-LL:       ; <label>:9