diff options
Diffstat (limited to 'lib/Parse/ParseTemplate.cpp')
-rw-r--r-- | lib/Parse/ParseTemplate.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp index 05fabebed2..d0e63496b5 100644 --- a/lib/Parse/ParseTemplate.cpp +++ b/lib/Parse/ParseTemplate.cpp @@ -27,11 +27,20 @@ Decl * Parser::ParseDeclarationStartingWithTemplate(unsigned Context, SourceLocation &DeclEnd, AccessSpecifier AS) { - if (Tok.is(tok::kw_template) && NextToken().isNot(tok::less)) - return ParseExplicitInstantiation(SourceLocation(), ConsumeToken(), - DeclEnd); - - return ParseTemplateDeclarationOrSpecialization(Context, DeclEnd, AS); + Decl *DC = getObjCDeclContext(); + if (DC) + Actions.ActOnObjCContainerFinishDefinition(DC); + if (Tok.is(tok::kw_template) && NextToken().isNot(tok::less)) { + Decl *Res = ParseExplicitInstantiation(SourceLocation(), ConsumeToken(), + DeclEnd); + if (DC) + Actions.ActOnObjCContainerStartDefinition(DC); + return Res; + } + Decl *Res = ParseTemplateDeclarationOrSpecialization(Context, DeclEnd, AS); + if (DC) + Actions.ActOnObjCContainerStartDefinition(DC); + return Res; } /// \brief RAII class that manages the template parameter depth. |