diff options
author | Artem Dergachev <artem.dergachev@gmail.com> | 2018-08-29 22:43:31 +0000 |
---|---|---|
committer | Artem Dergachev <artem.dergachev@gmail.com> | 2018-08-29 22:43:31 +0000 |
commit | 4e864b8329a73a323fd9e4cf28e702b7b10708b0 (patch) | |
tree | 2086a75d0e99391912e0f24799592fe7a135745a /clang/lib/StaticAnalyzer/Core/RegionStore.cpp | |
parent | 1e4498869d7f4a9c22336bfe9ba50560831478d5 (diff) | |
download | bcm5719-llvm-4e864b8329a73a323fd9e4cf28e702b7b10708b0.tar.gz bcm5719-llvm-4e864b8329a73a323fd9e4cf28e702b7b10708b0.zip |
[analyzer] Support modeling no-op BaseToDerived casts in ExprEngine.
Introduce a new MemRegion sub-class, CXXDerivedObjectRegion, which is
the opposite of CXXBaseObjectRegion, to represent such casts. Such region is
a bit weird because it is by design bigger than its super-region.
But it's not harmful when it is put on top of a SymbolicRegion
that has unknown extent anyway.
Offset computation for CXXDerivedObjectRegion and proper modeling of casts
still remains to be implemented.
Differential Revision: https://reviews.llvm.org/D51191
llvm-svn: 340984
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/RegionStore.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/RegionStore.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp index a0fae69f6a0..02062e7b163 100644 --- a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp +++ b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -62,7 +62,9 @@ private: : P(r, k), Data(offset) { assert(r && "Must have known regions."); assert(getOffset() == offset && "Failed to store offset"); - assert((r == r->getBaseRegion() || isa<ObjCIvarRegion>(r)) && "Not a base"); + assert((r == r->getBaseRegion() || isa<ObjCIvarRegion>(r) || + isa <CXXDerivedObjectRegion>(r)) && + "Not a base"); } public: |