From: Ted Kremenek Date: Thu, 17 Jul 2008 23:24:36 +0000 (+0000) Subject: Provide static methods in BinaryOperator to determine if an opcode is an equality... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f2da7a06f6b98c3886d9b871ab839f5085b1c238;p=clang Provide static methods in BinaryOperator to determine if an opcode is an equality opcode, a relational opcode, or a logical opcode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53744 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index afe1c4bb36..51b8588d5f 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -937,9 +937,16 @@ public: bool isAdditiveOp() const { return Opc == Add || Opc == Sub; } bool isShiftOp() const { return Opc == Shl || Opc == Shr; } bool isBitwiseOp() const { return Opc >= And && Opc <= Or; } - bool isRelationalOp() const { return Opc >= LT && Opc <= GE; } - bool isEqualityOp() const { return Opc == EQ || Opc == NE; } - bool isLogicalOp() const { return Opc == LAnd || Opc == LOr; } + + static bool isRelationalOp(Opcode Opc) { return Opc >= LT && Opc <= GE; } + bool isRelationalOp() const { return isRelationalOp(Opc); } + + static bool isEqualityOp(Opcode Opc) { return Opc == EQ || Opc == NE; } + bool isEqualityOp() const { return isEqualityOp(Opc); } + + static bool isLogicalOp(Opcode Opc) { return Opc == LAnd || Opc == LOr; } + bool isLogicalOp() const { return isLogicalOp(Opc); } + bool isAssignmentOp() const { return Opc >= Assign && Opc <= OrAssign; } bool isCompoundAssignmentOp() const { return Opc > Assign && Opc <= OrAssign;} bool isShiftAssignOp() const { return Opc == ShlAssign || Opc == ShrAssign; }