]> granicus.if.org Git - clang/commit
PR16094: I should have known Obj-C init-capture disambiguation couldn't be
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 21 May 2013 22:21:19 +0000 (22:21 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 21 May 2013 22:21:19 +0000 (22:21 +0000)
commit440d456c5cf9613a3ee6a3297f892ddd8da5b8f8
tree59a4bb0afccd9644ffbffbd4453ade26095c93ff
parent52f926cc32e4f4969f767e98d98f0137358d5f12
PR16094: I should have known Obj-C init-capture disambiguation couldn't be
*that* easy...

Try a bit harder to disambiguate. This is mostly straightforward, but for
=-style initializers, we actually need to know where an expression ends:

  [foo = bar baz]

is a message send, whereas

  [foo = bar + baz]

is a lambda-introducer. Handle this by parsing the expression eagerly, and
replacing it with an annotation token. By chance, we use the *exact same*
parsing rules in both cases (except that we need to assume we're inside a
message send for the parse, to turn off various forms of inapplicable
error recovery).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182432 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Lex/Preprocessor.h
include/clang/Parse/Parser.h
lib/Parse/ParseExprCXX.cpp
test/Parser/objcxx0x-lambda-expressions.mm