From f549b63711526e3bfd556af084472b361d98eb2a Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Fri, 26 May 2017 02:20:41 +0300 Subject: [PATCH] Removed the useless and problematic mapping of typedef-ed classes to empty ones. Signed-off-by: Dimitar Dobrev --- src/Generator/Generators/CSharp/CSharpSources.cs | 10 +--------- tests/Common/Common.Tests.cs | 1 + tests/Common/Common.cpp | 5 +++++ tests/Common/Common.h | 2 ++ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Generator/Generators/CSharp/CSharpSources.cs b/src/Generator/Generators/CSharp/CSharpSources.cs index 01e9aa18..dc0ecc94 100644 --- a/src/Generator/Generators/CSharp/CSharpSources.cs +++ b/src/Generator/Generators/CSharp/CSharpSources.cs @@ -2914,16 +2914,8 @@ namespace CppSharp.Generators.CSharp GenerateDeclarationCommon(typedef); FunctionType functionType; - TagType tag; - if (typedef.Type.IsPointerToPrimitiveType(PrimitiveType.Void) - || typedef.Type.IsPointerTo(out tag)) - { - PushBlock(BlockKind.Typedef); - WriteLine("public class " + typedef.Name + @" { }"); - PopBlock(NewLineKind.BeforeNextBlock); - } - else if (typedef.Type.IsPointerTo(out functionType)) + if (typedef.Type.IsPointerTo(out functionType)) { PushBlock(BlockKind.Typedef); var attributedType = typedef.Type.GetPointee() as AttributedType; diff --git a/tests/Common/Common.Tests.cs b/tests/Common/Common.Tests.cs index 094f818e..db9a8985 100644 --- a/tests/Common/Common.Tests.cs +++ b/tests/Common/Common.Tests.cs @@ -29,6 +29,7 @@ public class CommonTests : GeneratorTestFixture using (var foo = new Foo()) { Assert.That(overridesNonDirectVirtual.RetInt(foo), Is.EqualTo(3)); + Assert.That(foo.FooPtr, Is.EqualTo(1)); } } using (var derivedFromTemplateInstantiationWithVirtual = new DerivedFromTemplateInstantiationWithVirtual()) diff --git a/tests/Common/Common.cpp b/tests/Common/Common.cpp index 4bf3849d..149a1879 100644 --- a/tests/Common/Common.cpp +++ b/tests/Common/Common.cpp @@ -33,6 +33,11 @@ bool Foo::operator ==(const Foo& other) const return A == other.A && B == other.B; } +int Foo::fooPtr() +{ + return 1; +} + Foo2::Foo2() {} Foo2 Foo2::operator<<(signed int i) diff --git a/tests/Common/Common.h b/tests/Common/Common.h index 0cb7a66d..97f2a9f8 100644 --- a/tests/Common/Common.h +++ b/tests/Common/Common.h @@ -65,6 +65,8 @@ public: int TakesRef(const Foo& other); bool operator ==(const Foo& other) const; + + int fooPtr(); }; // HACK: do not move these to the cpp - C++/CLI is buggy and cannot link static fields initialised in the cpp