@@ -166,7 +166,7 @@ static bool isIdenticalExpr(const ASTContext &Ctx, const Expr *Expr1,
166
166
// are identical.
167
167
if (!IgnoreSideEffects && Expr1->HasSideEffects (Ctx))
168
168
return false ;
169
- // Is expression is based on macro then don't warn even if
169
+ // If either expression comes from a macro then don't warn even if
170
170
// the expressions are identical.
171
171
if ((Expr1->getExprLoc ().isMacroID ()) || (Expr2->getExprLoc ().isMacroID ()))
172
172
return false ;
@@ -199,41 +199,39 @@ static bool isIdenticalExpr(const ASTContext &Ctx, const Expr *Expr1,
199
199
case Stmt::ParenExprClass:
200
200
return true ;
201
201
case Stmt::BinaryOperatorClass: {
202
- const BinaryOperator *BinOp1 = dyn_cast <BinaryOperator>(Expr1);
203
- const BinaryOperator *BinOp2 = dyn_cast <BinaryOperator>(Expr2);
202
+ const BinaryOperator *BinOp1 = cast <BinaryOperator>(Expr1);
203
+ const BinaryOperator *BinOp2 = cast <BinaryOperator>(Expr2);
204
204
return BinOp1->getOpcode () == BinOp2->getOpcode ();
205
205
}
206
206
case Stmt::CharacterLiteralClass: {
207
- const CharacterLiteral *CharLit1 = dyn_cast <CharacterLiteral>(Expr1);
208
- const CharacterLiteral *CharLit2 = dyn_cast <CharacterLiteral>(Expr2);
207
+ const CharacterLiteral *CharLit1 = cast <CharacterLiteral>(Expr1);
208
+ const CharacterLiteral *CharLit2 = cast <CharacterLiteral>(Expr2);
209
209
return CharLit1->getValue () == CharLit2->getValue ();
210
210
}
211
211
case Stmt::DeclRefExprClass: {
212
- const DeclRefExpr *DeclRef1 = dyn_cast <DeclRefExpr>(Expr1);
213
- const DeclRefExpr *DeclRef2 = dyn_cast <DeclRefExpr>(Expr2);
212
+ const DeclRefExpr *DeclRef1 = cast <DeclRefExpr>(Expr1);
213
+ const DeclRefExpr *DeclRef2 = cast <DeclRefExpr>(Expr2);
214
214
return DeclRef1->getDecl () == DeclRef2->getDecl ();
215
215
}
216
216
case Stmt::IntegerLiteralClass: {
217
- const IntegerLiteral *IntLit1 = dyn_cast <IntegerLiteral>(Expr1);
218
- const IntegerLiteral *IntLit2 = dyn_cast <IntegerLiteral>(Expr2);
217
+ const IntegerLiteral *IntLit1 = cast <IntegerLiteral>(Expr1);
218
+ const IntegerLiteral *IntLit2 = cast <IntegerLiteral>(Expr2);
219
219
return IntLit1->getValue () == IntLit2->getValue ();
220
220
}
221
221
case Stmt::FloatingLiteralClass: {
222
- const FloatingLiteral *FloatLit1 = dyn_cast <FloatingLiteral>(Expr1);
223
- const FloatingLiteral *FloatLit2 = dyn_cast <FloatingLiteral>(Expr2);
222
+ const FloatingLiteral *FloatLit1 = cast <FloatingLiteral>(Expr1);
223
+ const FloatingLiteral *FloatLit2 = cast <FloatingLiteral>(Expr2);
224
224
return FloatLit1->getValue ().bitwiseIsEqual (FloatLit2->getValue ());
225
225
}
226
226
case Stmt::MemberExprClass: {
227
- const MemberExpr *MemberExpr1 = dyn_cast <MemberExpr>(Expr1);
228
- const MemberExpr *MemberExpr2 = dyn_cast <MemberExpr>(Expr2);
227
+ const MemberExpr *MemberExpr1 = cast <MemberExpr>(Expr1);
228
+ const MemberExpr *MemberExpr2 = cast <MemberExpr>(Expr2);
229
229
return MemberExpr1->getMemberDecl () == MemberExpr2->getMemberDecl ();
230
230
}
231
231
case Stmt::UnaryOperatorClass: {
232
- const UnaryOperator *UnaryOp1 = dyn_cast<UnaryOperator>(Expr1);
233
- const UnaryOperator *UnaryOp2 = dyn_cast<UnaryOperator>(Expr2);
234
- if (UnaryOp1->getOpcode () != UnaryOp2->getOpcode ())
235
- return false ;
236
- return IgnoreSideEffects || !UnaryOp1->isIncrementDecrementOp ();
232
+ const UnaryOperator *UnaryOp1 = cast<UnaryOperator>(Expr1);
233
+ const UnaryOperator *UnaryOp2 = cast<UnaryOperator>(Expr2);
234
+ return UnaryOp1->getOpcode () == UnaryOp2->getOpcode ();
237
235
}
238
236
}
239
237
}
0 commit comments