<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, May 28, 2014 at 4:11 PM, Richard Trieu <span dir="ltr"><<a href="mailto:rtrieu@google.com" target="_blank">rtrieu@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Add code to handle:<br>
<br>
  int [] *a;<br>
<br>
This is handled by inserting parens in the token stream, then backtracking and have ParseDirectDeclarator handle the parens as normal through ParseParenDeclarator.</blockquote><div><br></div><div>This seems like more trouble than I'd expected (and it's still not completely right, since its mini-lookahead-parser misses lots of cases, such as 'int [] &a;'). Is it possible to handle this differently, as follows:</div>
<div><br></div><div> * parse the bracket declarators into TempDeclarator, then </div><div> * parse a direct declarator, then</div><div> * scan the declarator you just parsed and check if it needs parens, and include them in the fix-it if so</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><a href="http://reviews.llvm.org/D2712" target="_blank">http://reviews.llvm.org/D2712</a><br>

<br>
Files:<br>
  include/clang/Basic/DiagnosticParseKinds.td<br>
  include/clang/Parse/Parser.h<br>
  lib/Parse/ParseDecl.cpp<br>
  test/Parser/brackets.c<br>
  test/Parser/brackets.cpp<br>
</div></div></blockquote></div><br></div></div>