steffenlarsen marked 2 inline comments as done.
steffenlarsen added inline comments.


================
Comment at: clang/lib/Parse/ParseDecl.cpp:386
   ArgsVector ArgExprs;
   if (Tok.is(tok::identifier)) {
     // If this attribute wants an 'identifier' argument, make it so.
----------------
erichkeane wrote:
> So does this mean that our pack-parsing code is allowing identifiers?  I 
> really expected this patch to enforce via the clang-attr-emitter that ONLY 
> the 'expr' types were allowed.  So you'd have:
> 
> if (attributeAcceptsExprPack(AttrName)) {
> ... <where this ONLY accepts an expression pack>
> } else if (Tok.is(tok::identifier)) {
> ...
> }...
This will only consume the identifier if the argument is an identifier argument 
(variadic or non-variadic). As you say, clang-attr-emitter will make sure that 
no attribute with `AcceptsExprPack` has any identifier arguments, so if there 
is an identifier here it will not be able to consume it and then it will 
continue on to try and parse it as an expression and fail.

That said, the second part of the following parsing branches should probably 
also check `attributeHasIdentifierArg(*AttrName)`, so I will add that shortly.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114439/new/

https://reviews.llvm.org/D114439

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to