diff options
| author | Alexander Shaposhnikov <shal1t712@gmail.com> | 2017-04-12 22:00:13 +0000 |
|---|---|---|
| committer | Alexander Shaposhnikov <shal1t712@gmail.com> | 2017-04-12 22:00:13 +0000 |
| commit | 5f24c12dc4cfddc598fa8804f2511de391d14ebf (patch) | |
| tree | 005c550199fd6221f38678f7b480038693df4f82 /clang/lib | |
| parent | 0d0d6c2f2515b20ff287107c8d1a07c920558bf1 (diff) | |
| download | bcm5719-llvm-5f24c12dc4cfddc598fa8804f2511de391d14ebf.tar.gz bcm5719-llvm-5f24c12dc4cfddc598fa8804f2511de391d14ebf.zip | |
[analyzer] Add a check for IvarRegion in getExtraInvalidatedValues
This diff adds a defensive check in getExtraInvalidatedValues
for the case when there are no regions for the ivar associated with
a property. Corresponding test case added.
Test plan:
make check-clang
make check-clang-analysis
llvm-svn: 300114
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/CallEvent.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp index ef824b8a3b1..ee761689f47 100644 --- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp +++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp @@ -695,13 +695,15 @@ void ObjCMethodCall::getExtraInvalidatedValues( if (const ObjCPropertyDecl *PropDecl = getAccessedProperty()) { if (const ObjCIvarDecl *PropIvar = PropDecl->getPropertyIvarDecl()) { SVal IvarLVal = getState()->getLValue(PropIvar, getReceiverSVal()); - const MemRegion *IvarRegion = IvarLVal.getAsRegion(); - ETraits->setTrait( + if (const MemRegion *IvarRegion = IvarLVal.getAsRegion()) { + ETraits->setTrait( IvarRegion, RegionAndSymbolInvalidationTraits::TK_DoNotInvalidateSuperRegion); - ETraits->setTrait(IvarRegion, - RegionAndSymbolInvalidationTraits::TK_SuppressEscape); - Values.push_back(IvarLVal); + ETraits->setTrait( + IvarRegion, + RegionAndSymbolInvalidationTraits::TK_SuppressEscape); + Values.push_back(IvarLVal); + } return; } } |

