@@ -1055,7 +1055,7 @@ Parser::WalkClassTemplateSpecialization(const clang::ClassTemplateSpecialization
1055
1055
TS->isIncomplete = true ;
1056
1056
if (CTS->getDefinition ())
1057
1057
{
1058
- auto Complete = WalkDeclaration (CTS->getDefinition ());
1058
+ auto Complete = WalkDeclarationDef (CTS->getDefinition ());
1059
1059
if (!Complete->isIncomplete )
1060
1060
TS->completeDeclaration = Complete;
1061
1061
}
@@ -1105,7 +1105,7 @@ Parser::WalkClassTemplatePartialSpecialization(const clang::ClassTemplatePartial
1105
1105
TS->isIncomplete = true ;
1106
1106
if (CTS->getDefinition ())
1107
1107
{
1108
- auto Complete = WalkDeclaration (CTS->getDefinition ());
1108
+ auto Complete = WalkDeclarationDef (CTS->getDefinition ());
1109
1109
if (!Complete->isIncomplete )
1110
1110
TS->completeDeclaration = Complete;
1111
1111
}
@@ -3468,7 +3468,18 @@ void Parser::HandleDeclaration(const clang::Decl* D, Declaration* Decl)
3468
3468
3469
3469
Declaration* Parser::WalkDeclarationDef (clang::Decl* D)
3470
3470
{
3471
- return WalkDeclaration (D);
3471
+ auto Decl = WalkDeclaration (D);
3472
+ if (!Decl || Decl->definitionOrder > 0 )
3473
+ return Decl;
3474
+ // We store a definition order index into the declarations.
3475
+ // This is needed because declarations are added to their contexts as
3476
+ // soon as they are referenced and we need to know the original order
3477
+ // of the declarations.
3478
+ clang::RecordDecl* RecordDecl;
3479
+ if ((RecordDecl = llvm::dyn_cast<clang::RecordDecl>(D)) &&
3480
+ RecordDecl->isCompleteDefinition ())
3481
+ Decl->definitionOrder = index++;
3482
+ return Decl;
3472
3483
}
3473
3484
3474
3485
Declaration* Parser::WalkDeclaration (const clang::Decl* D)
@@ -3483,41 +3494,13 @@ Declaration* Parser::WalkDeclaration(const clang::Decl* D)
3483
3494
case Decl::Record:
3484
3495
{
3485
3496
auto RD = cast<RecordDecl>(D);
3486
- auto Record = WalkRecord (RD);
3487
-
3488
- // We store a definition order index into the declarations.
3489
- // This is needed because declarations are added to their contexts as
3490
- // soon as they are referenced and we need to know the original order
3491
- // of the declarations.
3492
-
3493
- if (Record->definitionOrder == 0 &&
3494
- RD->isCompleteDefinition ())
3495
- {
3496
- Record->definitionOrder = index++;
3497
- // Debug("%d: %s\n", Index++, GetTagDeclName(RD).c_str());
3498
- }
3499
-
3500
- Decl = Record;
3497
+ Decl = WalkRecord (RD);
3501
3498
break ;
3502
3499
}
3503
3500
case Decl::CXXRecord:
3504
3501
{
3505
3502
auto RD = cast<CXXRecordDecl>(D);
3506
- auto Class = WalkRecordCXX (RD);
3507
-
3508
- // We store a definition order index into the declarations.
3509
- // This is needed because declarations are added to their contexts as
3510
- // soon as they are referenced and we need to know the original order
3511
- // of the declarations.
3512
-
3513
- if (Class->definitionOrder == 0 &&
3514
- RD->isCompleteDefinition ())
3515
- {
3516
- Class->definitionOrder = index++;
3517
- // Debug("%d: %s\n", Index++, GetTagDeclName(RD).c_str());
3518
- }
3519
-
3520
- Decl = Class;
3503
+ Decl = WalkRecordCXX (RD);
3521
3504
break ;
3522
3505
}
3523
3506
case Decl::ClassTemplate:
0 commit comments