From 43bcdb2d4d8390aec89e75f4d232b1fb218a59c5 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Sat, 15 Oct 2011 19:18:36 +0000 Subject: [PATCH] Avoid duplicate unavailbility diagnostics in objc++. // rdar://10268422 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142078 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaExprObjC.cpp | 4 +++- test/SemaObjC/special-dep-unavail-warning.m | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index 20098b2136..a23ba4921c 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -1078,7 +1078,9 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, return ExprError(); } assert(Class && "We don't know which class we're messaging?"); - (void)DiagnoseUseOfDecl(Class, Loc); + // objc++ diagnoses during typename annotation. + if (!getLangOptions().CPlusPlus) + (void)DiagnoseUseOfDecl(Class, Loc); // Find the method we are messaging. if (!Method) { if (Class->isForwardDecl()) { diff --git a/test/SemaObjC/special-dep-unavail-warning.m b/test/SemaObjC/special-dep-unavail-warning.m index 57a2fa3465..fb0f6604e6 100644 --- a/test/SemaObjC/special-dep-unavail-warning.m +++ b/test/SemaObjC/special-dep-unavail-warning.m @@ -43,3 +43,13 @@ void test(C *c) { } +// rdar://10268422 +__attribute ((deprecated)) +@interface DEPRECATED ++(id)new; +@end + +void foo() { + [DEPRECATED new]; // expected-warning {{warning: 'DEPRECATED' is deprecated}} +} + -- 2.40.0