summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/Parser.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-08-10 15:54:40 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-08-10 15:54:40 +0000
commit712bb81a6daf71ef3f84ab80e329010b25981865 (patch)
treeb97b22751635913b244e985535f142e37256ba7c /clang/lib/Parse/Parser.cpp
parentb93df94238662fad3c74ef500436bd02c0c8e945 (diff)
downloadbcm5719-llvm-712bb81a6daf71ef3f84ab80e329010b25981865.tar.gz
bcm5719-llvm-712bb81a6daf71ef3f84ab80e329010b25981865.zip
objective-C++: Delayed parsing of most common
member functions defined inside an objc class implementation. wip. llvm-svn: 161667
Diffstat (limited to 'clang/lib/Parse/Parser.cpp')
-rw-r--r--clang/lib/Parse/Parser.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index 7314228b9f9..3531deba4f9 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/lib/Parse/Parser.cpp
@@ -1025,7 +1025,26 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D,
}
return DP;
}
-
+ else if (CurParsedObjCImpl && Tok.is(tok::l_brace) &&
+ !TemplateInfo.TemplateParams &&
+ Actions.CurContext->isTranslationUnit()) {
+ MultiTemplateParamsArg TemplateParameterLists(Actions, 0, 0);
+ ParseScope BodyScope(this, Scope::FnScope|Scope::DeclScope);
+ Scope *ParentScope = getCurScope()->getParent();
+
+ D.setFunctionDefinitionKind(FDK_Definition);
+ Decl *FuncDecl = Actions.HandleDeclarator(ParentScope, D,
+ move(TemplateParameterLists));
+ D.complete(FuncDecl);
+ D.getMutableDeclSpec().abort();
+ if (FuncDecl) {
+ // Consume the tokens and store them for later parsing.
+ StashAwayMethodOrFunctionBodyTokens(FuncDecl);
+ CurParsedObjCImpl->HasCFunction = true;
+ return FuncDecl;
+ }
+ }
+
// Enter a scope for the function body.
ParseScope BodyScope(this, Scope::FnScope|Scope::DeclScope);
OpenPOWER on IntegriCloud