aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-06-04 20:23:20 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-06-04 20:23:20 +0000
commitce1bca73aef9bbf6359ab8420278203dda81a054 (patch)
treef5b0788b665ffa8272ceb968b4a6a821ff79a57a /lib/AST/ExprConstant.cpp
parent147bd641dd264fde2fc5a0074f30eace71016ea9 (diff)
Minor simplification.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72887 91177308-0d34-0410-b5e6-96231b3b80d8
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);
}