diff options
author | Jordan Rose <jordan_rose@apple.com> | 2013-12-10 18:18:10 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2013-12-10 18:18:10 +0000 |
commit | 6f2f39006ba5b95e6314f83c0a8cd670152892d3 (patch) | |
tree | 2d1fdfeb9a0cf354b3b9f82c01b6a8be7a1d757a /clang/lib/StaticAnalyzer | |
parent | 60bd88d34135aa2c4996160259e91354b2e06e6d (diff) | |
download | bcm5719-llvm-6f2f39006ba5b95e6314f83c0a8cd670152892d3.tar.gz bcm5719-llvm-6f2f39006ba5b95e6314f83c0a8cd670152892d3.zip |
[analyzer] Misc. tidying in IdenticalExprChecker.
Some things I missed when this first went in.
llvm-svn: 196938
Diffstat (limited to 'clang/lib/StaticAnalyzer')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp index b17d799fc17..88f9f20a638 100644 --- a/clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp @@ -166,7 +166,7 @@ static bool isIdenticalExpr(const ASTContext &Ctx, const Expr *Expr1, // are identical. if (!IgnoreSideEffects && Expr1->HasSideEffects(Ctx)) return false; - // Is expression is based on macro then don't warn even if + // If either expression comes from a macro then don't warn even if // the expressions are identical. if ((Expr1->getExprLoc().isMacroID()) || (Expr2->getExprLoc().isMacroID())) return false; @@ -199,41 +199,39 @@ static bool isIdenticalExpr(const ASTContext &Ctx, const Expr *Expr1, case Stmt::ParenExprClass: return true; case Stmt::BinaryOperatorClass: { - const BinaryOperator *BinOp1 = dyn_cast<BinaryOperator>(Expr1); - const BinaryOperator *BinOp2 = dyn_cast<BinaryOperator>(Expr2); + const BinaryOperator *BinOp1 = cast<BinaryOperator>(Expr1); + const BinaryOperator *BinOp2 = cast<BinaryOperator>(Expr2); return BinOp1->getOpcode() == BinOp2->getOpcode(); } case Stmt::CharacterLiteralClass: { - const CharacterLiteral *CharLit1 = dyn_cast<CharacterLiteral>(Expr1); - const CharacterLiteral *CharLit2 = dyn_cast<CharacterLiteral>(Expr2); + const CharacterLiteral *CharLit1 = cast<CharacterLiteral>(Expr1); + const CharacterLiteral *CharLit2 = cast<CharacterLiteral>(Expr2); return CharLit1->getValue() == CharLit2->getValue(); } case Stmt::DeclRefExprClass: { - const DeclRefExpr *DeclRef1 = dyn_cast<DeclRefExpr>(Expr1); - const DeclRefExpr *DeclRef2 = dyn_cast<DeclRefExpr>(Expr2); + const DeclRefExpr *DeclRef1 = cast<DeclRefExpr>(Expr1); + const DeclRefExpr *DeclRef2 = cast<DeclRefExpr>(Expr2); return DeclRef1->getDecl() == DeclRef2->getDecl(); } case Stmt::IntegerLiteralClass: { - const IntegerLiteral *IntLit1 = dyn_cast<IntegerLiteral>(Expr1); - const IntegerLiteral *IntLit2 = dyn_cast<IntegerLiteral>(Expr2); + const IntegerLiteral *IntLit1 = cast<IntegerLiteral>(Expr1); + const IntegerLiteral *IntLit2 = cast<IntegerLiteral>(Expr2); return IntLit1->getValue() == IntLit2->getValue(); } case Stmt::FloatingLiteralClass: { - const FloatingLiteral *FloatLit1 = dyn_cast<FloatingLiteral>(Expr1); - const FloatingLiteral *FloatLit2 = dyn_cast<FloatingLiteral>(Expr2); + const FloatingLiteral *FloatLit1 = cast<FloatingLiteral>(Expr1); + const FloatingLiteral *FloatLit2 = cast<FloatingLiteral>(Expr2); return FloatLit1->getValue().bitwiseIsEqual(FloatLit2->getValue()); } case Stmt::MemberExprClass: { - const MemberExpr *MemberExpr1 = dyn_cast<MemberExpr>(Expr1); - const MemberExpr *MemberExpr2 = dyn_cast<MemberExpr>(Expr2); + const MemberExpr *MemberExpr1 = cast<MemberExpr>(Expr1); + const MemberExpr *MemberExpr2 = cast<MemberExpr>(Expr2); return MemberExpr1->getMemberDecl() == MemberExpr2->getMemberDecl(); } case Stmt::UnaryOperatorClass: { - const UnaryOperator *UnaryOp1 = dyn_cast<UnaryOperator>(Expr1); - const UnaryOperator *UnaryOp2 = dyn_cast<UnaryOperator>(Expr2); - if (UnaryOp1->getOpcode() != UnaryOp2->getOpcode()) - return false; - return IgnoreSideEffects || !UnaryOp1->isIncrementDecrementOp(); + const UnaryOperator *UnaryOp1 = cast<UnaryOperator>(Expr1); + const UnaryOperator *UnaryOp2 = cast<UnaryOperator>(Expr2); + return UnaryOp1->getOpcode() == UnaryOp2->getOpcode(); } } } |