r248949 - Don't inherit availability information when implementing a protocol requirement.

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 7 11:55:30 PDT 2015


Hi Doug,

On Wed, Sep 30, 2015 at 2:27 PM, Douglas Gregor via cfe-commits
<cfe-commits at 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?

Cheers,
Hans


More information about the cfe-commits mailing list