On Thu, Jun 25, 2009 at 11:32 PM, Nate Begeman<[email protected]> wrote: > +static void HandleReqdWorkGroupSize(Decl *D, const AttributeList &Attr, > + Sema &S) { > + // Attribute has 3 arguments. > + if (Attr.getNumArgs() != 3) { > + S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1; > + return; > + } > + > + unsigned WGSize[3]; > + for (unsigned i = 0; i < 3; ++i) { > + Expr *E = static_cast<Expr *>(Attr.getArg(i)); > + llvm::APSInt ArgNum(32); > + if (!E->isIntegerConstantExpr(ArgNum, S.Context)) { > + S.Diag(Attr.getLoc(), diag::err_attribute_argument_not_int) > + << "reqd_work_group_size" << E->getSourceRange(); > + return; > + } > + WGSize[i] = (unsigned) ArgNum.getZExtValue(); > + } > + D->addAttr(S.Context, > + ::new (S.Context) ReqdWorkGroupSizeAttr(WGSize[0], WGSize[1], > + WGSize[2])); > +}
Shouldn't there be some sort of check that this attribute isn't applied to anything other than an __kernel? -Eli _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
