On Sun, Aug 9, 2009 at 1:07 PM, Ryan Flynn<[email protected]> wrote: > --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original) > +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Sun Aug 9 15:07:29 2009 > @@ -424,6 +424,22 @@ > d->addAttr(::new (S.Context) AlwaysInlineAttr()); > } > > +static void HandleMallocAttr(Decl *d, const AttributeList &Attr, Sema &S) { > + // check the attribute arguments. > + if (Attr.getNumArgs() != 0) { > + S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0; > + return; > + } > + > + if (!isFunctionOrMethod(d)) { > + S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) > + << Attr.getName() << 0 /*function*/; > + return; > + } > + > + d->addAttr(::new (S.Context) MallocAttr()); > +}
It might be a good idea to check that the function returns a pointer. -Eli _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
