summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-10-29 17:31:59 +0000
committerJordan Rose <jordan_rose@apple.com>2012-10-29 17:31:59 +0000
commitec44ac6a59d24c02c2f6036efcfb511b5608e009 (patch)
tree5a452858b792f5b76d9a535dd3c11cd32a83afb4 /clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
parent199fdd825f6eb930cea281d5b83615e617e54c2a (diff)
downloadbcm5719-llvm-ec44ac6a59d24c02c2f6036efcfb511b5608e009.tar.gz
bcm5719-llvm-ec44ac6a59d24c02c2f6036efcfb511b5608e009.zip
[analyzer] New option to not suppress null return paths if an argument is null.
Our one basic suppression heuristic is to assume that functions do not usually return NULL. However, when one of the arguments is NULL it is suddenly much more likely that NULL is a valid return value. In this case, we don't suppress the report here, but we do attach /another/ visitor to go find out if this NULL argument also comes from an inlined function's error path. This new behavior, controlled by the 'avoid-suppressing-null-argument-paths' analyzer-config option, is turned off by default. Turning it on produced two false positives and no new true positives when running over LLVM/Clang. This is one of the possible refinements to our suppression heuristics. <rdar://problem/12350829> llvm-svn: 166941
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp b/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
index 32073d726d9..da88589c869 100644
--- a/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
+++ b/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
@@ -102,6 +102,12 @@ bool AnalyzerOptions::shouldPruneNullReturnPaths() {
/* Default = */ true);
}
+bool AnalyzerOptions::shouldAvoidSuppressingNullArgumentPaths() {
+ return getBooleanOption(AvoidSuppressingNullArgumentPaths,
+ "avoid-suppressing-null-argument-paths",
+ /* Default = */ false);
+}
+
int AnalyzerOptions::getOptionAsInteger(StringRef Name, int DefaultVal) {
llvm::SmallString<10> StrBuf;
llvm::raw_svector_ostream OS(StrBuf);
OpenPOWER on IntegriCloud