зеркало из https://github.com/microsoft/clang-1.git
Don't propagate the 'availability' attribute through declaration
merging for overrides. One might want to make a method's availability in a superclass different from that of its subclass. Fixes <rdar://problem/10166223>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140406 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
f1f8b1a404
Коммит
c193dd8441
|
@ -1493,9 +1493,11 @@ static void mergeDeclAttributes(Decl *newDecl, const Decl *oldDecl,
|
|||
for (specific_attr_iterator<InheritableAttr>
|
||||
i = oldDecl->specific_attr_begin<InheritableAttr>(),
|
||||
e = oldDecl->specific_attr_end<InheritableAttr>(); i != e; ++i) {
|
||||
// Ignore deprecated and unavailable attributes if requested.
|
||||
// Ignore deprecated/unavailable/availability attributes if requested.
|
||||
if (!mergeDeprecation &&
|
||||
(isa<DeprecatedAttr>(*i) || isa<UnavailableAttr>(*i)))
|
||||
(isa<DeprecatedAttr>(*i) ||
|
||||
isa<UnavailableAttr>(*i) ||
|
||||
isa<AvailabilityAttr>(*i)))
|
||||
continue;
|
||||
|
||||
if (!DeclHasAttr(newDecl, *i)) {
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||
@interface A
|
||||
- (void)method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2)));
|
||||
@end
|
||||
|
||||
@interface B : A
|
||||
- (void)method;
|
||||
@end
|
||||
|
||||
void f(A *a, B *b) {
|
||||
[a method]; // expected-warning{{'method' is deprecated: first deprecated in Mac OS X 10.2}}
|
||||
[b method];
|
||||
}
|
Загрузка…
Ссылка в новой задаче