Skip to content

Commit b41b96d

Browse files
committed
Fixed a regression causing generated types to be incorrectly reordered.
Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent 764806e commit b41b96d

File tree

3 files changed

+26
-35
lines changed

3 files changed

+26
-35
lines changed

src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Std.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ namespace Std
5353
{
5454
}
5555

56+
namespace Std
57+
{
58+
}
59+
5660
namespace Std
5761
{
5862
namespace Allocator
@@ -418,7 +422,7 @@ public partial struct __Internal
418422
}
419423
}
420424

421-
public unsafe partial class Map<_95, _96, _97, _98>
425+
public unsafe partial class Map<_Key, _Tp, _Compare, _Allocator>
422426
{
423427
}
424428
}

src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Std.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ namespace Std
5353
{
5454
}
5555

56+
namespace Std
57+
{
58+
}
59+
5660
namespace Std
5761
{
5862
namespace Allocator
@@ -418,7 +422,7 @@ public partial struct __Internal
418422
}
419423
}
420424

421-
public unsafe partial class Map<_95, _96, _97, _98>
425+
public unsafe partial class Map<_Key, _Tp, _Compare, _Allocator>
422426
{
423427
}
424428
}

src/CppParser/Parser.cpp

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ Parser::WalkClassTemplateSpecialization(const clang::ClassTemplateSpecialization
10551055
TS->isIncomplete = true;
10561056
if (CTS->getDefinition())
10571057
{
1058-
auto Complete = WalkDeclaration(CTS->getDefinition());
1058+
auto Complete = WalkDeclarationDef(CTS->getDefinition());
10591059
if (!Complete->isIncomplete)
10601060
TS->completeDeclaration = Complete;
10611061
}
@@ -1105,7 +1105,7 @@ Parser::WalkClassTemplatePartialSpecialization(const clang::ClassTemplatePartial
11051105
TS->isIncomplete = true;
11061106
if (CTS->getDefinition())
11071107
{
1108-
auto Complete = WalkDeclaration(CTS->getDefinition());
1108+
auto Complete = WalkDeclarationDef(CTS->getDefinition());
11091109
if (!Complete->isIncomplete)
11101110
TS->completeDeclaration = Complete;
11111111
}
@@ -3468,7 +3468,18 @@ void Parser::HandleDeclaration(const clang::Decl* D, Declaration* Decl)
34683468

34693469
Declaration* Parser::WalkDeclarationDef(clang::Decl* D)
34703470
{
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;
34723483
}
34733484

34743485
Declaration* Parser::WalkDeclaration(const clang::Decl* D)
@@ -3483,41 +3494,13 @@ Declaration* Parser::WalkDeclaration(const clang::Decl* D)
34833494
case Decl::Record:
34843495
{
34853496
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);
35013498
break;
35023499
}
35033500
case Decl::CXXRecord:
35043501
{
35053502
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);
35213504
break;
35223505
}
35233506
case Decl::ClassTemplate:

0 commit comments

Comments
 (0)