summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2016-07-13 18:07:26 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2016-07-13 18:07:26 +0000
commit50aece03cbf732d67c59ab5125b96064331fd889 (patch)
treed8a39df1c6fd1b5803e8f8a6306fe1035b24e546 /clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
parentc00e48a3db8d7694612c3a358a9017bc79f2f782 (diff)
downloadbcm5719-llvm-50aece03cbf732d67c59ab5125b96064331fd889.tar.gz
bcm5719-llvm-50aece03cbf732d67c59ab5125b96064331fd889.zip
[analyzer] Implement a methond to discover origin region of a symbol.
This encourages checkers to make logical decisions depending on value of which region was the symbol under consideration introduced to denote. A similar technique is already used in a couple of checkers; they were modified to call the new method. Differential Revision: http://reviews.llvm.org/D22242 llvm-svn: 275290
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp b/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
index 50915f399a1..9e863e79e41 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
@@ -315,15 +315,7 @@ void ObjCDeallocChecker::checkBeginFunction(
/// Returns nullptr if the instance symbol cannot be found.
const ObjCIvarRegion *
ObjCDeallocChecker::getIvarRegionForIvarSymbol(SymbolRef IvarSym) const {
- const MemRegion *RegionLoadedFrom = nullptr;
- if (auto *DerivedSym = dyn_cast<SymbolDerived>(IvarSym))
- RegionLoadedFrom = DerivedSym->getRegion();
- else if (auto *RegionSym = dyn_cast<SymbolRegionValue>(IvarSym))
- RegionLoadedFrom = RegionSym->getRegion();
- else
- return nullptr;
-
- return dyn_cast<ObjCIvarRegion>(RegionLoadedFrom);
+ return dyn_cast_or_null<ObjCIvarRegion>(IvarSym->getOriginRegion());
}
/// Given a symbol for an ivar, return a symbol for the instance containing
OpenPOWER on IntegriCloud