[cfe-commits] r90675 - /cfe/trunk/lib/CodeGen/CGVtable.cpp

Anders Carlsson andersca at mac.com
Sat Dec 5 13:09:05 PST 2009


Author: andersca
Date: Sat Dec  5 15:09:05 2009
New Revision: 90675

URL: http://llvm.org/viewvc/llvm-project?rev=90675&view=rev
Log:
Make sure that hte vtable always has an i8* array type.

Modified:
    cfe/trunk/lib/CodeGen/CGVtable.cpp

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Sat Dec  5 15:09:05 2009
@@ -1130,21 +1130,20 @@
     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,





More information about the cfe-commits mailing list