The disambiguation process for ambiguous paren expressions is not "side effects free", e.g:

  (T(*)(int[x+y]));

is an (invalid) paren expression, but "x+y" will be parsed as part of the (rejected) type-id,
so unnecessary Action calls are made for an unused (and possibly leaked) "x+y".

Use a different scheme, similar to parsing inline methods. The parenthesized tokens are cached,
the context that follows is determined (possibly by parsing a cast-expression),
and then we re-introduce the cached tokens into the token stream and parse them appropriately.

llvm-svn: 72279
1 file changed
tree: ae2b179b8f6d41cfe675d91d67c75c51145e7892
  1. clang/
  2. llvm/