summaryrefslogtreecommitdiffstats
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
commitfa90b154cae146cff4c7fc5475c73b5c57f5e2cc (patch)
tree621f272c4b63c5b91d4a4430532e47fd79ab0c4a
parent4a4fefcd29a980914e3c8d0c68faaf296e0c65aa (diff)
downloadbcm5719-llvm-fa90b154cae146cff4c7fc5475c73b5c57f5e2cc.tar.gz
bcm5719-llvm-fa90b154cae146cff4c7fc5475c73b5c57f5e2cc.zip
Minor simplification.
llvm-svn: 72887
-rw-r--r--clang/lib/AST/ExprConstant.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 0b1632f234b..8e3c3ce2d30 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/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);
}
OpenPOWER on IntegriCloud