[cfe-commits] r155385 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/Sema/MicrosoftExtensions.c test/Sema/attr-availability-ios.c test/Sema/attr-availability-macosx.c test/Sema/attr-availability.c test/Sema/attr-deprecated-message.c test/SemaObjC/attr-availability.m
Fariborz Jahanian
fjahanian at apple.com
Mon Apr 23 13:30:52 PDT 2012
Author: fjahanian
Date: Mon Apr 23 15:30:52 2012
New Revision: 155385
URL: http://llvm.org/viewvc/llvm-project?rev=155385&view=rev
Log:
with -Wdeprecated, include a note to its deprecated declaration
location. // rdar://10893232
Modified:
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/Sema/MicrosoftExtensions.c
cfe/trunk/test/Sema/attr-availability-ios.c
cfe/trunk/test/Sema/attr-availability-macosx.c
cfe/trunk/test/Sema/attr-availability.c
cfe/trunk/test/Sema/attr-deprecated-message.c
cfe/trunk/test/SemaObjC/attr-availability.m
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=155385&r1=155384&r2=155385&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Mon Apr 23 15:30:52 2012
@@ -4189,9 +4189,13 @@
// Otherwise, don't warn if our current context is deprecated.
if (isDeclDeprecated(cast<Decl>(getCurLexicalContext())))
return;
- if (!Message.empty())
+ if (!Message.empty()) {
Diag(Loc, diag::warn_deprecated_message) << D->getDeclName()
<< Message;
+ Diag(D->getLocation(),
+ isa<ObjCMethodDecl>(D) ? diag::note_method_declared_at
+ : diag::note_previous_decl) << D->getDeclName();
+ }
else {
if (!UnknownObjCClass)
Diag(Loc, diag::warn_deprecated) << D->getDeclName();
Modified: cfe/trunk/test/Sema/MicrosoftExtensions.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/MicrosoftExtensions.c?rev=155385&r1=155384&r2=155385&view=diff
==============================================================================
--- cfe/trunk/test/Sema/MicrosoftExtensions.c (original)
+++ cfe/trunk/test/Sema/MicrosoftExtensions.c Mon Apr 23 15:30:52 2012
@@ -87,11 +87,11 @@
AA; // expected-warning {{anonymous structs are a Microsoft extension}}
} BB;
-__declspec(deprecated("This is deprecated")) enum DE1 { one, two } e1;
+__declspec(deprecated("This is deprecated")) enum DE1 { one, two } e1; // expected-note {{'e1' declared here}}
struct __declspec(deprecated) DS1 { int i; float f; };
#define MY_TEXT "This is also deprecated"
-__declspec(deprecated(MY_TEXT)) void Dfunc1( void ) {}
+__declspec(deprecated(MY_TEXT)) void Dfunc1( void ) {} // expected-note {{'Dfunc1' declared here}}
void test( void ) {
e1 = one; // expected-warning {{'e1' is deprecated: This is deprecated}}
Modified: cfe/trunk/test/Sema/attr-availability-ios.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-availability-ios.c?rev=155385&r1=155384&r2=155385&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-availability-ios.c (original)
+++ cfe/trunk/test/Sema/attr-availability-ios.c Mon Apr 23 15:30:52 2012
@@ -1,14 +1,14 @@
// RUN: %clang_cc1 "-triple" "x86_64-apple-ios3.0" -fsyntax-only -verify %s
-void f0(int) __attribute__((availability(ios,introduced=2.0,deprecated=2.1)));
+void f0(int) __attribute__((availability(ios,introduced=2.0,deprecated=2.1))); // expected-note {{'f0' declared here}}
void f1(int) __attribute__((availability(ios,introduced=2.1)));
-void f2(int) __attribute__((availability(ios,introduced=2.0,deprecated=3.0)));
+void f2(int) __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{'f2' declared here}}
void f3(int) __attribute__((availability(ios,introduced=3.0)));
void f4(int) __attribute__((availability(macosx,introduced=10.1,deprecated=10.3,obsoleted=10.5), availability(ios,introduced=2.0,deprecated=2.1,obsoleted=3.0))); // expected-note{{explicitly marked unavailable}}
-void f5(int) __attribute__((availability(ios,introduced=2.0))) __attribute__((availability(ios,deprecated=3.0)));
+void f5(int) __attribute__((availability(ios,introduced=2.0))) __attribute__((availability(ios,deprecated=3.0))); // expected-note {{'f5' declared here}}
void f6(int) __attribute__((availability(ios,deprecated=3.0)));
-void f6(int) __attribute__((availability(ios,introduced=2.0)));
+void f6(int) __attribute__((availability(ios,introduced=2.0))); // expected-note {{'f6' declared here}}
void test() {
f0(0); // expected-warning{{'f0' is deprecated: first deprecated in iOS 2.1}}
Modified: cfe/trunk/test/Sema/attr-availability-macosx.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-availability-macosx.c?rev=155385&r1=155384&r2=155385&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-availability-macosx.c (original)
+++ cfe/trunk/test/Sema/attr-availability-macosx.c Mon Apr 23 15:30:52 2012
@@ -2,7 +2,7 @@
void f0(int) __attribute__((availability(macosx,introduced=10.4,deprecated=10.6)));
void f1(int) __attribute__((availability(macosx,introduced=10.5)));
-void f2(int) __attribute__((availability(macosx,introduced=10.4,deprecated=10.5)));
+void f2(int) __attribute__((availability(macosx,introduced=10.4,deprecated=10.5))); // expected-note {{'f2' declared here}}
void f3(int) __attribute__((availability(macosx,introduced=10.6)));
void f4(int) __attribute__((availability(macosx,introduced=10.1,deprecated=10.3,obsoleted=10.5), availability(ios,introduced=2.0,deprecated=3.0))); // expected-note{{explicitly marked unavailable}}
void f5(int) __attribute__((availability(ios,introduced=3.2), availability(macosx,unavailable))); // expected-note{{function has been explicitly marked unavailable here}}
Modified: cfe/trunk/test/Sema/attr-availability.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-availability.c?rev=155385&r1=155384&r2=155385&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-availability.c (original)
+++ cfe/trunk/test/Sema/attr-availability.c Mon Apr 23 15:30:52 2012
@@ -8,7 +8,7 @@
// rdar://10095131
extern void
-ATSFontGetName(const char *oName) __attribute__((availability(macosx,introduced=8.0,deprecated=9.0, message="use CTFontCopyFullName")));
+ATSFontGetName(const char *oName) __attribute__((availability(macosx,introduced=8.0,deprecated=9.0, message="use CTFontCopyFullName"))); // expected-note {{'ATSFontGetName' declared here}}
extern void
ATSFontGetPostScriptName(int flags) __attribute__((availability(macosx,introduced=8.0,obsoleted=9.0, message="use ATSFontGetFullPostScriptName"))); // expected-note {{function has been explicitly marked unavailable here}}
Modified: cfe/trunk/test/Sema/attr-deprecated-message.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-deprecated-message.c?rev=155385&r1=155384&r2=155385&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-deprecated-message.c (original)
+++ cfe/trunk/test/Sema/attr-deprecated-message.c Mon Apr 23 15:30:52 2012
@@ -21,7 +21,7 @@
Color c1; // expected-warning {{'Color' is deprecated: Please avoid Color}}
int g1;
-int g2 __attribute__ ((deprecated("Please avoid g2")));
+int g2 __attribute__ ((deprecated("Please avoid g2"))); // expected-note {{'g2' declared here}}
int func1()
{
Modified: cfe/trunk/test/SemaObjC/attr-availability.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/attr-availability.m?rev=155385&r1=155384&r2=155385&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/attr-availability.m (original)
+++ cfe/trunk/test/SemaObjC/attr-availability.m Mon Apr 23 15:30:52 2012
@@ -1,6 +1,11 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin9.0.0 -fsyntax-only -verify %s
- at interface A
-- (void)method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2)));
+
+ at protocol P
+- (void)proto_method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); // expected-note 2 {{method 'proto_method' declared here}}
+ at end
+
+ at interface A <P>
+- (void)method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); // expected-note {{method 'method' declared here}}
@end
@interface B : A
@@ -10,4 +15,6 @@
void f(A *a, B *b) {
[a method]; // expected-warning{{'method' is deprecated: first deprecated in Mac OS X 10.2}}
[b method];
+ [a proto_method]; // expected-warning{{'proto_method' is deprecated: first deprecated in Mac OS X 10.2}}
+ [b proto_method]; // expected-warning{{'proto_method' is deprecated: first deprecated in Mac OS X 10.2}}
}
More information about the cfe-commits
mailing list