summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseObjc.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-08-10 18:10:56 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-08-10 18:10:56 +0000
commit8cecfe9fc964b33c2b895562be5ed0064730b23b (patch)
tree7e2721fa06c7ee9f0aa1e65a20f78db07dd43d63 /clang/lib/Parse/ParseObjc.cpp
parent02a84397300c9484f1a7cecd97bfe392e00fed17 (diff)
downloadbcm5719-llvm-8cecfe9fc964b33c2b895562be5ed0064730b23b.tar.gz
bcm5719-llvm-8cecfe9fc964b33c2b895562be5ed0064730b23b.zip
objective-C++: delayed parsing of member function with
function-try-block occuring in objc's implementation block. wip. llvm-svn: 161675
Diffstat (limited to 'clang/lib/Parse/ParseObjc.cpp')
-rw-r--r--clang/lib/Parse/ParseObjc.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index 70254b6db63..9b7e85f2111 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/lib/Parse/ParseObjc.cpp
@@ -1927,11 +1927,19 @@ void Parser::StashAwayMethodOrFunctionBodyTokens(Decl *MDecl) {
LexedMethod* LM = new LexedMethod(this, MDecl);
CurParsedObjCImpl->LateParsedObjCMethods.push_back(LM);
CachedTokens &Toks = LM->Toks;
- // Begin by storing the '{' token.
+ // Begin by storing the '{' or 'try' token.
Toks.push_back(Tok);
+ if (Tok.is(tok::kw_try)) {
+ ConsumeToken();
+ Toks.push_back(Tok); // also store '{'
+ }
ConsumeBrace();
// Consume everything up to (and including) the matching right brace.
ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/false);
+ while (Tok.is(tok::kw_catch)) {
+ ConsumeAndStoreUntil(tok::l_brace, Toks, /*StopAtSemi=*/false);
+ ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/false);
+ }
}
/// objc-method-def: objc-method-proto ';'[opt] '{' body '}'
@@ -2863,7 +2871,8 @@ void Parser::ParseLexedObjCMethodDefs(LexedMethod &LM, bool parseMethod) {
// Consume the previously pushed token.
ConsumeAnyToken();
- assert(Tok.is(tok::l_brace) && "Inline objective-c method not starting with '{'");
+ assert((Tok.is(tok::l_brace) || Tok.is(tok::kw_try)) &&
+ "Inline objective-c method not starting with '{' or 'try'");
// Enter a scope for the method or c-fucntion body.
ParseScope BodyScope(this,
parseMethod
@@ -2876,8 +2885,10 @@ void Parser::ParseLexedObjCMethodDefs(LexedMethod &LM, bool parseMethod) {
Actions.ActOnStartOfObjCMethodDef(getCurScope(), MCDecl);
else
Actions.ActOnStartOfFunctionDef(getCurScope(), MCDecl);
-
- MCDecl = ParseFunctionStatementBody(MCDecl, BodyScope);
+ if (Tok.is(tok::kw_try))
+ MCDecl = ParseFunctionTryBlock(MCDecl, BodyScope);
+ else
+ MCDecl = ParseFunctionStatementBody(MCDecl, BodyScope);
if (Tok.getLocation() != OrigLoc) {
// Due to parsing error, we either went over the cached tokens or
OpenPOWER on IntegriCloud