aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorKen Dyck <kd@kendyck.com>2011-01-26 02:17:08 +0000
committerKen Dyck <kd@kendyck.com>2011-01-26 02:17:08 +0000
commit7c7f820d70c925b29290a8563b59615816a827fc (patch)
tree445f282dc4febadcaf40993c0c91cfea4d20b554 /lib/AST/ExprConstant.cpp
parentbd5a94e263137dc3ce7c100485626bae025cf58e (diff)
Use RecordLayout::getBaseClassOffset() where CharUnits are needed instead of
converting getBaseClassOffsetInBits() to CharUnits. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124274 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r--lib/AST/ExprConstant.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index afce24e625..7c3fc63e42 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -549,7 +549,7 @@ bool PointerExprEvaluator::VisitCastExpr(CastExpr* E) {
// Now figure out the necessary offset to add to the baseLV to get from
// the derived class to the base class.
- uint64_t Offset = 0;
+ CharUnits Offset = CharUnits::Zero();
QualType Ty = E->getSubExpr()->getType();
const CXXRecordDecl *DerivedDecl =
@@ -567,13 +567,12 @@ bool PointerExprEvaluator::VisitCastExpr(CastExpr* E) {
const CXXRecordDecl *BaseDecl = Base->getType()->getAsCXXRecordDecl();
const ASTRecordLayout &Layout = Info.Ctx.getASTRecordLayout(DerivedDecl);
- Offset += Layout.getBaseClassOffsetInBits(BaseDecl);
+ Offset += Layout.getBaseClassOffset(BaseDecl);
DerivedDecl = BaseDecl;
}
Result.Base = BaseLV.getLValueBase();
- Result.Offset = BaseLV.getLValueOffset() +
- Info.Ctx.toCharUnitsFromBits(Offset);
+ Result.Offset = BaseLV.getLValueOffset() + Offset;
return true;
}
@@ -1595,9 +1594,7 @@ bool IntExprEvaluator::VisitOffsetOfExpr(const OffsetOfExpr *E) {
return false;
// Add the offset to the base.
- Result += Info.Ctx.toCharUnitsFromBits(
- RL.getBaseClassOffsetInBits(
- cast<CXXRecordDecl>(BaseRT->getDecl())));
+ Result += RL.getBaseClassOffset(cast<CXXRecordDecl>(BaseRT->getDecl()));
break;
}
}