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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72279 91177308-0d34-0410-b5e6-96231b3b80d8
1 file changed