aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r--lib/AST/ExprConstant.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index 0b1632f234..8e3c3ce2d3 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -946,12 +946,8 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
const QualType ElementType = Type->getAsPointerType()->getPointeeType();
uint64_t D = LHSValue.getLValueOffset() - RHSValue.getLValueOffset();
- uint64_t ElemSize;
- if (ElementType->isVoidType() || ElementType->isFunctionType())
- ElemSize = 8;
- else
- ElemSize = Info.Ctx.getTypeSize(ElementType);
- D /= ElemSize / 8;
+ if (!ElementType->isVoidType() && !ElementType->isFunctionType())
+ D /= Info.Ctx.getTypeSize(ElementType) / 8;
return Success(D, E);
}