aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGClass.cpp
diff options
context:
space:
mode:
authorKen Dyck <kd@kendyck.com>2011-03-22 01:21:15 +0000
committerKen Dyck <kd@kendyck.com>2011-03-22 01:21:15 +0000
commit5fff46b65389f7e7eb576e47c7bc3ca67326a206 (patch)
treedb8ea78828bf3e56b19eaa46ae9448fa6795aa08 /lib/CodeGen/CGClass.cpp
parent25a11e1c5fad62dbad25a265e334720157e3fbc1 (diff)
Convert Offset variable in GetAddressOfDirectBaseInCompleteClass() to
CharUnits. No change in functionality intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128060 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGClass.cpp')
-rw-r--r--lib/CodeGen/CGClass.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp
index 15d87f7835..69fcf9010b 100644
--- a/lib/CodeGen/CGClass.cpp
+++ b/lib/CodeGen/CGClass.cpp
@@ -84,20 +84,20 @@ CodeGenFunction::GetAddressOfDirectBaseInCompleteClass(llvm::Value *This,
== ConvertType(Derived));
// Compute the offset of the virtual base.
- uint64_t Offset;
+ CharUnits Offset;
const ASTRecordLayout &Layout = getContext().getASTRecordLayout(Derived);
if (BaseIsVirtual)
- Offset = Layout.getVBaseClassOffsetInBits(Base);
+ Offset = Layout.getVBaseClassOffset(Base);
else
- Offset = Layout.getBaseClassOffsetInBits(Base);
+ Offset = Layout.getBaseClassOffset(Base);
// Shift and cast down to the base type.
// TODO: for complete types, this should be possible with a GEP.
llvm::Value *V = This;
- if (Offset) {
+ if (Offset.isPositive()) {
const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(getLLVMContext());
V = Builder.CreateBitCast(V, Int8PtrTy);
- V = Builder.CreateConstInBoundsGEP1_64(V, Offset / 8);
+ V = Builder.CreateConstInBoundsGEP1_64(V, Offset.getQuantity());
}
V = Builder.CreateBitCast(V, ConvertType(Base)->getPointerTo());