aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/RegionStore.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-06-12 00:20:22 +0000
committerJordan Rose <jordan_rose@apple.com>2012-06-12 00:20:22 +0000
commit5b8c69494881b7d35bc6244b4a19be0cc2eab368 (patch)
tree31099f4da294acaa8124fc1a24045d2b4e96ce57 /lib/StaticAnalyzer/Core/RegionStore.cpp
parent570d03c6831a8e19447dc863aa94ffff020077eb (diff)
Revert "[analyzer] Treat LValueBitCasts like regular pointer bit casts."
This does not actually give us the right behavior for reinterpret_cast of references. Reverting so I can think about it some more. This reverts commit 50a75a6e26a49011150067adac556ef978639fe6. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158341 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/RegionStore.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/RegionStore.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/StaticAnalyzer/Core/RegionStore.cpp b/lib/StaticAnalyzer/Core/RegionStore.cpp
index 86a68a6b3a..9c00d96343 100644
--- a/lib/StaticAnalyzer/Core/RegionStore.cpp
+++ b/lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -878,15 +878,10 @@ SVal RegionStoreManager::ArrayToPointer(Loc Array) {
if (!ArrayR)
return UnknownVal();
- // Extract the element type from the array region's ValueType.
- // Be careful about weird things happening due to user-written casts.
- QualType T = ArrayR->getValueType();
- if (const ArrayType *AT = Ctx.getAsArrayType(T))
- T = AT->getElementType();
- else if (const PointerType *PT = T->getAs<PointerType>())
- T = PT->getPointeeType();
- else
- return UnknownVal();
+ // Strip off typedefs from the ArrayRegion's ValueType.
+ QualType T = ArrayR->getValueType().getDesugaredType(Ctx);
+ const ArrayType *AT = cast<ArrayType>(T);
+ T = AT->getElementType();
NonLoc ZeroIdx = svalBuilder.makeZeroArrayIndex();
return loc::MemRegionVal(MRMgr.getElementRegion(T, ZeroIdx, ArrayR, Ctx));