r229454 - Minor tweaks to r229447 to ensure the attribute is properly quoted when diagnosed.

Aaron Ballman aaron at aaronballman.com
Mon Feb 16 17:49:36 PST 2015


On Mon, Feb 16, 2015 at 8:07 PM, Saleem Abdulrasool
<compnerd at compnerd.org> wrote:
> On Monday, February 16, 2015, Aaron Ballman <aaron at aaronballman.com> wrote:
>>
>> Author: aaronballman
>> Date: Mon Feb 16 17:12:37 2015
>> New Revision: 229454
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=229454&view=rev
>> Log:
>> Minor tweaks to r229447 to ensure the attribute is properly quoted when
>> diagnosed.
>>
>> Modified:
>>     cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>>     cfe/trunk/lib/Sema/SemaDeclAttr.cpp
>>     cfe/trunk/test/Parser/cxx0x-attributes.cpp
>>     cfe/trunk/test/SemaCXX/for-range-examples.cpp
>>     cfe/trunk/test/SemaCXX/generalized-deprecated.cpp
>>
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=229454&r1=229453&r2=229454&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Feb 16
>> 17:12:37 2015
>> @@ -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<CXX14>;
>> +def ext_use_of_attribute_is_a_cxx14_extension : ExtWarn<
>> +  "use of the %0 attribute is a C++14 extension">, InGroup<CXX14>;
>
>
> The original formatting was the result of clang-format.  Is that not
> preferable?

The style in the file appears to be to have the type of diagnostic on
the same line as the diagnostic name whenever possible, so I switched
to using that. I'm not certain clang-format understands .td file
styles overly well?

~Aaron

>
>>
>>  // OpenCL warnings and errors.
>>  def err_invalid_astype_of_different_size : Error<
>>
>> Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=229454&r1=229453&r2=229454&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Mon Feb 16 17:12:37 2015
>> @@ -4259,7 +4259,7 @@ static void handleDeprecatedAttr(Sema &S
>>      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<DeprecatedAttr>(S, D, Attr);
>>  }
>>
>> Modified: cfe/trunk/test/Parser/cxx0x-attributes.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx0x-attributes.cpp?rev=229454&r1=229453&r2=229454&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/test/Parser/cxx0x-attributes.cpp (original)
>> +++ cfe/trunk/test/Parser/cxx0x-attributes.cpp Mon Feb 16 17:12:37 2015
>> @@ -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 at -1 {{use of the deprecated attribute is a C++14
>> extension}}
>> +  // expected-warning at -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 at -1 {{use of the deprecated attribute is a C++14
>> extension}}
>> +  // expected-warning at -1 {{use of the 'deprecated' attribute is a C++14
>> extension}}
>>    [[deprecated("hello")]] void baz();
>> -  // expected-warning at -1 {{use of the deprecated attribute is a C++14
>> extension}}
>> +  // expected-warning at -1 {{use of the 'deprecated' attribute is a C++14
>> extension}}
>>    [[deprecated()]] void foo();
>>    // expected-error at -1 {{parentheses must be omitted if 'deprecated'
>> attribute's argument list is empty}}
>> -  // expected-warning at -2 {{use of the deprecated attribute is a C++14
>> extension}}
>> +  // expected-warning at -2 {{use of the 'deprecated' attribute is a C++14
>> extension}}
>>    [[gnu::deprecated()]] void quux();
>>  }
>>
>>
>> Modified: cfe/trunk/test/SemaCXX/for-range-examples.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/for-range-examples.cpp?rev=229454&r1=229453&r2=229454&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/test/SemaCXX/for-range-examples.cpp (original)
>> +++ cfe/trunk/test/SemaCXX/for-range-examples.cpp Mon Feb 16 17:12:37 2015
>> @@ -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<typename T>
>> @@ -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}}
>>    }
>>  }
>>
>>
>> Modified: cfe/trunk/test/SemaCXX/generalized-deprecated.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/generalized-deprecated.cpp?rev=229454&r1=229453&r2=229454&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/test/SemaCXX/generalized-deprecated.cpp (original)
>> +++ cfe/trunk/test/SemaCXX/generalized-deprecated.cpp Mon Feb 16 17:12:37
>> 2015
>> @@ -4,7 +4,7 @@
>>  // warnings
>>
>>  [[deprecated("1")]] int function_1();
>> -// expected-warning at -1 {{use of the deprecated attribute is a C++14
>> extension}}
>> +// expected-warning at -1 {{use of the 'deprecated' attribute is a C++14
>> extension}}
>>
>>  [[gnu::deprecated("3")]] int function_3();
>>
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
>
> --
> Saleem Abdulrasool
> compnerd (at) compnerd (dot) org



More information about the cfe-commits mailing list