diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2012-08-10 21:15:06 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-08-10 21:15:06 +0000 |
commit | f64b4722eb9aae5d2a82edf3a09eea54ad29c624 (patch) | |
tree | dc631466b7bbb8ebe67b7c830de06e25dda54347 /clang/lib/Parse/ParseObjc.cpp | |
parent | d6ef704fe4b33b3c62ed25ad6ea0877bf266ee82 (diff) | |
download | bcm5719-llvm-f64b4722eb9aae5d2a82edf3a09eea54ad29c624.tar.gz bcm5719-llvm-f64b4722eb9aae5d2a82edf3a09eea54ad29c624.zip |
objective-C++: dalyed parsing of ctors with member
initializer list defined inside an objc class
implementation. wip
llvm-svn: 161699
Diffstat (limited to 'clang/lib/Parse/ParseObjc.cpp')
-rw-r--r-- | clang/lib/Parse/ParseObjc.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index 2471d9441b3..db35a386c35 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -1927,7 +1927,7 @@ void Parser::StashAwayMethodOrFunctionBodyTokens(Decl *MDecl) { LexedMethod* LM = new LexedMethod(this, MDecl); CurParsedObjCImpl->LateParsedObjCMethods.push_back(LM); CachedTokens &Toks = LM->Toks; - // Begin by storing the '{' or 'try' token. + // Begin by storing the '{' or 'try' or ':' token. Toks.push_back(Tok); if (Tok.is(tok::kw_try)) { ConsumeToken(); @@ -1939,8 +1939,14 @@ void Parser::StashAwayMethodOrFunctionBodyTokens(Decl *MDecl) { ConsumeAndStoreUntil(tok::r_paren, Toks, /*StopAtSemi=*/false); } } - assert(Tok.is(tok::l_brace) - && "StashAwayMethodOrFunctionBodyTokens - '{' not found"); + Toks.push_back(Tok); // also store '{' + } + else if (Tok.is(tok::colon)) { + ConsumeToken(); + while (Tok.isNot(tok::l_brace)) { + ConsumeAndStoreUntil(tok::l_paren, Toks, /*StopAtSemi=*/false); + ConsumeAndStoreUntil(tok::r_paren, Toks, /*StopAtSemi=*/false); + } Toks.push_back(Tok); // also store '{' } ConsumeBrace(); @@ -2881,8 +2887,9 @@ void Parser::ParseLexedObjCMethodDefs(LexedMethod &LM, bool parseMethod) { // Consume the previously pushed token. ConsumeAnyToken(); - assert((Tok.is(tok::l_brace) || Tok.is(tok::kw_try)) && - "Inline objective-c method not starting with '{' or 'try'"); + assert((Tok.is(tok::l_brace) || Tok.is(tok::kw_try) || + Tok.is(tok::colon)) && + "Inline objective-c method not starting with '{' or 'try' or ':'"); // Enter a scope for the method or c-fucntion body. ParseScope BodyScope(this, parseMethod @@ -2897,8 +2904,11 @@ void Parser::ParseLexedObjCMethodDefs(LexedMethod &LM, bool parseMethod) { Actions.ActOnStartOfFunctionDef(getCurScope(), MCDecl); if (Tok.is(tok::kw_try)) MCDecl = ParseFunctionTryBlock(MCDecl, BodyScope); - else + else { + if (Tok.is(tok::colon)) + ParseConstructorInitializer(MCDecl); MCDecl = ParseFunctionStatementBody(MCDecl, BodyScope); + } if (Tok.getLocation() != OrigLoc) { // Due to parsing error, we either went over the cached tokens or |