Browse Source

Fixed duplicate generation of forward declared class.

Fixes https://github.com/mono/CppSharp/issues/968.
pull/969/head
Joao Matos 8 years ago
parent
commit
34ce466d8d
  1. 6
      src/Generator/Passes/ResolveIncompleteDeclsPass.cs
  2. 6
      tests/CSharp/CSharp.h
  3. 2
      tests/CSharp/CSharpTemplates.h

6
src/Generator/Passes/ResolveIncompleteDeclsPass.cs

@ -78,13 +78,13 @@ namespace CppSharp.Passes @@ -78,13 +78,13 @@ namespace CppSharp.Passes
if (declaration.CompleteDeclaration != null)
return;
declaration.CompleteDeclaration =
ASTContext.FindCompleteClass(declaration.QualifiedName);
var @class = declaration as Class;
if (CheckForDuplicateForwardClass(@class))
return;
declaration.CompleteDeclaration =
ASTContext.FindCompleteClass(declaration.QualifiedName);
if (declaration.CompleteDeclaration == null)
{
declaration.GenerationKind = GenerationKind.Internal;

6
tests/CSharp/CSharp.h

@ -1251,3 +1251,9 @@ public: @@ -1251,3 +1251,9 @@ public:
virtual int virtualTakeArrays(Foo* fixedArrayOfPointersToObjects[3], int fixedArrayOfPrimitives[4],
int* fixedArrayOfPointersToPrimitives[5]) const;
};
class TestForwardedClassInAnotherUnit
{
};

2
tests/CSharp/CSharpTemplates.h

@ -472,3 +472,5 @@ template class DLL_API DerivedChangesTypeName<T1>; @@ -472,3 +472,5 @@ template class DLL_API DerivedChangesTypeName<T1>;
template class DLL_API TemplateWithIndexer<int>;
template class DLL_API TemplateWithIndexer<T1>;
template class DLL_API TemplateWithIndexer<T2*>;
class TestForwardedClassInAnotherUnit;

Loading…
Cancel
Save