[cfe-commits] r72887 - /cfe/trunk/lib/AST/ExprConstant.cpp

Eli Friedman eli.friedman at gmail.com
Thu Jun 4 13:23:35 PDT 2009


Author: efriedma
Date: Thu Jun  4 15:23:20 2009
New Revision: 72887

URL: http://llvm.org/viewvc/llvm-project?rev=72887&view=rev
Log:
Minor simplification.


Modified:
    cfe/trunk/lib/AST/ExprConstant.cpp

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=72887&r1=72886&r2=72887&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Thu Jun  4 15:23:20 2009
@@ -946,12 +946,8 @@
         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);
       }





More information about the cfe-commits mailing list