From d3721e464a8cec087ea7c75abeda7f03df622eeb Mon Sep 17 00:00:00 2001 From: Jordan Rose Date: Mon, 19 Aug 2013 16:27:37 +0000 Subject: [PATCH] [analyzer] Add "unmodified variable" checker to the Potential Checkers. This is PR16890. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188681 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/analyzer/potential_checkers.html | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/www/analyzer/potential_checkers.html b/www/analyzer/potential_checkers.html index 6b96d1339c..6e887649be 100644 --- a/www/analyzer/potential_checkers.html +++ b/www/analyzer/potential_checkers.html @@ -288,6 +288,30 @@ void test() { + +

dead code

+ ++ + + + +
Name, DescriptionExampleProgress
deadcode.UnmodifiedVariable +
(C, C++)


+A variable is never modified but was not declared const and is not a reference. +
+extern int computeDelta();
+
+int foo(bool cond) {
+  int i = 0;
+  if (cond) {
+    const int delta = computeDelta();
+    // Forgot to modify 'i'.
+  }
+  return i;
+}
+
PR16890
+

undefined behavior

-- 2.40.0