From 46976384326cb2fa17b75c84c45b44b1210f353a Mon Sep 17 00:00:00 2001 From: Tom Care Date: Sat, 18 Sep 2010 00:06:34 +0000 Subject: [PATCH] IdempotentOperationChecker no longer reports errors that are post-dominated by a sink. This fixes some false positives that were flagged because a path was incomplete (usually in a loop). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114244 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Checker/IdempotentOperationChecker.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Checker/IdempotentOperationChecker.cpp b/lib/Checker/IdempotentOperationChecker.cpp index 3dcbea491e..f392a8da82 100644 --- a/lib/Checker/IdempotentOperationChecker.cpp +++ b/lib/Checker/IdempotentOperationChecker.cpp @@ -364,6 +364,9 @@ void IdempotentOperationChecker::VisitEndAnalysis(ExplodedGraph &G, BugReporter &BR, GRExprEngine &Eng) { BugType *BT = new BugType("Idempotent operation", "Dead code"); + // If a sink is present, we may have not seen the complete path. + BT->setSuppressOnSink(true); + // Iterate over the hash to see if we have any paths with definite // idempotent operations. for (AssumptionMap::const_iterator i = hash.begin(); i != hash.end(); ++i) { -- 2.40.0