Implemented delayed processing of 'unavailable' checking, just like with 'deprecated'.
Fixes <rdar://problem/15584219> and <rdar://problem/12241361>.
This change looks large, but all it does is reuse and consolidate
the delayed diagnostic logic for deprecation warnings with unavailability
warnings. By doing so, it showed various inconsistencies between the
diagnostics, which were close, but not consistent. It also revealed
some missing "note:"'s in the deprecated diagnostics that were showing
up in the unavailable diagnostics, etc.
This change also changes the wording of the core deprecation diagnostics.
Instead of saying "function has been explicitly marked deprecated"
we now saw "'X' has been been explicitly marked deprecated". It
turns out providing a bit more context is useful, and often we
got the actual term wrong or it was not very precise
(e.g., "function" instead of "destructor"). By just saying the name
of the thing that is deprecated/deleted/unavailable we define
this issue away. This diagnostic can likely be further wordsmithed
to be shorter.
llvm-svn: 197627
diff --git a/clang/test/Sema/MicrosoftExtensions.c b/clang/test/Sema/MicrosoftExtensions.c
index e672d05..4441f17 100644
--- a/clang/test/Sema/MicrosoftExtensions.c
+++ b/clang/test/Sema/MicrosoftExtensions.c
@@ -87,11 +87,11 @@
AA; // expected-warning {{anonymous structs are a Microsoft extension}}
} BB;
-__declspec(deprecated("This is deprecated")) enum DE1 { one, two } e1; // expected-note {{'e1' declared here}}
-struct __declspec(deprecated) DS1 { int i; float f; }; // expected-note {{declared here}}
+__declspec(deprecated("This is deprecated")) enum DE1 { one, two } e1; // expected-note {{'e1' has been explicitly marked deprecated here}}
+struct __declspec(deprecated) DS1 { int i; float f; }; // expected-note {{'DS1' has been explicitly marked deprecated here}}
#define MY_TEXT "This is also deprecated"
-__declspec(deprecated(MY_TEXT)) void Dfunc1( void ) {} // expected-note {{'Dfunc1' declared here}}
+__declspec(deprecated(MY_TEXT)) void Dfunc1( void ) {} // expected-note {{'Dfunc1' has been explicitly marked deprecated here}}
struct __declspec(deprecated(123)) DS2 {}; // expected-error {{'deprecated' attribute requires a string}}
diff --git a/clang/test/Sema/attr-availability-ios.c b/clang/test/Sema/attr-availability-ios.c
index 329068c..6462d58 100644
--- a/clang/test/Sema/attr-availability-ios.c
+++ b/clang/test/Sema/attr-availability-ios.c
@@ -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))); // expected-note {{'f0' declared here}}
+void f0(int) __attribute__((availability(ios,introduced=2.0,deprecated=2.1))); // expected-note {{'f0' has been explicitly marked deprecated here}}
void f1(int) __attribute__((availability(ios,introduced=2.1)));
-void f2(int) __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{'f2' declared here}}
+void f2(int) __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{'f2' has been explicitly marked deprecated 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))); // expected-note {{'f5' declared here}}
+void f5(int) __attribute__((availability(ios,introduced=2.0))) __attribute__((availability(ios,deprecated=3.0))); // expected-note {{'f5' has been explicitly marked deprecated here}}
void f6(int) __attribute__((availability(ios,deprecated=3.0)));
-void f6(int) __attribute__((availability(ios,introduced=2.0))); // expected-note {{'f6' declared here}}
+void f6(int) __attribute__((availability(ios,introduced=2.0))); // expected-note {{'f6' has been explicitly marked deprecated here}}
void test() {
f0(0); // expected-warning{{'f0' is deprecated: first deprecated in iOS 2.1}}
diff --git a/clang/test/Sema/attr-availability-macosx.c b/clang/test/Sema/attr-availability-macosx.c
index 468e930..38f149b 100644
--- a/clang/test/Sema/attr-availability-macosx.c
+++ b/clang/test/Sema/attr-availability-macosx.c
@@ -2,10 +2,10 @@
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))); // expected-note {{'f2' declared here}}
+void f2(int) __attribute__((availability(macosx,introduced=10.4,deprecated=10.5))); // expected-note {{'f2' has been explicitly marked deprecated 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}}
+void f5(int) __attribute__((availability(ios,introduced=3.2), availability(macosx,unavailable))); // expected-note{{'f5' has been explicitly marked unavailable here}}
void test() {
f0(0);
diff --git a/clang/test/Sema/attr-availability.c b/clang/test/Sema/attr-availability.c
index ac6a187..b7a8e6e 100644
--- a/clang/test/Sema/attr-availability.c
+++ b/clang/test/Sema/attr-availability.c
@@ -8,10 +8,10 @@
// rdar://10095131
extern void
-ATSFontGetName(const char *oName) __attribute__((availability(macosx,introduced=8.0,deprecated=9.0, message="use CTFontCopyFullName"))); // expected-note {{'ATSFontGetName' declared here}}
+ATSFontGetName(const char *oName) __attribute__((availability(macosx,introduced=8.0,deprecated=9.0, message="use CTFontCopyFullName"))); // expected-note {{'ATSFontGetName' has been explicitly marked deprecated 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}}
+ATSFontGetPostScriptName(int flags) __attribute__((availability(macosx,introduced=8.0,obsoleted=9.0, message="use ATSFontGetFullPostScriptName"))); // expected-note {{'ATSFontGetPostScriptName' has been explicitly marked unavailable here}}
void test_10095131() {
ATSFontGetName("Hello"); // expected-warning {{'ATSFontGetName' is deprecated: first deprecated in OS X 9.0 - use CTFontCopyFullName}}
diff --git a/clang/test/Sema/attr-cleanup.c b/clang/test/Sema/attr-cleanup.c
index f5cbc38..26f283a 100644
--- a/clang/test/Sema/attr-cleanup.c
+++ b/clang/test/Sema/attr-cleanup.c
@@ -38,7 +38,7 @@
__attribute((cleanup(c4))) void* g;
}
-void c5(void*) __attribute__((deprecated)); // expected-note{{'c5' declared here}}
+void c5(void*) __attribute__((deprecated)); // expected-note{{'c5' has been explicitly marked deprecated here}}
void t5() {
int i __attribute__((cleanup(c5))); // expected-warning {{'c5' is deprecated}}
}
diff --git a/clang/test/Sema/attr-deprecated-message.c b/clang/test/Sema/attr-deprecated-message.c
index f48d13e..c683061 100644
--- a/clang/test/Sema/attr-deprecated-message.c
+++ b/clang/test/Sema/attr-deprecated-message.c
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
// rdar: // 6734520
-typedef int INT1 __attribute__((deprecated("Please avoid INT1"))); // expected-note 3 {{'INT1' declared here}}
+typedef int INT1 __attribute__((deprecated("Please avoid INT1"))); // expected-note 3 {{'INT1' has been explicitly marked deprecated here}}
typedef INT1 INT2 __attribute__ ((__deprecated__("Please avoid INT2")));
@@ -12,16 +12,16 @@
INT1 should_be_unavailable; // expected-warning {{'INT1' is deprecated: Please avoid INT1}}
INT1a should_not_be_deprecated;
-INT1 f1(void) __attribute__ ((deprecated("Please avoid f1"))); // expected-note {{'f1' declared here}}
+INT1 f1(void) __attribute__ ((deprecated("Please avoid f1"))); // expected-note {{'f1' has been explicitly marked deprecated here}}
INT1 f2(void); // expected-warning {{'INT1' is deprecated: Please avoid INT1}}
-typedef enum {red, green, blue} Color __attribute__((deprecated("Please avoid Color"))); // expected-note {{'Color' declared here}}
+typedef enum {red, green, blue} Color __attribute__((deprecated("Please avoid Color"))); // expected-note {{'Color' has been explicitly marked deprecated here}}
Color c1; // expected-warning {{'Color' is deprecated: Please avoid Color}}
int g1;
-int g2 __attribute__ ((deprecated("Please avoid g2"))); // expected-note {{'g2' declared here}}
+int g2 __attribute__ ((deprecated("Please avoid g2"))); // expected-note {{'g2' has been explicitly marked deprecated here}}
int func1()
{
diff --git a/clang/test/Sema/attr-deprecated.c b/clang/test/Sema/attr-deprecated.c
index 8124ab0..c9e3dd5 100644
--- a/clang/test/Sema/attr-deprecated.c
+++ b/clang/test/Sema/attr-deprecated.c
@@ -1,10 +1,10 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
-int f() __attribute__((deprecated)); // expected-note 2 {{declared here}}
+int f() __attribute__((deprecated)); // expected-note 2 {{'f' has been explicitly marked deprecated here}}
void g() __attribute__((deprecated));
-void g(); // expected-note {{declared here}}
+void g(); // expected-note {{'g' has been explicitly marked deprecated here}}
-extern int var __attribute__((deprecated)); // expected-note {{declared here}}
+extern int var __attribute__((deprecated)); // expected-note {{'var' has been explicitly marked deprecated here}}
int a() {
int (*ptr)() = f; // expected-warning {{'f' is deprecated}}
@@ -17,13 +17,13 @@
}
// test if attributes propagate to variables
-extern int var; // expected-note {{declared here}}
+extern int var; // expected-note {{'var' has been explicitly marked deprecated here}}
int w() {
return var; // expected-warning {{'var' is deprecated}}
}
int old_fn() __attribute__ ((deprecated));
-int old_fn(); // expected-note {{declared here}}
+int old_fn(); // expected-note {{'old_fn' has been explicitly marked deprecated here}}
int (*fn_ptr)() = old_fn; // expected-warning {{'old_fn' is deprecated}}
int old_fn() {
@@ -32,7 +32,7 @@
struct foo {
- int x __attribute__((deprecated)); // expected-note 3 {{declared here}}
+ int x __attribute__((deprecated)); // expected-note 3 {{'x' has been explicitly marked deprecated here}}
};
void test1(struct foo *F) {
@@ -41,11 +41,11 @@
struct foo f2 = { 17 }; // expected-warning {{'x' is deprecated}}
}
-typedef struct foo foo_dep __attribute__((deprecated)); // expected-note 12 {{declared here}}
+typedef struct foo foo_dep __attribute__((deprecated)); // expected-note 12 {{'foo_dep' has been explicitly marked deprecated here}}
foo_dep *test2; // expected-warning {{'foo_dep' is deprecated}}
struct __attribute__((deprecated,
- invalid_attribute)) bar_dep ; // expected-warning {{unknown attribute 'invalid_attribute' ignored}} expected-note 2 {{declared here}}
+ invalid_attribute)) bar_dep ; // expected-warning {{unknown attribute 'invalid_attribute' ignored}} expected-note 2 {{'bar_dep' has been explicitly marked deprecated here}}
struct bar_dep *test3; // expected-warning {{'bar_dep' is deprecated}}
@@ -102,9 +102,9 @@
test19;
// rdar://problem/8518751
-enum __attribute__((deprecated)) Test20 { // expected-note {{declared here}}
- test20_a __attribute__((deprecated)), // expected-note {{declared here}}
- test20_b // expected-note {{declared here}}
+enum __attribute__((deprecated)) Test20 { // expected-note {{'Test20' has been explicitly marked deprecated here}}
+ test20_a __attribute__((deprecated)), // expected-note {{'test20_a' has been explicitly marked deprecated here}}
+ test20_b // expected-note {{'test20_b' has been explicitly marked deprecated here}}
};
void test20() {
enum Test20 f; // expected-warning {{'Test20' is deprecated}}
@@ -122,5 +122,5 @@
};
typedef int test23_ty __attribute((deprecated)); // expected-note {{previous definition is here}}
-typedef int test23_ty; // expected-note {{'test23_ty' declared here}} expected-warning {{redefinition of typedef 'test23_ty' is a C11 feature}}
+typedef int test23_ty; // expected-note {{'test23_ty' has been explicitly marked deprecated here}} expected-warning {{redefinition of typedef 'test23_ty' is a C11 feature}}
test23_ty test23_v; // expected-warning {{'test23_ty' is deprecated}}
diff --git a/clang/test/Sema/attr-unavailable-message.c b/clang/test/Sema/attr-unavailable-message.c
index ebdf945..400a2c6 100644
--- a/clang/test/Sema/attr-unavailable-message.c
+++ b/clang/test/Sema/attr-unavailable-message.c
@@ -1,8 +1,8 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// rdar: //6734520
-int foo(int) __attribute__((__unavailable__("USE IFOO INSTEAD"))); // expected-note {{function has been explicitly marked unavailable here}}
-double dfoo(double) __attribute__((__unavailable__("NO LONGER"))); // expected-note 2 {{function has been explicitly marked unavailable here}}
+int foo(int) __attribute__((__unavailable__("USE IFOO INSTEAD"))); // expected-note {{'foo' has been explicitly marked unavailable here}}
+double dfoo(double) __attribute__((__unavailable__("NO LONGER"))); // expected-note 2 {{'dfoo' has been explicitly marked unavailable here}}
void bar() __attribute__((__unavailable__)); // expected-note {{explicitly marked unavailable}}
@@ -34,13 +34,13 @@
// rdar://10201690
enum foo {
- a = 1, // expected-note {{declared here}}
- b __attribute__((deprecated())) = 2, // expected-note {{declared here}}
+ a = 1, // expected-note {{'a' has been explicitly marked deprecated here}}
+ b __attribute__((deprecated())) = 2, // expected-note {{'b' has been explicitly marked deprecated here}}
c = 3
}__attribute__((deprecated()));
-enum fee { // expected-note {{declaration has been explicitly marked unavailable here}}
- r = 1, // expected-note {{declaration has been explicitly marked unavailable here}}
+enum fee { // expected-note {{'fee' has been explicitly marked unavailable here}}
+ r = 1, // expected-note {{'r' has been explicitly marked unavailable here}}
s = 2,
t = 3
}__attribute__((unavailable()));
diff --git a/clang/test/Sema/typeof-use-deprecated.c b/clang/test/Sema/typeof-use-deprecated.c
index 1518c83..ba72b12 100644
--- a/clang/test/Sema/typeof-use-deprecated.c
+++ b/clang/test/Sema/typeof-use-deprecated.c
@@ -1,25 +1,25 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
-struct s { int a; } __attribute__((deprecated)) x; // expected-warning {{'s' is deprecated}} expected-note 2 {{'s' declared here}}
+struct s { int a; } __attribute__((deprecated)) x; // expected-warning {{'s' is deprecated}} expected-note 2 {{'s' has been explicitly marked deprecated here}}
typeof(x) y; // expected-warning {{'s' is deprecated}}
-union un{ int a; } __attribute__((deprecated)) u; // expected-warning {{'un' is deprecated}} expected-note 2 {{'un' declared here}}
+union un{ int a; } __attribute__((deprecated)) u; // expected-warning {{'un' is deprecated}} expected-note 2 {{'un' has been explicitly marked deprecated here}}
typeof( u) z; // expected-warning {{'un' is deprecated}}
-enum E{ one} __attribute__((deprecated)) e; // expected-warning {{'E' is deprecated}} expected-note 2 {{'E' declared here}}
+enum E{ one} __attribute__((deprecated)) e; // expected-warning {{'E' is deprecated}} expected-note 2 {{'E' has been explicitly marked deprecated here}}
typeof( e) w; // expected-warning {{'E' is deprecated}}
-struct foo { int x; } __attribute__((deprecated)); // expected-note {{'foo' declared here}}
-typedef struct foo bar __attribute__((deprecated)); // expected-note {{'bar' declared here}}
+struct foo { int x; } __attribute__((deprecated)); // expected-note {{'foo' has been explicitly marked deprecated here}}
+typedef struct foo bar __attribute__((deprecated)); // expected-note {{'bar' has been explicitly marked deprecated here}}
bar x1; // expected-warning {{'bar' is deprecated}}
int main() { typeof(x1) y; } // expected-warning {{'foo' is deprecated}}
struct gorf { int x; };
-typedef struct gorf T __attribute__((deprecated)); // expected-note {{'T' declared here}}
+typedef struct gorf T __attribute__((deprecated)); // expected-note {{'T' has been explicitly marked deprecated here}}
T t; // expected-warning {{'T' is deprecated}}
void wee() { typeof(t) y; }