[cfe-commits] r53963 - in /cfe/trunk: include/clang/AST/Expr.h lib/AST/Expr.cpp

Ted Kremenek kremenek at apple.com
Wed Jul 23 15:18:43 PDT 2008


Author: kremenek
Date: Wed Jul 23 17:18:43 2008
New Revision: 53963

URL: http://llvm.org/viewvc/llvm-project?rev=53963&view=rev
Log:
Added UnaryOperator::isPrefix().

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

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

==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Wed Jul 23 17:18:43 2008
@@ -481,6 +481,10 @@
   /// isPostfix - Return true if this is a postfix operation, like x++.
   static bool isPostfix(Opcode Op);
 
+  /// isPostfix - Return true if this is a prefix operation, like --x.
+  static bool isPrefix(Opcode Op);
+
+  bool isPrefix() const { return isPrefix(Opc); }
   bool isPostfix() const { return isPostfix(Opc); }
   bool isIncrementOp() const {return Opc==PreInc || Opc==PostInc; }
   bool isIncrementDecrementOp() const { return Opc>=PostInc && Opc<=PreDec; }

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

==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Wed Jul 23 17:18:43 2008
@@ -61,6 +61,16 @@
   }
 }
 
+bool UnaryOperator::isPrefix(Opcode Op) {
+  switch (Op) {
+    case PreInc:
+    case PreDec:
+      return true;
+    default:
+      return false;
+  }
+}
+
 /// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
 /// corresponds to, e.g. "sizeof" or "[pre]++".
 const char *UnaryOperator::getOpcodeStr(Opcode Op) {





More information about the cfe-commits mailing list