[PATCH] D41553: Support parsing double square-bracket attributes in ObjC

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 29 13:18:40 PST 2018


aaron.ballman marked 5 inline comments as done.
aaron.ballman added inline comments.


================
Comment at: lib/Parse/ParseObjc.cpp:1434
       MaybeParseGNUAttributes(paramAttrs);
-      ArgInfo.ArgAttrs = paramAttrs.getList();
     }
 
----------------
rjmccall wrote:
> ObjC parameter syntax is really its own weird thing.  I think this is the right place to allow attributes, after the parenthesized type but before the parameter-variable name (which is optional).  And of course we also allow them within the parentheses, but hopefully that just falls out from parsing the type.
Within the parens is tricky -- if the attribute appears immediately after the type, then it appertain to the *type* and not the *declaration*.
```
-(void)Test: (int) [[foo]] i  to:(int [[bar]]) j from: ([[baz]] int) k;
```
I would expect `foo` to appertain to `i`, `bar` to appertain to the type `int`, and `baz` to be ill-formed, which is what will fall out from parsing the type.


https://reviews.llvm.org/D41553





More information about the cfe-commits mailing list