From: Aaron Ballman Date: Mon, 16 Feb 2015 23:12:37 +0000 (+0000) Subject: Minor tweaks to r229447 to ensure the attribute is properly quoted when diagnosed. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=58179568b8b75ba3ffd43bcbb9930110feafc1c9;p=clang Minor tweaks to r229447 to ensure the attribute is properly quoted when diagnosed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229454 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index b2cb545a09..d979fe1cbe 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -7233,9 +7233,8 @@ def err_asm_naked_this_ref : Error< def err_asm_naked_parm_ref : Error< "parameter references not allowed in naked functions">; -def ext_use_of_attribute_is_a_cxx14_extension - : ExtWarn<"use of the %0 attribute is a C++14 extension">, - InGroup; +def ext_use_of_attribute_is_a_cxx14_extension : ExtWarn< + "use of the %0 attribute is a C++14 extension">, InGroup; // OpenCL warnings and errors. def err_invalid_astype_of_different_size : Error< diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 42cfd9afa0..4abe480c52 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -4259,7 +4259,7 @@ static void handleDeprecatedAttr(Sema &S, Decl *D, const AttributeList &Attr) { if (Attr.isCXX11Attribute() && !(Attr.hasScope() && Attr.getScopeName()->isStr("gnu"))) S.Diag(Attr.getLoc(), diag::ext_use_of_attribute_is_a_cxx14_extension) - << Attr.getName()->getNameStart(); + << Attr.getName(); handleAttrWithMessage(S, D, Attr); } diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp index ab0ce192fc..33987f94c2 100644 --- a/test/Parser/cxx0x-attributes.cpp +++ b/test/Parser/cxx0x-attributes.cpp @@ -288,7 +288,7 @@ namespace arguments { void f[[gnu::format(printf, 1, 2)]](const char*, ...); void g() [[unknown::foo(ignore arguments for unknown attributes, even with symbols!)]]; // expected-warning {{unknown attribute 'foo' ignored}} [[deprecated("with argument")]] int i; - // expected-warning@-1 {{use of the deprecated attribute is a C++14 extension}} + // expected-warning@-1 {{use of the 'deprecated' attribute is a C++14 extension}} } // Forbid attributes on decl specifiers. @@ -331,12 +331,12 @@ namespace GccASan { namespace { [[deprecated]] void bar(); - // expected-warning@-1 {{use of the deprecated attribute is a C++14 extension}} + // expected-warning@-1 {{use of the 'deprecated' attribute is a C++14 extension}} [[deprecated("hello")]] void baz(); - // expected-warning@-1 {{use of the deprecated attribute is a C++14 extension}} + // expected-warning@-1 {{use of the 'deprecated' attribute is a C++14 extension}} [[deprecated()]] void foo(); // expected-error@-1 {{parentheses must be omitted if 'deprecated' attribute's argument list is empty}} - // expected-warning@-2 {{use of the deprecated attribute is a C++14 extension}} + // expected-warning@-2 {{use of the 'deprecated' attribute is a C++14 extension}} [[gnu::deprecated()]] void quux(); } diff --git a/test/SemaCXX/for-range-examples.cpp b/test/SemaCXX/for-range-examples.cpp index f2b155ad7e..9359ae63a6 100644 --- a/test/SemaCXX/for-range-examples.cpp +++ b/test/SemaCXX/for-range-examples.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 namespace value_range_detail { template @@ -226,7 +226,7 @@ namespace test7 { // we check the alignment attribute before we perform the auto // deduction. for (d alignas(1) : arr) {} // expected-error {{requires type for loop variable}} - for (e [[deprecated]] : arr) { e = 0; } // expected-warning{{use of the deprecated attribute is a C++14 extension}} expected-warning {{deprecated}} expected-note {{here}} expected-error {{requires type for loop variable}} + for (e [[deprecated]] : arr) { e = 0; } // expected-warning{{use of the 'deprecated' attribute is a C++14 extension}} expected-warning {{deprecated}} expected-note {{here}} expected-error {{requires type for loop variable}} } } diff --git a/test/SemaCXX/generalized-deprecated.cpp b/test/SemaCXX/generalized-deprecated.cpp index 3bb42df499..811610f509 100644 --- a/test/SemaCXX/generalized-deprecated.cpp +++ b/test/SemaCXX/generalized-deprecated.cpp @@ -4,7 +4,7 @@ // warnings [[deprecated("1")]] int function_1(); -// expected-warning@-1 {{use of the deprecated attribute is a C++14 extension}} +// expected-warning@-1 {{use of the 'deprecated' attribute is a C++14 extension}} [[gnu::deprecated("3")]] int function_3();