diff options
| author | Ted Kremenek <kremenek@apple.com> | 2008-07-23 22:18:43 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2008-07-23 22:18:43 +0000 |
| commit | 1692342e58012fe7b1600273fb85035f8169518a (patch) | |
| tree | f062cc79d866e815f84f063d06dde5a9cda9f118 /clang | |
| parent | b9e10c02d2a6d47201eaf73ae6b086b2754088d3 (diff) | |
| download | bcm5719-llvm-1692342e58012fe7b1600273fb85035f8169518a.tar.gz bcm5719-llvm-1692342e58012fe7b1600273fb85035f8169518a.zip | |
Added UnaryOperator::isPrefix().
llvm-svn: 53963
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/include/clang/AST/Expr.h | 4 | ||||
| -rw-r--r-- | clang/lib/AST/Expr.cpp | 10 |
2 files changed, 14 insertions, 0 deletions
diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h index 51b8588d5fd..692a0ea85f5 100644 --- a/clang/include/clang/AST/Expr.h +++ b/clang/include/clang/AST/Expr.h @@ -481,6 +481,10 @@ public: /// 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; } diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index de0c740fd29..6c7d170d036 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -61,6 +61,16 @@ bool UnaryOperator::isPostfix(Opcode Op) { } } +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) { |

