summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/BodyFarm.cpp
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2019-01-18 22:52:13 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2019-01-18 22:52:13 +0000
commitc2c47f24f53a064d141eb5ea62ecd76d636edf77 (patch)
treeda7476b9093d0cb6ed2f0cf17e39e329359c5096 /clang/lib/Analysis/BodyFarm.cpp
parent22039df5d17e5d5b6d87a70e01e9e86c54b0138e (diff)
downloadbcm5719-llvm-c2c47f24f53a064d141eb5ea62ecd76d636edf77.tar.gz
bcm5719-llvm-c2c47f24f53a064d141eb5ea62ecd76d636edf77.zip
[analyzer] Do not try to body-farm Objective-C properties with custom accessors.
If a property is defined with a custom getter, we should not behave as if the getter simply returns an instance variable. We don't support setters, so they aren't affected. On top of being the right thing to do, this also fixes a crash on the newly added test - in which a property and its getter are defined in two separate categories. rdar://problem/47051544 Differential Revision: https://reviews.llvm.org/D56823 llvm-svn: 351609
Diffstat (limited to 'clang/lib/Analysis/BodyFarm.cpp')
-rw-r--r--clang/lib/Analysis/BodyFarm.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Analysis/BodyFarm.cpp b/clang/lib/Analysis/BodyFarm.cpp
index 35f04640676..2a682a8ba42 100644
--- a/clang/lib/Analysis/BodyFarm.cpp
+++ b/clang/lib/Analysis/BodyFarm.cpp
@@ -807,6 +807,11 @@ Stmt *BodyFarm::getBody(const ObjCMethodDecl *D) {
D = D->getCanonicalDecl();
+ // We should not try to synthesize explicitly redefined accessors.
+ // We do not know for sure how they behave.
+ if (!D->isImplicit())
+ return nullptr;
+
Optional<Stmt *> &Val = Bodies[D];
if (Val.hasValue())
return Val.getValue();
OpenPOWER on IntegriCloud