diff options
author | Anna Zaks <ganna@apple.com> | 2012-05-03 18:21:28 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-05-03 18:21:28 +0000 |
commit | dd160f3ed50def10765ed823bf4ce2a56b2cd035 (patch) | |
tree | 72e9b2140cfa16c270ba5bb6146b37fd33d03962 /lib/StaticAnalyzer/Checkers/CStringChecker.cpp | |
parent | d39d23e610c2a7815515d60c5a538d65d05e8bdc (diff) |
[analyzer] CString Checker: Do not split the path unless the user
specifically checks for equality to null.
Enforcing this general practice, which keeps the analyzer less
noisy, in the CString Checker. This change suppresses "Assigned value is
garbage or undefined" warning in the added test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156085 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/CStringChecker.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Checkers/CStringChecker.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Checkers/CStringChecker.cpp b/lib/StaticAnalyzer/Checkers/CStringChecker.cpp index 9eb7edffe6..bd1a56a1aa 100644 --- a/lib/StaticAnalyzer/Checkers/CStringChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/CStringChecker.cpp @@ -901,9 +901,10 @@ void CStringChecker::evalCopyCommon(CheckerContext &C, // If the size is zero, there won't be any actual memory access, so // just bind the return value to the destination buffer and return. - if (stateZeroSize) { + if (stateZeroSize && !stateNonZeroSize) { stateZeroSize = stateZeroSize->BindExpr(CE, LCtx, destVal); C.addTransition(stateZeroSize); + return; } // If the size can be nonzero, we have to check the other arguments. |