summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/include/clang/Sema/ScopeInfo.h1
-rw-r--r--clang/lib/Sema/ScopeInfo.cpp4
-rw-r--r--clang/test/SemaObjC/arc-repeated-weak.mm11
3 files changed, 13 insertions, 3 deletions
diff --git a/clang/include/clang/Sema/ScopeInfo.h b/clang/include/clang/Sema/ScopeInfo.h
index 0ec59cd3806..c57a59db8ec 100644
--- a/clang/include/clang/Sema/ScopeInfo.h
+++ b/clang/include/clang/Sema/ScopeInfo.h
@@ -189,6 +189,7 @@ public:
/// [self foo].prop | 0 (unknown) | prop (ObjCPropertyDecl)
/// self.prop1.prop2 | prop1 (ObjCPropertyDecl) | prop2 (ObjCPropertyDecl)
/// MyClass.prop | MyClass (ObjCInterfaceDecl) | -prop (ObjCMethodDecl)
+ /// MyClass.foo.prop | +foo (ObjCMethodDecl) | -prop (ObjCPropertyDecl)
/// weakVar | 0 (known) | weakVar (VarDecl)
/// self->weakIvar | self (VarDecl) | weakIvar (ObjCIvarDecl)
///
diff --git a/clang/lib/Sema/ScopeInfo.cpp b/clang/lib/Sema/ScopeInfo.cpp
index d18328878c7..037ffd843bb 100644
--- a/clang/lib/Sema/ScopeInfo.cpp
+++ b/clang/lib/Sema/ScopeInfo.cpp
@@ -86,9 +86,7 @@ FunctionScopeInfo::WeakObjectProfileTy::getBaseInfo(const Expr *E) {
if (BaseProp) {
D = getBestPropertyDecl(BaseProp);
- if (BaseProp->isClassReceiver())
- IsExact = true;
- else {
+ if (BaseProp->isObjectReceiver()) {
const Expr *DoubleBase = BaseProp->getBase();
if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(DoubleBase))
DoubleBase = OVE->getSourceExpr();
diff --git a/clang/test/SemaObjC/arc-repeated-weak.mm b/clang/test/SemaObjC/arc-repeated-weak.mm
index 7ac2313fa31..11161a0bf7f 100644
--- a/clang/test/SemaObjC/arc-repeated-weak.mm
+++ b/clang/test/SemaObjC/arc-repeated-weak.mm
@@ -445,9 +445,20 @@ void doubleLevelAccessIvar(Test *a, Test *b) {
@class NSString;
@interface NSBundle
+(NSBundle *)foo;
+@property (class) NSBundle *foo2;
@property NSString *prop;
+@property(weak) NSString *weakProp;
+@end
+
+@interface NSBundle2 : NSBundle
@end
void foo() {
NSString * t = NSBundle.foo.prop;
+ use(NSBundle.foo.weakProp); // expected-warning{{weak property 'weakProp' may be accessed multiple times}}
+ use(NSBundle2.foo.weakProp); // expected-note{{also accessed here}}
+
+ NSString * t2 = NSBundle.foo2.prop;
+ use(NSBundle.foo2.weakProp); // expected-warning{{weak property 'weakProp' may be accessed multiple times}}
+ use(NSBundle2.foo2.weakProp); // expected-note{{also accessed here}}
}
OpenPOWER on IntegriCloud