On Wed, Aug 21, 2013 at 4:53 PM, David Blaikie <[email protected]> wrote: > On Wed, Aug 21, 2013 at 11:54 AM, Aaron Ballman <[email protected]> > wrote: >> On Wed, Aug 21, 2013 at 2:39 PM, Christian Wailes >> <[email protected]> wrote: >>> The tests that for making sure warnings are issued when attributes are >>> attached to the wrong kind of thing aren't in warn-consumed-analysis.cpp. >>> Like I said, they are in warn-consumed-parsing.cpp. >> >> Apologies for the reading comprehension failure. >> >> The SemaCXX/warn-consumed-parsing.cpp does have some of the tests I >> was looking for (it's missing ones for constructors and destructors), >> and brings up an improvement I'd like to see (at some point): >> >> void function0(void) CONSUMES; // expected-warning {{'consumes' >> attribute only applies to methods}} >> >> This is a very confusing warning for the user since the attribute is >> applied to a method. I think warn_attribute_wrong_decl_type and >> err_attribute_wrong_decl_type should have a new field for instance >> methods (or are static member functions also acceptable?). > > Ideally, eventually, I think - these attributes should apply to member > functions and non-member (or static member) functions alike. In the > non-member case (maybe even in the member case?) they should annotate > a parameter (or otherwise reference a parameter that the function > annotation attaches to) to describe that /that/ parameter is consumed > (or initialized, or must be in some state, etc) by the function call. > > I haven't followed exactly where we are with that just yet. I think > currently we assume non-const reference parameters (& non-const member > functions) consume?
If we don't currently handle non-member functions, then I think there's a bug that SemaDeclAttr.cpp isn't going to catch since it is not checking for instance methods. That code should probably be updated, and then when we start to handle non-member functions, it can be relaxed. ~Aaron _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
