summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/BodyFarm.cpp
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2019-12-04 16:26:16 -0800
committerArtem Dergachev <artem.dergachev@gmail.com>2019-12-04 16:29:08 -0800
commit3c50f2544f7a8f0c41f4fc286064abce2d3629b5 (patch)
tree4f06fb5be478ff0e395b1abc1f361802ea486269 /clang/lib/Analysis/BodyFarm.cpp
parent07e445103e363c85ce7313c542dee20b2294fe72 (diff)
downloadbcm5719-llvm-3c50f2544f7a8f0c41f4fc286064abce2d3629b5.tar.gz
bcm5719-llvm-3c50f2544f7a8f0c41f4fc286064abce2d3629b5.zip
[analyzer] Fix more ObjC accessor body farms after 2073dd2d.
Fix a crash when constructing a body farm for accessors of a property that is declared and @synthesize'd in different (but related) interfaces with the explicit ivar syntax. This is a follow-up for 0b58b80e.
Diffstat (limited to 'clang/lib/Analysis/BodyFarm.cpp')
-rw-r--r--clang/lib/Analysis/BodyFarm.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/Analysis/BodyFarm.cpp b/clang/lib/Analysis/BodyFarm.cpp
index 694913b3ac9..1a789155054 100644
--- a/clang/lib/Analysis/BodyFarm.cpp
+++ b/clang/lib/Analysis/BodyFarm.cpp
@@ -741,13 +741,17 @@ static Stmt *createObjCPropertyGetter(ASTContext &Ctx,
// First, find the backing ivar.
const ObjCIvarDecl *IVar = nullptr;
- // Property accessor stubs sometimes do not correspond to any property.
+ // Property accessor stubs sometimes do not correspond to any property decl
+ // in the current interface (but in a superclass). They still have a
+ // corresponding property impl decl in this case.
if (MD->isSynthesizedAccessorStub()) {
const ObjCInterfaceDecl *IntD = MD->getClassInterface();
const ObjCImplementationDecl *ImpD = IntD->getImplementation();
- for (const auto *V: ImpD->ivars()) {
- if (V->getName() == MD->getSelector().getNameForSlot(0))
- IVar = V;
+ for (const auto *PI: ImpD->property_impls()) {
+ if (const ObjCPropertyDecl *P = PI->getPropertyDecl()) {
+ if (P->getGetterName() == MD->getSelector())
+ IVar = P->getPropertyIvarDecl();
+ }
}
}
OpenPOWER on IntegriCloud