summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2017-04-13 09:56:07 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2017-04-13 09:56:07 +0000
commit6dd11048f53f3352a5501a506c54a5e5d40e3d19 (patch)
treed06efb5f1368b45b780798f4e3426fd421db8bde /clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
parentd4998b0344b4cd647950f3f3ac2a23d3aadfd4e8 (diff)
downloadbcm5719-llvm-6dd11048f53f3352a5501a506c54a5e5d40e3d19.tar.gz
bcm5719-llvm-6dd11048f53f3352a5501a506c54a5e5d40e3d19.zip
[analyzer] Enforce super-region classes for various memory regions.
We now check the type of the super-region pointer for most SubRegion classes in compile time; some checks are run-time though. This is an API-breaking change (we now require explicit casts to specific region sub-classes), but in practice very few checkers are affected. Differential Revision: https://reviews.llvm.org/D26838 llvm-svn: 300189
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
index ca2e2424b23..03e0095d0e8 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
@@ -512,7 +512,8 @@ void ExprEngine::VisitCXXNewExpr(const CXXNewExpr *CNE, ExplodedNode *Pred,
if (CNE->isArray()) {
// FIXME: allocating an array requires simulating the constructors.
// For now, just return a symbolicated region.
- const MemRegion *NewReg = symVal.castAs<loc::MemRegionVal>().getRegion();
+ const SubRegion *NewReg =
+ symVal.castAs<loc::MemRegionVal>().getRegionAs<SubRegion>();
QualType ObjTy = CNE->getType()->getAs<PointerType>()->getPointeeType();
const ElementRegion *EleReg =
getStoreManager().GetElementZeroRegion(NewReg, ObjTy);
OpenPOWER on IntegriCloud