summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2013-05-28 22:32:08 +0000
committerAnna Zaks <ganna@apple.com>2013-05-28 22:32:08 +0000
commit6477e97af73a6bc036888d68b79d919f8b11cd2a (patch)
tree2f658478a5f9f5d40d0476f0ecba36d6020251a1 /clang/lib/StaticAnalyzer/Core/RegionStore.cpp
parent0259300325d0816219e3816659b1831375950538 (diff)
downloadbcm5719-llvm-6477e97af73a6bc036888d68b79d919f8b11cd2a.tar.gz
bcm5719-llvm-6477e97af73a6bc036888d68b79d919f8b11cd2a.zip
[analyzer] Re-enable reasoning about CK_LValueBitCast
It’s important for us to reason about the cast as it is used in std::addressof. The reason we did not handle the cast previously was a crash on a test case (see commit r157478). The crash was in processing array to pointer decay when the region type was not an array. Address the issue, by just returning an unknown in that case. llvm-svn: 182808
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/RegionStore.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/RegionStore.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
index 88c4eee4bb2..729fc009fe8 100644
--- a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
+++ b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -1262,7 +1262,10 @@ SVal RegionStoreManager::ArrayToPointer(Loc Array) {
// Strip off typedefs from the ArrayRegion's ValueType.
QualType T = ArrayR->getValueType().getDesugaredType(Ctx);
- const ArrayType *AT = cast<ArrayType>(T);
+ const ArrayType *AT = dyn_cast<ArrayType>(T);
+ if (!AT)
+ return UnknownVal();
+
T = AT->getElementType();
NonLoc ZeroIdx = svalBuilder.makeZeroArrayIndex();
OpenPOWER on IntegriCloud