[cfe-commits] r41392 - in /cfe/trunk/AST: Expr.cpp Stmt.cpp

Chris Lattner sabre at nondot.org
Fri Aug 24 18:55:00 PDT 2007


Author: lattner
Date: Fri Aug 24 20:55:00 2007
New Revision: 41392

URL: http://llvm.org/viewvc/llvm-project?rev=41392&view=rev
Log:
fix off-by-one error


Modified:
    cfe/trunk/AST/Expr.cpp
    cfe/trunk/AST/Stmt.cpp

Modified: cfe/trunk/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Expr.cpp?rev=41392&r1=41391&r2=41392&view=diff

==============================================================================
--- cfe/trunk/AST/Expr.cpp (original)
+++ cfe/trunk/AST/Expr.cpp Fri Aug 24 20:55:00 2007
@@ -231,6 +231,8 @@
   }
   case BinaryOperatorClass:
     return cast<BinaryOperator>(this)->isAssignmentOp();
+  case CompoundAssignOperator:
+    return true;
 
   case MemberExprClass:
   case ArraySubscriptExprClass:

Modified: cfe/trunk/AST/Stmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Stmt.cpp?rev=41392&r1=41391&r2=41392&view=diff

==============================================================================
--- cfe/trunk/AST/Stmt.cpp (original)
+++ cfe/trunk/AST/Stmt.cpp Fri Aug 24 20:55:00 2007
@@ -21,7 +21,7 @@
   const char *Name;
   unsigned Counter;
   unsigned Size;
-} StmtClassInfo[Stmt::lastExprConstant];
+} StmtClassInfo[Stmt::lastExprConstant+1];
 
 static StmtClassNameTable &getStmtInfoTableEntry(Stmt::StmtClass E) {
   static bool Initialized = false;
@@ -48,13 +48,13 @@
   
   unsigned sum = 0;
   fprintf(stderr, "*** Stmt/Expr Stats:\n");
-  for (int i = 0; i != Stmt::lastExprConstant; i++) {
+  for (int i = 0; i != Stmt::lastExprConstant+1; i++) {
     if (StmtClassInfo[i].Name == 0) continue;
     sum += StmtClassInfo[i].Counter;
   }
   fprintf(stderr, "  %d stmts/exprs total.\n", sum);
   sum = 0;
-  for (int i = 0; i != Stmt::lastExprConstant; i++) {
+  for (int i = 0; i != Stmt::lastExprConstant+1; i++) {
     if (StmtClassInfo[i].Name == 0) continue;
     fprintf(stderr, "    %d %s, %d each (%d bytes)\n", 
             StmtClassInfo[i].Counter, StmtClassInfo[i].Name,





More information about the cfe-commits mailing list