@@ -1417,90 +1417,6 @@ void Parser::ParseLateTemplatedFuncDef(LateParsedTemplate &LPT) {
1417
1417
delete *I;
1418
1418
}
1419
1419
1420
- void Parser::MSVCTemplateParserCallback (void *P, LateParsedTemplate &LPT) {
1421
- ((Parser *)P)->ParseMSVCTemplatedFuncDef (LPT);
1422
- }
1423
-
1424
- // / \brief Late parse a C++ function template in Microsoft mode.
1425
- void Parser::ParseMSVCTemplatedFuncDef (LateParsedTemplate &LPT) {
1426
- if (!LPT.D )
1427
- return ;
1428
-
1429
- // Get the FunctionDecl.
1430
- FunctionDecl *FunD = LPT.D ->getAsFunction ();
1431
- // Track template parameter depth.
1432
- TemplateParameterDepthRAII CurTemplateDepthTracker (TemplateParameterDepth);
1433
-
1434
- SmallVector<ParseScope*, 4 > TemplateParamScopeStack;
1435
-
1436
- // Get the list of DeclContexts to reenter.
1437
- SmallVector<DeclContext*, 4 > DeclContextsToReenter;
1438
- DeclContext *DD = FunD;
1439
- while (DD && !DD->isTranslationUnit ()) {
1440
- DeclContextsToReenter.push_back (DD);
1441
- DD = DD->getLexicalParent ();
1442
- }
1443
-
1444
- // Reenter template scopes from outermost to innermost.
1445
- SmallVectorImpl<DeclContext *>::reverse_iterator II =
1446
- DeclContextsToReenter.rbegin ();
1447
- for (; II != DeclContextsToReenter.rend (); ++II) {
1448
- TemplateParamScopeStack.push_back (new ParseScope (this ,
1449
- Scope::TemplateParamScope));
1450
- unsigned NumParamLists =
1451
- Actions.ActOnReenterTemplateScope (getCurScope (), cast<Decl>(*II));
1452
- CurTemplateDepthTracker.addDepth (NumParamLists);
1453
- if (*II != FunD) {
1454
- TemplateParamScopeStack.push_back (new ParseScope (this , Scope::DeclScope));
1455
- Actions.PushDeclContext (Actions.getCurScope (), *II);
1456
- }
1457
- }
1458
-
1459
- assert (!LPT.Toks .empty () && " Empty body!" );
1460
-
1461
- // Append the current token at the end of the new token stream so that it
1462
- // doesn't get lost.
1463
- LPT.Toks .push_back (Tok);
1464
- PP.EnterTokenStream (LPT.Toks , true );
1465
-
1466
- // Consume the previously pushed token.
1467
- ConsumeAnyToken (/* ConsumeCodeCompletionTok=*/ true );
1468
- assert (Tok.isOneOf (tok::l_brace, tok::colon, tok::kw_try) &&
1469
- " Inline method not starting with '{', ':' or 'try'" );
1470
-
1471
- // Parse the method body. Function body parsing code is similar enough
1472
- // to be re-used for method bodies as well.
1473
- ParseScope FnScope (this , Scope::FnScope|Scope::DeclScope);
1474
-
1475
- if (Tok.is (tok::kw_try)) {
1476
- ParseFunctionTryBlock (LPT.D , FnScope);
1477
- } else {
1478
- if (Tok.is (tok::colon))
1479
- ParseConstructorInitializer (LPT.D );
1480
- else
1481
- Actions.ActOnDefaultCtorInitializers (LPT.D );
1482
-
1483
- if (Tok.is (tok::l_brace)) {
1484
- assert ((!isa<FunctionTemplateDecl>(LPT.D ) ||
1485
- cast<FunctionTemplateDecl>(LPT.D )
1486
- ->getTemplateParameters ()
1487
- ->getDepth () == TemplateParameterDepth - 1 ) &&
1488
- " TemplateParameterDepth should be greater than the depth of "
1489
- " current template being instantiated!" );
1490
- ParseFunctionStatementBody (LPT.D , FnScope);
1491
- Actions.UnmarkAsLateParsedTemplate (FunD);
1492
- } else
1493
- Actions.ActOnFinishFunctionBody (LPT.D , nullptr );
1494
- }
1495
-
1496
- // Exit scopes.
1497
- FnScope.Exit ();
1498
- SmallVectorImpl<ParseScope *>::reverse_iterator I =
1499
- TemplateParamScopeStack.rbegin ();
1500
- for (; I != TemplateParamScopeStack.rend (); ++I)
1501
- delete *I;
1502
- }
1503
-
1504
1420
// / \brief Lex a delayed template function for late parsing.
1505
1421
void Parser::LexTemplateFunctionForLateParsing (CachedTokens &Toks) {
1506
1422
tok::TokenKind kind = Tok.getKind ();
0 commit comments