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

Ken Dyck kd at kendyck.com
Thu Mar 10 18:13:43 PST 2011


Author: kjdyck
Date: Thu Mar 10 20:13:43 2011
New Revision: 127454

URL: http://llvm.org/viewvc/llvm-project?rev=127454&view=rev
Log:
Overload IntExprEvaluator::Success() with a function that takes a CharUnits
parameter to tidy up the places where the expression is a size.

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=127454&r1=127453&r2=127454&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Thu Mar 10 20:13:43 2011
@@ -953,6 +953,11 @@
     return true;
   }
 
+  bool Success(CharUnits Size, const Expr *E) {
+    return Success(Size.getQuantity(), E);
+  }
+
+
   bool Error(SourceLocation L, diag::kind D, const Expr *E) {
     // Take the first error.
     if (Info.EvalResult.Diag == 0) {
@@ -1213,7 +1218,7 @@
     Size -= Offset;
   else
     Size = CharUnits::Zero();
-  return Success(Size.getQuantity(), E);
+  return Success(Size, E);
 }
 
 bool IntExprEvaluator::VisitCallExpr(CallExpr *E) {
@@ -1602,9 +1607,9 @@
   // Handle alignof separately.
   if (!E->isSizeOf()) {
     if (E->isArgumentType())
-      return Success(GetAlignOfType(E->getArgumentType()).getQuantity(), E);
+      return Success(GetAlignOfType(E->getArgumentType()), E);
     else
-      return Success(GetAlignOfExpr(E->getArgumentExpr()).getQuantity(), E);
+      return Success(GetAlignOfExpr(E->getArgumentExpr()), E);
   }
 
   QualType SrcTy = E->getTypeOfArgument();
@@ -1625,7 +1630,7 @@
     return false;
 
   // Get information about the size.
-  return Success(Info.Ctx.getTypeSizeInChars(SrcTy).getQuantity(), E);
+  return Success(Info.Ctx.getTypeSizeInChars(SrcTy), E);
 }
 
 bool IntExprEvaluator::VisitOffsetOfExpr(const OffsetOfExpr *E) {
@@ -1694,7 +1699,7 @@
     }
     }
   }
-  return Success(Result.getQuantity(), E);
+  return Success(Result, E);
 }
 
 bool IntExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) {





More information about the cfe-commits mailing list