[cfe-commits] r86745 - /cfe/trunk/lib/CodeGen/CGCXXClass.cpp
Eli Friedman
eli.friedman at gmail.com
Tue Nov 10 14:48:10 PST 2009
Author: efriedma
Date: Tue Nov 10 16:48:10 2009
New Revision: 86745
URL: http://llvm.org/viewvc/llvm-project?rev=86745&view=rev
Log:
Revert r86741; it doesn't handle virtual bases correctly.
Modified:
cfe/trunk/lib/CodeGen/CGCXXClass.cpp
Modified: cfe/trunk/lib/CodeGen/CGCXXClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXXClass.cpp?rev=86745&r1=86744&r2=86745&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXXClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXXClass.cpp Tue Nov 10 16:48:10 2009
@@ -127,14 +127,7 @@
// Just cast back.
return Builder.CreateBitCast(BaseValue, BasePtrTy);
}
-
- llvm::Value *Offset =
- GetCXXBaseClassOffset(*this, BaseValue, ClassDecl, BaseClassDecl);
-
- // If there is no offset, simply cast the pointer and return it.
- if (!Offset)
- return Builder.CreateBitCast(BaseValue, BasePtrTy);
-
+
llvm::BasicBlock *CastNull = 0;
llvm::BasicBlock *CastNotNull = 0;
llvm::BasicBlock *CastEnd = 0;
@@ -152,10 +145,15 @@
}
const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(VMContext);
+
+ llvm::Value *Offset =
+ GetCXXBaseClassOffset(*this, BaseValue, ClassDecl, BaseClassDecl);
- // Apply the offset.
- BaseValue = Builder.CreateBitCast(BaseValue, Int8PtrTy);
- BaseValue = Builder.CreateGEP(BaseValue, Offset, "add.ptr");
+ if (Offset) {
+ // Apply the offset.
+ BaseValue = Builder.CreateBitCast(BaseValue, Int8PtrTy);
+ BaseValue = Builder.CreateGEP(BaseValue, Offset, "add.ptr");
+ }
// Cast back.
BaseValue = Builder.CreateBitCast(BaseValue, BasePtrTy);
More information about the cfe-commits
mailing list