r195186 - Ensuring the warning for attribute decl types matches the error for attribute decl types.

Richard Smith richard at metafoo.co.uk
Tue Nov 19 18:03:06 PST 2013


Well, if there's no current attribute that will trigger these new messages,
I suppose testing can wait.


As an aside, our diagnostic tablegen system could really use a mechanism to
define these enumerated lists. I'd love to be able to write something like

def AttrRecipient : Select<"attr_recipient",
  [SelectVal<"VarFunctionAndLabel", "varaibles, functions, and labels">,
   SelectVal<"FieldsAndGlobals", "fields and global variables">,
   // ...
  ]
>;
def err_foo : Error<"%0 attribute only aplpies to
%select<attr_recipient>1">;

... where this would generate both the diagnostic with a proper %select and
also an enumerated type for the attribute argument.


On Tue, Nov 19, 2013 at 5:29 PM, Aaron Ballman <aaron at aaronballman.com>wrote:

> Perhaps unit testable, but I'm not certain. If you have suggestions,
> I'm all ears.
>
> I wish there was a way to consolidate these two into a single
> diagnostic though, that's for sure. There are a couple of other
> diagnostics that are similar in nature....
>
> ~Aaron
>
> On Tue, Nov 19, 2013 at 8:27 PM, Richard Smith <richard at metafoo.co.uk>
> wrote:
> > Is this testable?
> >
> >
> > On Tue, Nov 19, 2013 at 5:14 PM, Aaron Ballman <aaron at aaronballman.com>
> > wrote:
> >>
> >> Author: aaronballman
> >> Date: Tue Nov 19 19:14:35 2013
> >> New Revision: 195186
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=195186&view=rev
> >> Log:
> >> Ensuring the warning for attribute decl types matches the error for
> >> attribute decl types.
> >>
> >> Modified:
> >>     cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> >>
> >> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=195186&r1=195185&r2=195186&view=diff
> >>
> >>
> ==============================================================================
> >> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> >> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Nov 19
> >> 19:14:35 2013
> >> @@ -2040,7 +2040,8 @@ def warn_attribute_wrong_decl_type : War
> >>    "variables, functions and labels|fields and global
> variables|structs|"
> >>    "variables, functions and tag types|thread-local variables|"
> >>    "variables and fields|variables, data members and tag types|"
> >> -  "types and namespaces|Objective-C interfaces}1">,
> >> +  "types and namespaces|Objective-C interfaces|methods and properties|"
> >> +  "struct or union|struct, union or class}1">,
> >>    InGroup<IgnoredAttributes>;
> >>  def err_attribute_wrong_decl_type : Error<
> >>    "%0 attribute only applies to %select{functions|unions|"
> >> @@ -2050,8 +2051,8 @@ def err_attribute_wrong_decl_type : Erro
> >>    "variables, functions and labels|fields and global
> variables|structs|"
> >>    "variables, functions and tag types|thread-local variables|"
> >>    "variables and fields|variables, data members and tag types|"
> >> -  "types and namespaces|Objective-C interfaces|"
> >> -  "methods and properties|struct or union|struct, union or class}1">;
> >> +  "types and namespaces|Objective-C interfaces|methods and properties|"
> >> +  "struct or union|struct, union or class}1">;
> >>  def warn_type_attribute_wrong_type : Warning<
> >>    "'%0' only applies to %select{function|pointer|"
> >>    "Objective-C object or block pointer}1 types; type here is %2">,
> >>
> >>
> >> _______________________________________________
> >> cfe-commits mailing list
> >> cfe-commits at cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131119/530a32b7/attachment.html>


More information about the cfe-commits mailing list