[PATCH] D14274: Add alloc_size attribute to clang
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 2 06:14:59 PST 2016
aaron.ballman added a comment.
The attribute part looks mostly good (a few small nits), but the rest should be reviewed by @rsmith.
================
Comment at: lib/Sema/SemaDeclAttr.cpp:737
@@ +736,3 @@
+ unsigned FuncParamNo, unsigned AttrArgNo) {
+ assert(Attr.getArg(AttrArgNo).is<Expr *>());
+ // FuncParamNo is base-1
----------------
Can be replaced with assert(Attr.isArgExpr(AttrArgNo) && "expected expression argument");
================
Comment at: lib/Sema/SemaDeclAttr.cpp:739
@@ +738,3 @@
+ // FuncParamNo is base-1
+ if (FuncParamNo < 1 || FuncParamNo > FD->getNumParams()) {
+ SourceLocation SrcLoc = Attr.getArgAsExpr(AttrArgNo)->getLocStart();
----------------
This whole if should be replaced by a call to checkFunctionOrMethodParameterIndex(), which will return the correct function parameter number as an output parameter.
http://reviews.llvm.org/D14274
More information about the cfe-commits
mailing list