// 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()) {
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())
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
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,
// 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);
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);
-}
/// 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,
// 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