[cfe-commits] r157537 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/Analysis/retain-release.m test/Sema/attr-deprecated.c test/Sema/attr-unavailable-message.c test/SemaCXX/attr-deprecated.cpp test/SemaObjC/attr-deprecated.m test/SemaObjC/protocol-attribute.m test/SemaObjC/special-dep-unavail-warning.m test/SemaObjC/warn-deprecated-implementations.m
Fariborz Jahanian
fjahanian at apple.com
Sun May 27 09:59:48 PDT 2012
Author: fjahanian
Date: Sun May 27 11:59:48 2012
New Revision: 157537
URL: http://llvm.org/viewvc/llvm-project?rev=157537&view=rev
Log:
-Wdeprecated warning to include reference (as a note)
to the declaration in this patch. // rdar://10893232
Modified:
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/Analysis/retain-release.m
cfe/trunk/test/Sema/attr-deprecated.c
cfe/trunk/test/Sema/attr-unavailable-message.c
cfe/trunk/test/SemaCXX/attr-deprecated.cpp
cfe/trunk/test/SemaObjC/attr-deprecated.m
cfe/trunk/test/SemaObjC/protocol-attribute.m
cfe/trunk/test/SemaObjC/special-dep-unavail-warning.m
cfe/trunk/test/SemaObjC/warn-deprecated-implementations.m
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=157537&r1=157536&r2=157537&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Sun May 27 11:59:48 2012
@@ -4489,8 +4489,12 @@
: diag::note_previous_decl) << D->getDeclName();
}
else {
- if (!UnknownObjCClass)
+ if (!UnknownObjCClass) {
Diag(Loc, diag::warn_deprecated) << D->getDeclName();
+ Diag(D->getLocation(),
+ isa<ObjCMethodDecl>(D) ? diag::note_method_declared_at
+ : diag::note_previous_decl) << D->getDeclName();
+ }
else {
Diag(Loc, diag::warn_deprecated_fwdclass_message) << D->getDeclName();
Diag(UnknownObjCClass->getLocation(), diag::note_forward_class);
Modified: cfe/trunk/test/Analysis/retain-release.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release.m?rev=157537&r1=157536&r2=157537&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/retain-release.m (original)
+++ cfe/trunk/test/Analysis/retain-release.m Sun May 27 11:59:48 2012
@@ -199,7 +199,7 @@
typedef void (*IOServiceMatchingCallback)( void * refcon, io_iterator_t iterator );
io_service_t IOServiceGetMatchingService( mach_port_t masterPort, CFDictionaryRef matching );
kern_return_t IOServiceGetMatchingServices( mach_port_t masterPort, CFDictionaryRef matching, io_iterator_t * existing );
-kern_return_t IOServiceAddNotification( mach_port_t masterPort, const io_name_t notificationType, CFDictionaryRef matching, mach_port_t wakePort, uintptr_t reference, io_iterator_t * notification ) __attribute__((deprecated));
+kern_return_t IOServiceAddNotification( mach_port_t masterPort, const io_name_t notificationType, CFDictionaryRef matching, mach_port_t wakePort, uintptr_t reference, io_iterator_t * notification ) __attribute__((deprecated)); // expected-note {{'IOServiceAddNotification' declared here}}
kern_return_t IOServiceAddMatchingNotification( IONotificationPortRef notifyPort, const io_name_t notificationType, CFDictionaryRef matching, IOServiceMatchingCallback callback, void * refCon, io_iterator_t * notification );
CFMutableDictionaryRef IOServiceMatching( const char * name );
CFMutableDictionaryRef IOServiceNameMatching( const char * name );
Modified: cfe/trunk/test/Sema/attr-deprecated.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-deprecated.c?rev=157537&r1=157536&r2=157537&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-deprecated.c (original)
+++ cfe/trunk/test/Sema/attr-deprecated.c Sun May 27 11:59:48 2012
@@ -1,10 +1,10 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
-int f() __attribute__((deprecated));
+int f() __attribute__((deprecated)); // expected-note {{declared here}}
void g() __attribute__((deprecated));
-void g();
+void g(); // expected-note {{declared here}}
-extern int var __attribute__((deprecated));
+extern int var __attribute__((deprecated)); // expected-note {{declared here}}
int a() {
int (*ptr)() = f; // expected-warning {{'f' is deprecated}}
@@ -17,7 +17,7 @@
}
// test if attributes propagate to variables
-extern int var;
+extern int var; // expected-note {{declared here}}
int w() {
return var; // expected-warning {{'var' is deprecated}}
}
@@ -32,7 +32,7 @@
struct foo {
- int x __attribute__((deprecated));
+ int x __attribute__((deprecated)); // expected-note {{declared here}}
};
void test1(struct foo *F) {
@@ -41,7 +41,7 @@
struct foo f2 = { 17 }; // expected-warning {{'x' is deprecated}}
}
-typedef struct foo foo_dep __attribute__((deprecated));
+typedef struct foo foo_dep __attribute__((deprecated)); // expected-note 3 {{declared here}}
foo_dep *test2; // expected-warning {{'foo_dep' is deprecated}}
struct __attribute__((deprecated,
@@ -103,8 +103,8 @@
// rdar://problem/8518751
enum __attribute__((deprecated)) Test20 {
- test20_a __attribute__((deprecated)),
- test20_b
+ test20_a __attribute__((deprecated)), // expected-note {{declared here}}
+ test20_b // expected-note {{declared here}}
};
void test20() {
enum Test20 f; // expected-warning {{'Test20' is deprecated}}
Modified: cfe/trunk/test/Sema/attr-unavailable-message.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-unavailable-message.c?rev=157537&r1=157536&r2=157537&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-unavailable-message.c (original)
+++ cfe/trunk/test/Sema/attr-unavailable-message.c Sun May 27 11:59:48 2012
@@ -30,7 +30,7 @@
// rdar://10201690
enum foo {
a = 1,
- b __attribute__((deprecated())) = 2,
+ b __attribute__((deprecated())) = 2, // expected-note {{declared here}}
c = 3
}__attribute__((deprecated()));
Modified: cfe/trunk/test/SemaCXX/attr-deprecated.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-deprecated.cpp?rev=157537&r1=157536&r2=157537&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/attr-deprecated.cpp (original)
+++ cfe/trunk/test/SemaCXX/attr-deprecated.cpp Sun May 27 11:59:48 2012
@@ -1,10 +1,10 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
class A {
- void f() __attribute__((deprecated));
+ void f() __attribute__((deprecated)); // expected-note 2 {{declared here}}
void g(A* a);
void h(A* a) __attribute__((deprecated));
- int b __attribute__((deprecated));
+ int b __attribute__((deprecated)); // expected-note 2 {{declared here}}
};
void A::g(A* a)
@@ -26,7 +26,7 @@
}
struct B {
- virtual void f() __attribute__((deprecated));
+ virtual void f() __attribute__((deprecated)); // expected-note 4 {{declared here}}
void g();
};
@@ -68,20 +68,20 @@
// Overloaded namespace members.
namespace test1 {
- void foo(int) __attribute__((deprecated));
+ void foo(int) __attribute__((deprecated)); // expected-note {{declared here}}
void test1() { foo(10); } // expected-warning {{deprecated}}
- void foo(short) __attribute__((deprecated));
+ void foo(short) __attribute__((deprecated)); // expected-note {{declared here}}
void test2(short s) { foo(s); } // expected-warning {{deprecated}}
void foo(long);
void test3(long l) { foo(l); }
struct A {
- friend void foo(A*) __attribute__((deprecated));
+ friend void foo(A*) __attribute__((deprecated)); // expected-note {{declared here}}
};
void test4(A *a) { foo(a); } // expected-warning {{deprecated}}
namespace ns {
struct Foo {};
- void foo(const Foo &f) __attribute__((deprecated));
+ void foo(const Foo &f) __attribute__((deprecated)); // expected-note {{declared here}}
}
void test5() {
foo(ns::Foo()); // expected-warning {{deprecated}}
@@ -91,9 +91,9 @@
// Overloaded class members.
namespace test2 {
struct A {
- void foo(int) __attribute__((deprecated));
+ void foo(int) __attribute__((deprecated)); // expected-note 2 {{declared here}}
void foo(long);
- static void bar(int) __attribute__((deprecated));
+ static void bar(int) __attribute__((deprecated)); // expected-note 3 {{declared here}}
static void bar(long);
void test2(int i, long l);
@@ -120,12 +120,12 @@
namespace test3 {
struct A {
void operator*(const A &);
- void operator*(int) __attribute__((deprecated));
+ void operator*(int) __attribute__((deprecated)); // expected-note {{declared here}}
void operator-(const A &) const;
};
void operator+(const A &, const A &);
- void operator+(const A &, int) __attribute__((deprecated));
- void operator-(const A &, int) __attribute__((deprecated));
+ void operator+(const A &, int) __attribute__((deprecated)); // expected-note {{declared here}}
+ void operator-(const A &, int) __attribute__((deprecated)); // expected-note {{declared here}}
void test() {
A a, b;
@@ -143,9 +143,9 @@
struct A {
typedef void (*intfn)(int);
typedef void (*unintfn)(unsigned);
- operator intfn() __attribute__((deprecated));
+ operator intfn() __attribute__((deprecated)); // expected-note {{declared here}}
operator unintfn();
- void operator ()(A &) __attribute__((deprecated));
+ void operator ()(A &) __attribute__((deprecated)); // expected-note {{declared here}}
void operator ()(const A &);
};
@@ -163,7 +163,7 @@
namespace test5 {
struct A {
- operator int() __attribute__((deprecated));
+ operator int() __attribute__((deprecated)); // expected-note 2 {{declared here}}
operator long();
};
void test1(A a) {
@@ -193,8 +193,8 @@
// rdar://problem/8518751
namespace test6 {
- enum __attribute__((deprecated)) A {
- a0
+ enum __attribute__((deprecated)) A { // expected-note {{declared here}}
+ a0 // expected-note {{declared here}}
};
void testA() {
A x; // expected-warning {{'A' is deprecated}}
@@ -202,7 +202,7 @@
}
enum B {
- b0 __attribute__((deprecated)),
+ b0 __attribute__((deprecated)), // expected-note {{declared here}}
b1
};
void testB() {
@@ -212,8 +212,8 @@
}
template <class T> struct C {
- enum __attribute__((deprecated)) Enum {
- c0
+ enum __attribute__((deprecated)) Enum { // expected-note {{declared here}}
+ c0 // expected-note {{declared here}}
};
};
void testC() {
@@ -224,7 +224,7 @@
template <class T> struct D {
enum Enum {
d0,
- d1 __attribute__((deprecated)),
+ d1 __attribute__((deprecated)), // expected-note {{declared here}}
};
};
void testD() {
Modified: cfe/trunk/test/SemaObjC/attr-deprecated.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/attr-deprecated.m?rev=157537&r1=157536&r2=157537&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/attr-deprecated.m (original)
+++ cfe/trunk/test/SemaObjC/attr-deprecated.m Sun May 27 11:59:48 2012
@@ -1,10 +1,10 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
@interface A {
- int X __attribute__((deprecated));
+ int X __attribute__((deprecated)); // expected-note 2 {{declared here}}
}
-+ (void)F __attribute__((deprecated));
-- (void)f __attribute__((deprecated));
++ (void)F __attribute__((deprecated)); // expected-note 2 {{declared here}}
+- (void)f __attribute__((deprecated)); // expected-note 4 {{declared here}}
@end
@implementation A
@@ -42,7 +42,7 @@
@end
@protocol P
-- (void)p __attribute__((deprecated));
+- (void)p __attribute__((deprecated)); // expected-note {{declared here}}
@end
void t1(A *a)
@@ -71,7 +71,7 @@
@interface Bar
- at property (assign, setter = MySetter:) int FooBar __attribute__ ((deprecated));
+ at property (assign, setter = MySetter:) int FooBar __attribute__ ((deprecated)); // expected-note 2 {{declared here}}
- (void) MySetter : (int) value;
@end
@@ -83,7 +83,7 @@
__attribute ((deprecated))
- at interface DEPRECATED {
+ at interface DEPRECATED { // expected-note 2 {{declared here}}
@public int ivar;
DEPRECATED *ivar2; // no warning.
}
@@ -107,7 +107,7 @@
@interface Test2
- at property int test2 __attribute__((deprecated));
+ at property int test2 __attribute__((deprecated)); // expected-note 4 {{declared here}}
@end
void test(Test2 *foo) {
Modified: cfe/trunk/test/SemaObjC/protocol-attribute.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/protocol-attribute.m?rev=157537&r1=157536&r2=157537&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/protocol-attribute.m (original)
+++ cfe/trunk/test/SemaObjC/protocol-attribute.m Sun May 27 11:59:48 2012
@@ -6,7 +6,7 @@
Class <FwProto> cFw = 0; // expected-error {{'FwProto' is unavailable}}
-__attribute ((deprecated)) @protocol MyProto1
+__attribute ((deprecated)) @protocol MyProto1 // expected-note 5 {{declared here}}
@end
@protocol Proto2 <MyProto1> // expected-warning {{'MyProto1' is deprecated}}
Modified: cfe/trunk/test/SemaObjC/special-dep-unavail-warning.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/special-dep-unavail-warning.m?rev=157537&r1=157536&r2=157537&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/special-dep-unavail-warning.m (original)
+++ cfe/trunk/test/SemaObjC/special-dep-unavail-warning.m Sun May 27 11:59:48 2012
@@ -45,7 +45,7 @@
// rdar://10268422
__attribute ((deprecated))
- at interface DEPRECATED
+ at interface DEPRECATED // expected-note {{declared here}}
+(id)new;
@end
Modified: cfe/trunk/test/SemaObjC/warn-deprecated-implementations.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/warn-deprecated-implementations.m?rev=157537&r1=157536&r2=157537&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/warn-deprecated-implementations.m (original)
+++ cfe/trunk/test/SemaObjC/warn-deprecated-implementations.m Sun May 27 11:59:48 2012
@@ -20,7 +20,7 @@
@end
__attribute__((deprecated))
- at interface CL // expected-note 2 {{class declared here}}
+ at interface CL // expected-note 2 {{class declared here}} // expected-note 2 {{declared here}}
@end
@implementation CL // expected-warning {{Implementing deprecated class}}
More information about the cfe-commits
mailing list