aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGRtti.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CGRtti.cpp')
-rw-r--r--lib/CodeGen/CGRtti.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/CodeGen/CGRtti.cpp b/lib/CodeGen/CGRtti.cpp
index 7bc774fce75b..7af15f0a8ca4 100644
--- a/lib/CodeGen/CGRtti.cpp
+++ b/lib/CodeGen/CGRtti.cpp
@@ -16,32 +16,31 @@ using namespace clang;
using namespace CodeGen;
llvm::Constant *CodeGenModule::GenerateRtti(const CXXRecordDecl *RD) {
- llvm::Type *Ptr8Ty;
- Ptr8Ty = llvm::PointerType::get(llvm::Type::getInt8Ty(VMContext), 0);
- llvm::Constant *Rtti = llvm::Constant::getNullValue(Ptr8Ty);
+ const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(VMContext);
if (!getContext().getLangOptions().Rtti)
- return Rtti;
+ return llvm::Constant::getNullValue(Int8PtrTy);
llvm::SmallString<256> OutName;
llvm::raw_svector_ostream Out(OutName);
- mangleCXXRtti(getMangleContext(), RD, Out);
+ mangleCXXRtti(getMangleContext(), Context.getTagDeclType(RD), Out);
llvm::GlobalVariable::LinkageTypes linktype;
linktype = llvm::GlobalValue::WeakAnyLinkage;
std::vector<llvm::Constant *> info;
// assert(0 && "FIXME: implement rtti descriptor");
// FIXME: descriptor
- info.push_back(llvm::Constant::getNullValue(Ptr8Ty));
+ info.push_back(llvm::Constant::getNullValue(Int8PtrTy));
// assert(0 && "FIXME: implement rtti ts");
// FIXME: TS
- info.push_back(llvm::Constant::getNullValue(Ptr8Ty));
+ info.push_back(llvm::Constant::getNullValue(Int8PtrTy));
llvm::Constant *C;
- llvm::ArrayType *type = llvm::ArrayType::get(Ptr8Ty, info.size());
+ llvm::ArrayType *type = llvm::ArrayType::get(Int8PtrTy, info.size());
C = llvm::ConstantArray::get(type, info);
- Rtti = new llvm::GlobalVariable(getModule(), type, true, linktype, C,
- Out.str());
- Rtti = llvm::ConstantExpr::getBitCast(Rtti, Ptr8Ty);
+ llvm::Constant *Rtti =
+ new llvm::GlobalVariable(getModule(), type, true, linktype, C,
+ Out.str());
+ Rtti = llvm::ConstantExpr::getBitCast(Rtti, Int8PtrTy);
return Rtti;
}