summaryrefslogtreecommitdiff
path: root/lib/Analysis/BodyFarm.cpp
diff options
context:
space:
mode:
authorDevin Coughlin <dcoughlin@apple.com>2017-01-11 01:02:34 +0000
committerDevin Coughlin <dcoughlin@apple.com>2017-01-11 01:02:34 +0000
commit0fd8210f95926898933e372b6646a3ea69f2cacb (patch)
tree25fbf0eacf8e05212920a769443afee21754f17c /lib/Analysis/BodyFarm.cpp
parentd3062fa1038be154c33a1747c2d3fcfe7b65aa83 (diff)
downloadclang-0fd8210f95926898933e372b6646a3ea69f2cacb.tar.gz
[analyzer] Fix crash in body farm for getter without implicit self.
Fix a crash in body farm when synthesizing a getter for a property synthesized for a property declared in a protocol on a class extension that shadows a declaration of the property in a category. In this case, Sema doesn't fill in the implicit 'self' parameter for the getter in the category, which leads to a crash when trying to synthesize the getter for it. To avoid the crash, skip getter synthesis in body farm if the self parameter is not filled int. rdar://problem/29938138 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291635 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BodyFarm.cpp')
-rw-r--r--lib/Analysis/BodyFarm.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Analysis/BodyFarm.cpp b/lib/Analysis/BodyFarm.cpp
index d202a04064..56c812c34c 100644
--- a/lib/Analysis/BodyFarm.cpp
+++ b/lib/Analysis/BodyFarm.cpp
@@ -467,6 +467,8 @@ static Stmt *createObjCPropertyGetter(ASTContext &Ctx,
ASTMaker M(Ctx);
const VarDecl *selfVar = Prop->getGetterMethodDecl()->getSelfDecl();
+ if (!selfVar)
+ return nullptr;
Expr *loadedIVar =
M.makeObjCIvarRef(