[clang-tools-extra] d48d480 - [clang-tidy][NFC] Fix tiny bug in areStatementsIdentical
Piotr Zegar via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 22 13:46:56 PDT 2024
Author: Piotr Zegar
Date: 2024-07-22T20:46:48Z
New Revision: d48d4805f792adbdac58d480f890449def4964ea
URL: https://github.com/llvm/llvm-project/commit/d48d4805f792adbdac58d480f890449def4964ea
DIFF: https://github.com/llvm/llvm-project/commit/d48d4805f792adbdac58d480f890449def4964ea.diff
LOG: [clang-tidy][NFC] Fix tiny bug in areStatementsIdentical
Function areStatementsIdentical had an early exit
when classes of stmt does not match. That if were
added to speed up checking and do not calculate
hash id of both objects if they are not the same
type. Due to some bug, wrong pointer were used
and this resulted with comparing self to self.
This patch fixes this issue.
Added:
Modified:
clang-tools-extra/clang-tidy/utils/ASTUtils.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/utils/ASTUtils.cpp b/clang-tools-extra/clang-tidy/utils/ASTUtils.cpp
index fd5dadc9b01db..0cdc7d08abc99 100644
--- a/clang-tools-extra/clang-tidy/utils/ASTUtils.cpp
+++ b/clang-tools-extra/clang-tidy/utils/ASTUtils.cpp
@@ -96,7 +96,7 @@ bool areStatementsIdentical(const Stmt *FirstStmt, const Stmt *SecondStmt,
if (FirstStmt == SecondStmt)
return true;
- if (FirstStmt->getStmtClass() != FirstStmt->getStmtClass())
+ if (FirstStmt->getStmtClass() != SecondStmt->getStmtClass())
return false;
if (isa<Expr>(FirstStmt) && isa<Expr>(SecondStmt)) {
More information about the cfe-commits
mailing list