aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/SVals.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-09-17 19:13:56 +0000
committerAnna Zaks <ganna@apple.com>2012-09-17 19:13:56 +0000
commit5fc1d0c4532c55cc47ba6628f296bf5b86d2eaf0 (patch)
tree1b5bccfa211ebe104df8f5bc7151e2ca29ab9458 /lib/StaticAnalyzer/Core/SVals.cpp
parent1fac58a2ff3c56a18765b2c7395ed91ac7b80544 (diff)
[analyzer] Teach the analyzer about implicit initialization of statics
in ObjCMethods. Extend FunctionTextRegion to represent ObjC methods as well as functions. Note, it is not clear what type ObjCMethod region should return. Since the type of the FunctionText region is not currently used, defer solving this issue. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164046 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/SVals.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/SVals.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Core/SVals.cpp b/lib/StaticAnalyzer/Core/SVals.cpp
index 8437f50f91..e34ab6a2be 100644
--- a/lib/StaticAnalyzer/Core/SVals.cpp
+++ b/lib/StaticAnalyzer/Core/SVals.cpp
@@ -51,7 +51,8 @@ const FunctionDecl *SVal::getAsFunctionDecl() const {
if (const loc::MemRegionVal* X = dyn_cast<loc::MemRegionVal>(this)) {
const MemRegion* R = X->getRegion();
if (const FunctionTextRegion *CTR = R->getAs<FunctionTextRegion>())
- return CTR->getDecl();
+ if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(CTR->getDecl()))
+ return FD;
}
return 0;