aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGCXX.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-07-28 18:54:57 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-07-28 18:54:57 +0000
commit1c698e0d4f9bf3d141c019d33d9040085a8a67dd (patch)
tree06a8a21c12749e8da01391132c42bb0ba84b1a25 /lib/CodeGen/CGCXX.cpp
parent7db6d838aad4083fe86d7bf703a75fe6e8a17856 (diff)
More cleanup of data member access and then some.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77351 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCXX.cpp')
-rw-r--r--lib/CodeGen/CGCXX.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index d82b976951..0b22eb49be 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -168,16 +168,23 @@ llvm::Value *CodeGenFunction::AddressCXXOfBaseClass(llvm::Value *BaseValue,
getContext().getASTRecordLayout(ClassDecl);
llvm::Type *I8Ptr = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
unsigned Idx = 0;
+ bool DerivedToBaseConversion = false;
for (CXXRecordDecl::base_class_const_iterator i =
ClassDecl->bases_begin(),
e = ClassDecl->bases_end(); i != e; ++i, ++Idx) {
if (!i->isVirtual()) {
const CXXRecordDecl *Base =
cast<CXXRecordDecl>(i->getType()->getAsRecordType()->getDecl());
- if (Base == BaseClassDecl)
- break;
+ if (Base == BaseClassDecl) {
+ DerivedToBaseConversion = true;
+ break;
+ }
}
}
+ if (!DerivedToBaseConversion) {
+ assert(false && "FIXME - Only derived to imm. base convesion is supported");
+ return BaseValue;
+ }
uint64_t Offset = Layout.getFieldOffset(Idx) / 8;
llvm::Value *OffsetVal = llvm::ConstantInt::get(llvm::Type::Int32Ty, Offset);
BaseValue = Builder.CreateBitCast(BaseValue, I8Ptr);