LGTM
On Wed, Jan 23, 2013 at 5:56 PM, Nick Lewycky <[email protected]> wrote: > On 23 January 2013 17:52, Matt Beaumont-Gay <[email protected]> wrote: >> >> + // Cut off the implicit 'this'. >> + if (isa<CXXMethodDecl>(FnDecl)) >> + ArgsArray = ArgsArray.slice(1); >> >> What about static methods? > > > nonnull.cc:4:15: error: overloaded 'operator<' cannot be a static member > function > static bool operator<(const X&, const char*) __attribute__((nonnull(2))); > ^ > > I can declare a static non-member, but that makes it a free function, which > works fine: > > static bool operator>(const X&, const char*) __attribute__((nonnull(2))); > [...] > nonnull.cc:15:12: warning: null passed to a callee which requires a non-null > argument [-Wnonnull] > (void)(x > 0); > ^ ~ > > In this case the logic is copied from Sema::CheckFunctionCall in > SemaChecking.cpp: > > bool IsMemberOperatorCall = isa<CXXOperatorCallExpr>(TheCall) && > isa<CXXMethodDecl>(FDecl); > [...] > if (IsMemberOperatorCall) { > // If this is a call to a member operator, hide the first argument > // from checkCall. > // FIXME: Our choice of AST representation here is less than ideal. > ++Args; > --NumArgs; > } > > but I don't need to test for CXXOperatorCallExpr since we know we just > created one. > > Nick > >> On Wed, Jan 23, 2013 at 5:15 PM, Nick Lewycky <[email protected]> wrote: >> > GCC supports attribute nonnull on overloaded operators, but clang >> > doesn't. >> > This patch adds support to the code path around binary operators, as I >> > don't >> > think it's possible to make it fire on overloaded unary operators. >> > >> > Please review! >> > >> > Nick >> > >> > >> > _______________________________________________ >> > cfe-commits mailing list >> > [email protected] >> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >> > > > _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
