diff options
author | Anders Carlsson <andersca@mac.com> | 2009-12-05 21:09:05 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-12-05 21:09:05 +0000 |
commit | e40477cd57d5297ff5e4cc5e4515744c42a96ce2 (patch) | |
tree | 98ca34050a66a9d9b033f7066b1147aa53564385 /lib/CodeGen/CGVtable.cpp | |
parent | 9ac95b99acf6b4e1f54fe70e02cbb0d3c72f9f2d (diff) |
Make sure that hte vtable always has an i8* array type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90675 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVtable.cpp')
-rw-r--r-- | lib/CodeGen/CGVtable.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp index 2fca7a75f9..8bf940b40c 100644 --- a/lib/CodeGen/CGVtable.cpp +++ b/lib/CodeGen/CGVtable.cpp @@ -1130,21 +1130,20 @@ llvm::Constant *CodeGenModule::GenerateVtable(const CXXRecordDecl *LayoutClass, b.GenerateVtableForVBases(RD, Offset); llvm::Constant *C = 0; - llvm::Type *type = Ptr8Ty; + llvm::ArrayType *ntype = + llvm::ArrayType::get(Ptr8Ty, b.getVtable().size()); + llvm::GlobalVariable::LinkageTypes linktype = llvm::GlobalValue::ExternalLinkage; if (CreateDefinition) { - llvm::ArrayType *ntype = - llvm::ArrayType::get(Ptr8Ty, b.getVtable().size()); C = llvm::ConstantArray::get(ntype, &b.getVtable()[0], b.getVtable().size()); linktype = llvm::GlobalValue::LinkOnceODRLinkage; if (LayoutClass->isInAnonymousNamespace()) linktype = llvm::GlobalValue::InternalLinkage; - type = ntype; } llvm::GlobalVariable *OGV = GV; - GV = new llvm::GlobalVariable(getModule(), type, true, linktype, C, Name); + GV = new llvm::GlobalVariable(getModule(), ntype, true, linktype, C, Name); if (OGV) { GV->takeName(OGV); llvm::Constant *NewPtr = llvm::ConstantExpr::getBitCast(GV, |