diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-10-29 17:31:59 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-10-29 17:31:59 +0000 |
commit | 6a329ee7567cf3267ffab2bc755ea8c773d967e7 (patch) | |
tree | 8f4780bdee5801577523055627d86128dcec72ff /include/clang/StaticAnalyzer/Core/BugReporter | |
parent | 09f7bf14d25bdc55cb715bc8d40600906848a409 (diff) |
[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>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166941 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/StaticAnalyzer/Core/BugReporter')
-rw-r--r-- | include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h index a3784739d1..78e35ca82b 100644 --- a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h +++ b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h @@ -268,7 +268,11 @@ namespace bugreporter { /// \param IsArg Whether the statement is an argument to an inlined function. /// If this is the case, \p N \em must be the CallEnter node for /// the function. -void trackNullOrUndefValue(const ExplodedNode *N, const Stmt *S, BugReport &R, +/// +/// \return Whether or not the function was able to add visitors for this +/// statement. Note that returning \c true does not actually imply +/// that any visitors were added. +bool trackNullOrUndefValue(const ExplodedNode *N, const Stmt *S, BugReport &R, bool IsArg = false); const Stmt *GetDerefExpr(const ExplodedNode *N); |