diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-08-21 00:27:33 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-08-21 00:27:33 +0000 |
commit | 075d5d2e99eec488f8cf0e1d53057d26cf62b457 (patch) | |
tree | 3544a1ac08a4b7b12fd07a0f744c47b6e0e16fbb /clang/lib/StaticAnalyzer/Core/BasicConstraintManager.cpp | |
parent | 309856ae9f8c7c451d1ae93290119adae1d2fa6e (diff) | |
download | bcm5719-llvm-075d5d2e99eec488f8cf0e1d53057d26cf62b457.tar.gz bcm5719-llvm-075d5d2e99eec488f8cf0e1d53057d26cf62b457.zip |
[analyzer] Assume that reference symbols are non-null.
By doing this in the constraint managers, we can ensure that ANY reference
whose value we don't know gets the effect, even if it's not a top-level
parameter.
llvm-svn: 162246
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/BasicConstraintManager.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/BasicConstraintManager.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/BasicConstraintManager.cpp b/clang/lib/StaticAnalyzer/Core/BasicConstraintManager.cpp index 8897756a92d..fb6d4be09da 100644 --- a/clang/lib/StaticAnalyzer/Core/BasicConstraintManager.cpp +++ b/clang/lib/StaticAnalyzer/Core/BasicConstraintManager.cpp @@ -363,6 +363,10 @@ const llvm::APSInt* BasicConstraintManager::getSymVal(ProgramStateRef state, bool BasicConstraintManager::isNotEqual(ProgramStateRef state, SymbolRef sym, const llvm::APSInt& V) const { + // Special case: references are known to be non-zero. + if (sym->getType(getBasicVals().getContext())->isReferenceType()) + if (V == 0) + return true; // Retrieve the NE-set associated with the given symbol. const ConstNotEqTy::data_type* T = state->get<ConstNotEq>(sym); |