[PATCH] D36141: [StaticAnalyzer] Fix FP in UnreachableCodeChecker
Daniel Marjamäki via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 2 01:27:47 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL309799: [StaticAnalyzer] Fix false positives for unreachable code in macros. (authored by danielmarjamaki).
Changed prior to commit:
https://reviews.llvm.org/D36141?vs=109086&id=109294#toc
Repository:
rL LLVM
https://reviews.llvm.org/D36141
Files:
cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
cfe/trunk/test/Analysis/unreachable-code-path.c
Index: cfe/trunk/test/Analysis/unreachable-code-path.c
===================================================================
--- cfe/trunk/test/Analysis/unreachable-code-path.c
+++ cfe/trunk/test/Analysis/unreachable-code-path.c
@@ -213,3 +213,13 @@
RETURN(1); // no-warning
}
+// Avoid FP when macro argument is known
+void writeSomething(int *x);
+#define MACRO(C) \
+ if (!C) { \
+ static int x; \
+ writeSomething(&x); \
+ }
+void macro2(void) {
+ MACRO(1);
+}
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
@@ -112,7 +112,7 @@
continue;
// Check for false positives
- if (CB->size() > 0 && isInvalidPath(CB, *PM))
+ if (isInvalidPath(CB, *PM))
continue;
// It is good practice to always have a "default" label in a "switch", even
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36141.109294.patch
Type: text/x-patch
Size: 1038 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170802/5675800e/attachment.bin>
More information about the cfe-commits
mailing list