]> granicus.if.org Git - clang/commitdiff
Minor simplification.
authorEli Friedman <eli.friedman@gmail.com>
Thu, 4 Jun 2009 20:23:20 +0000 (20:23 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Thu, 4 Jun 2009 20:23:20 +0000 (20:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72887 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ExprConstant.cpp

index 0b1632f234b33375b6cfa2aa605964b0f39bacb2..8e3c3ce2d309e15bcfe22a7bef619a88b0f81165 100644 (file)
@@ -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);
       }