diff options
author | Artem Dergachev <artem.dergachev@gmail.com> | 2017-01-12 09:46:16 +0000 |
---|---|---|
committer | Artem Dergachev <artem.dergachev@gmail.com> | 2017-01-12 09:46:16 +0000 |
commit | c9affb0dbdbf9ab2477103d4c5b96cc1c6dc383d (patch) | |
tree | faa7ef46fdaee99cd5e98161040324ab05709e47 /clang/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp | |
parent | 352e4412e19d909b9fd9de4d19a192bc2540d818 (diff) | |
download | bcm5719-llvm-c9affb0dbdbf9ab2477103d4c5b96cc1c6dc383d.tar.gz bcm5719-llvm-c9affb0dbdbf9ab2477103d4c5b96cc1c6dc383d.zip |
[analyzer] Avoid a crash in DereferenceChecker on string literal initializers.
A hotfix for pr31592 that fixes the crash but not the root cause of the problem.
We need to update the analyzer engine further to account for AST changes
introduced in r289618. At the moment we're erroneously performing a redundant
lvalue-to-rvalue cast in this scenario, and squashing the rvalue of the object
bound to the reference into the reference itself.
rdar://problem/28832541
llvm-svn: 291754
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp index 152b937bb03..a98d379bb84 100644 --- a/clang/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp @@ -253,6 +253,12 @@ void DereferenceChecker::checkBind(SVal L, SVal V, const Stmt *S, if (!TVR->getValueType()->isReferenceType()) return; + // FIXME: This is a hotfix for https://llvm.org/bugs/show_bug.cgi?id=31592 + // A proper fix is very much necessary. Otherwise we would never normally bind + // a NonLoc to a reference. + if (V.getAs<NonLoc>()) + return; + ProgramStateRef State = C.getState(); ProgramStateRef StNonNull, StNull; |