[cfe-commits] r54828 - /cfe/trunk/include/clang/AST/Expr.h

Daniel Dunbar daniel at zuster.org
Fri Aug 15 16:29:09 PDT 2008


Author: ddunbar
Date: Fri Aug 15 18:29:09 2008
New Revision: 54828

URL: http://llvm.org/viewvc/llvm-project?rev=54828&view=rev
Log:
Update Expr::{getIntegerConstantExprValue, isIntegerConstantExpr} to
  use default APSInt constructor instead of embedding arbitrary
  constant.

Update OverloadExpr::getNumArgs to use getIntegerConstantExprValue.

Update OverloadExpr::getExpr to be const.

Modified:
    cfe/trunk/include/clang/AST/Expr.h

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=54828&r1=54827&r2=54828&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Fri Aug 15 18:29:09 2008
@@ -97,7 +97,7 @@
   /// constant expression. The expression must be a valid integer
   /// constant expression as determined by isIntegerConstantExpr.
   llvm::APSInt getIntegerConstantExprValue(ASTContext &Ctx) const {
-    llvm::APSInt X(32);
+    llvm::APSInt X;
     bool success = isIntegerConstantExpr(X, Ctx);
     success = success;
     assert(success && "Illegal argument to getIntegerConstantExpr");
@@ -112,7 +112,7 @@
                              SourceLocation *Loc = 0,
                              bool isEvaluated = true) const;
   bool isIntegerConstantExpr(ASTContext &Ctx, SourceLocation *Loc = 0) const {
-    llvm::APSInt X(32);
+    llvm::APSInt X;
     return isIntegerConstantExpr(X, Ctx, Loc);
   }
   /// isConstantExpr - Return true if this expression is a valid constant expr.
@@ -1320,9 +1320,7 @@
   /// getNumArgs - Return the number of arguments to pass to the candidate
   /// functions.
   unsigned getNumArgs(ASTContext &Ctx) const {
-    llvm::APSInt constEval(32);
-    (void) cast<Expr>(SubExprs[0])->isIntegerConstantExpr(constEval, Ctx);
-    return constEval.getZExtValue();
+    return getExpr(0)->getIntegerConstantExprValue(Ctx).getZExtValue();
   }
 
   /// getNumSubExprs - Return the size of the SubExprs array.  This includes the
@@ -1331,7 +1329,7 @@
   unsigned getNumSubExprs() const { return NumExprs; }
   
   /// getExpr - Return the Expr at the specified index.
-  Expr *getExpr(unsigned Index) {
+  Expr *getExpr(unsigned Index) const {
     assert((Index < NumExprs) && "Arg access out of range!");
     return cast<Expr>(SubExprs[Index]);
   }





More information about the cfe-commits mailing list