summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-08-29 17:20:53 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-08-29 17:20:53 +0000
commit161848a0309087cc8ed8fda2362bc10f0c7e20c1 (patch)
treea0fce9fb3e579b35029005ae8179fa329ca0d2e9 /clang/lib
parent3a08ed790464cc09f3ad4b2fea16768b30e2a6cd (diff)
downloadbcm5719-llvm-161848a0309087cc8ed8fda2362bc10f0c7e20c1.tar.gz
bcm5719-llvm-161848a0309087cc8ed8fda2362bc10f0c7e20c1.zip
ObjClang++: Allow declaration of block variable in a collection
statement header (fixes radar 8295106). llvm-svn: 112443
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Parse/ParseTentative.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseTentative.cpp b/clang/lib/Parse/ParseTentative.cpp
index dcf1d406289..17273a0cf62 100644
--- a/clang/lib/Parse/ParseTentative.cpp
+++ b/clang/lib/Parse/ParseTentative.cpp
@@ -188,7 +188,7 @@ Parser::TPResult Parser::TryParseInitDeclaratorList() {
ConsumeParen();
if (!SkipUntil(tok::r_paren))
return TPResult::Error();
- } else if (Tok.is(tok::equal)) {
+ } else if (Tok.is(tok::equal) || isTokIdentifier_in()) {
// MSVC and g++ won't examine the rest of declarators if '=' is
// encountered; they just conclude that we have a declaration.
// EDG parses the initializer completely, which is the proper behavior
@@ -197,6 +197,12 @@ Parser::TPResult Parser::TryParseInitDeclaratorList() {
// At present, Clang follows MSVC and g++, since the parser does not have
// the ability to parse an expression fully without recording the
// results of that parse.
+ // Also allow 'in' after on objective-c declaration as in:
+ // for (int (^b)(void) in array). Ideally this should be done in the
+ // context of parsing for-init-statement of a foreach statement only. But,
+ // in any other context 'in' is invalid after a declaration and parser
+ // issues the error regardless of outcome of this decision.
+ // FIXME. Change if above assumption does not hold.
return TPResult::True();
}
OpenPOWER on IntegriCloud