summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/ScopeInfo.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2016-03-18 19:03:50 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2016-03-18 19:03:50 +0000
commit4c62c7c981e9c66bb21f7229b715fe833e39b955 (patch)
tree7f0b93a79c8d417b29ba0f70b3050de6d14747ee /clang/lib/Sema/ScopeInfo.cpp
parentfbd7787d7e7ef84973c087bef2e7351717cd2fc9 (diff)
downloadbcm5719-llvm-4c62c7c981e9c66bb21f7229b715fe833e39b955.tar.gz
bcm5719-llvm-4c62c7c981e9c66bb21f7229b715fe833e39b955.zip
[Objective-c] Fix a crash in WeakObjectProfileTy::getBaseInfo.
The crash occurs in WeakObjectProfileTy::getBaseInfo when getBase() is called on an ObjCPropertyRefExpr object whose receiver is an interface. This commit fixes the crash by checking the type of the receiver and setting IsExact to true if it is an interface. rdar://problem/25208167 Differential Revision: http://reviews.llvm.org/D18268 llvm-svn: 263818
Diffstat (limited to 'clang/lib/Sema/ScopeInfo.cpp')
-rw-r--r--clang/lib/Sema/ScopeInfo.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/clang/lib/Sema/ScopeInfo.cpp b/clang/lib/Sema/ScopeInfo.cpp
index ef9eed65ebc..d18328878c7 100644
--- a/clang/lib/Sema/ScopeInfo.cpp
+++ b/clang/lib/Sema/ScopeInfo.cpp
@@ -86,11 +86,15 @@ FunctionScopeInfo::WeakObjectProfileTy::getBaseInfo(const Expr *E) {
if (BaseProp) {
D = getBestPropertyDecl(BaseProp);
- const Expr *DoubleBase = BaseProp->getBase();
- if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(DoubleBase))
- DoubleBase = OVE->getSourceExpr();
-
- IsExact = DoubleBase->isObjCSelfExpr();
+ if (BaseProp->isClassReceiver())
+ IsExact = true;
+ else {
+ const Expr *DoubleBase = BaseProp->getBase();
+ if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(DoubleBase))
+ DoubleBase = OVE->getSourceExpr();
+
+ IsExact = DoubleBase->isObjCSelfExpr();
+ }
}
break;
}
OpenPOWER on IntegriCloud