On Fri, Oct 9, 2015 at 1:46 PM, Douglas Gregor <dgre...@apple.com> wrote: > >> On Oct 7, 2015, at 11:55 AM, Hans Wennborg <h...@chromium.org> wrote: >> >> Hi Doug, >> >> On Wed, Sep 30, 2015 at 2:27 PM, Douglas Gregor via cfe-commits >> <cfe-commits@lists.llvm.org> wrote: >>> Author: dgregor >>> Date: Wed Sep 30 16:27:42 2015 >>> New Revision: 248949 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=248949&view=rev >>> Log: >>> Don't inherit availability information when implementing a protocol >>> requirement. >>> >>> When an Objective-C method implements a protocol requirement, do not >>> inherit any availability information from the protocol >>> requirement. Rather, check that the implementation is not less >>> available than the protocol requirement, as we do when overriding a >>> method that has availability. Fixes rdar://problem/22734745. >> >> This is causing new warnings to fire in Chromium, and I'm not sure >> they're correct. >> >> For example: >> >> $ cat | build/bin/clang -c -x objective-c++ - >> #import <Cocoa/Cocoa.h> >> @protocol Foo >> @end >> @interface Bar : NSTextView<Foo> { >> } >> @end >> @implementation Bar >> - (void)setMarkedText:(id)aString selectedRange:(NSRange)selRange { >> [super setMarkedText:aString selectedRange:selRange]; >> } >> @end >> <stdin>:9:10: warning: 'setMarkedText:selectedRange:' is deprecated: >> first deprecated in OS X 10.6 [-Wdeprecated-declarations] >> [super setMarkedText:aString selectedRange:selRange]; >> ^ >> /System/Library/Frameworks/AppKit.framework/Headers/NSInputManager.h:21:1: >> note: 'setMarkedText:selectedRange:' has been explicitly marked >> deprecated here >> - (void) setMarkedText:(id)aString selectedRange:(NSRange)selRange >> NS_DEPRECATED_MAC(10_0, 10_6); >> ^ >> >> I don't really know Objective-C, but from what I understand, >> NSTextView implements both NSTextInput and NSTextInputClient. >> setMarkedText is deprecated in the former, but not the latter. So >> warning here is probably wrong? > > The warning is correct. We no longer infer that -[Bar > setMarkedText:selectedRange:] is deprecated simply because it matches up with > a deprecated requirement in the NSTextView protocol. You can mark this method > with > > NS_DEPRECATED_MAC(10_0, 10_6) > > (i.e., copy the availability information from the protocol requirement) to > get the old behavior.
Again, apologies for my Objective-C ignorance here, but don't you mean the other way around? Before this patch we did not warn that setMarkedText was deprecated, but now we do. It seems we've gone from not inferring that it's deprecated to doing so? _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits