diff options
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 6 | ||||
-rw-r--r-- | test/SemaObjC/attr-availability.m | 13 |
2 files changed, 17 insertions, 2 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 3878341ca7..da0fa3e12a 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -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)) { diff --git a/test/SemaObjC/attr-availability.m b/test/SemaObjC/attr-availability.m new file mode 100644 index 0000000000..8511d131e1 --- /dev/null +++ b/test/SemaObjC/attr-availability.m @@ -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]; +} |