diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-12-12 19:13:44 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-12-12 19:13:44 +0000 |
commit | 4f69eb4daa3c5ce8b88535fc560f2ee102a580f4 (patch) | |
tree | 6c3b4396a300701f730c2613e4331ae1e88947c9 /lib/StaticAnalyzer/Core/ExprEngineCXX.cpp | |
parent | df76f1ea801a60a422812b20bd0bfa6ab51cecf8 (diff) |
[analyzer] Don't crash running destructors for multidimensional arrays.
We don't handle array destructors correctly yet, but we now apply the same
hack (explicitly destroy the first element, implicitly invalidate the rest)
for multidimensional arrays that we already use for linear arrays.
<rdar://problem/12858542>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170000 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/ExprEngineCXX.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/ExprEngineCXX.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp b/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp index b3a4a8a8fe..1f0c523ac6 100644 --- a/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp +++ b/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp @@ -172,7 +172,8 @@ void ExprEngine::VisitCXXDestructor(QualType ObjectType, // FIXME: We need to run the same destructor on every element of the array. // This workaround will just run the first destructor (which will still // invalidate the entire array). - if (const ArrayType *AT = getContext().getAsArrayType(ObjectType)) { + // This is a loop because of multidimensional arrays. + while (const ArrayType *AT = getContext().getAsArrayType(ObjectType)) { ObjectType = AT->getElementType(); Dest = State->getLValue(ObjectType, getSValBuilder().makeZeroArrayIndex(), loc::MemRegionVal(Dest)).getAsRegion(); |