summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2014-02-21 00:18:31 +0000
committerJordan Rose <jordan_rose@apple.com>2014-02-21 00:18:31 +0000
commit45d71a271554ff183629e7451ada8f440a20654c (patch)
treeda8164b52bcd959a9901cebdda39ddf54482fd4d /clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp
parent75c47799434885787d26ecbafcb10db48674401d (diff)
downloadbcm5719-llvm-45d71a271554ff183629e7451ada8f440a20654c.tar.gz
bcm5719-llvm-45d71a271554ff183629e7451ada8f440a20654c.zip
[analyzer] Fix a bug in IdenticalExprChecker concerning while loops.
Somehow both Daniel and I missed the fact that while loops are only identical if they have identical bodies. Patch by Daniel Fahlgren! llvm-svn: 201829
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp
index a76dff120be..6abfc14877e 100644
--- a/clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp
@@ -361,8 +361,13 @@ static bool isIdenticalStmt(const ASTContext &Ctx, const Stmt *Stmt1,
const WhileStmt *WStmt1 = cast<WhileStmt>(Stmt1);
const WhileStmt *WStmt2 = cast<WhileStmt>(Stmt2);
- return isIdenticalStmt(Ctx, WStmt1->getCond(), WStmt2->getCond(),
- IgnoreSideEffects);
+ if (!isIdenticalStmt(Ctx, WStmt1->getCond(), WStmt2->getCond(),
+ IgnoreSideEffects))
+ return false;
+ if (!isIdenticalStmt(Ctx, WStmt1->getBody(), WStmt2->getBody(),
+ IgnoreSideEffects))
+ return false;
+ return true;
}
case Stmt::IfStmtClass: {
const IfStmt *IStmt1 = cast<IfStmt>(Stmt1);
OpenPOWER on IntegriCloud