[PATCH] D47280: [Sema][ObjC] Do not DiagnoseUseOfDecl in LookupMemberExpr

Steven Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 23 18:05:57 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC333148: [Sema][ObjC] Do not DiagnoseUseOfDecl in LookupMemberExpr (authored by steven_wu, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D47280?vs=148279&id=148327#toc

Repository:
  rC Clang

https://reviews.llvm.org/D47280

Files:
  lib/Sema/SemaExprMember.cpp
  test/SemaObjC/property-deprecated-warning.m


Index: test/SemaObjC/property-deprecated-warning.m
===================================================================
--- test/SemaObjC/property-deprecated-warning.m
+++ test/SemaObjC/property-deprecated-warning.m
@@ -167,3 +167,14 @@
 	foo.x = foo.x; // expected-error {{property access is using 'x' method which is unavailable}} \
 		       // expected-warning {{property access is using 'setX:' method which is deprecated}}
 }
+
+// test implicit property does not emit duplicated warning.
+ at protocol Foo
+- (int)size __attribute__((availability(ios,deprecated=3.0))); // expected-note {{'size' has been explicitly marked deprecated here}}
+- (void)setSize: (int)x __attribute__((availability(ios,deprecated=2.0))); // expected-note {{'setSize:' has been explicitly marked deprecated here}}
+ at end
+
+void testImplicitProperty(id<Foo> object) {
+  object.size = object.size; // expected-warning {{'size' is deprecated: first deprecated in iOS 3.0}} \
+                             // expected-warning {{'setSize:' is deprecated: first deprecated in iOS 2.0}}
+}
Index: lib/Sema/SemaExprMember.cpp
===================================================================
--- lib/Sema/SemaExprMember.cpp
+++ lib/Sema/SemaExprMember.cpp
@@ -1490,9 +1490,6 @@
         }
 
         if (ObjCMethodDecl *OMD = dyn_cast<ObjCMethodDecl>(PMDecl)) {
-          // Check the use of this method.
-          if (S.DiagnoseUseOfDecl(OMD, MemberLoc))
-            return ExprError();
           Selector SetterSel =
             SelectorTable::constructSetterSelector(S.PP.getIdentifierTable(),
                                                    S.PP.getSelectorTable(),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47280.148327.patch
Type: text/x-patch
Size: 1655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180524/15d7f5c6/attachment.bin>


More information about the cfe-commits mailing list