diff --git a/src/Generator/Passes/MultipleInheritancePass.cs b/src/Generator/Passes/MultipleInheritancePass.cs index 5c7eb59e..1601e264 100644 --- a/src/Generator/Passes/MultipleInheritancePass.cs +++ b/src/Generator/Passes/MultipleInheritancePass.cs @@ -27,9 +27,9 @@ namespace CppSharp.Passes VisitOptions.VisitFunctionParameters = false; } - public override bool VisitTranslationUnit(TranslationUnit unit) + public override bool VisitASTContext(ASTContext context) { - bool result = base.VisitTranslationUnit(unit); + bool result = base.VisitASTContext(context); foreach (var @interface in interfaces.Where(i => !(i is ClassTemplateSpecialization))) { int index = @interface.Namespace.Declarations.IndexOf(@interface.OriginalClass); diff --git a/tests/CSharp/AnotherUnit.cpp b/tests/CSharp/AnotherUnit.cpp index 71d621f0..1fef2ecd 100644 --- a/tests/CSharp/AnotherUnit.cpp +++ b/tests/CSharp/AnotherUnit.cpp @@ -1,9 +1,47 @@ #include "AnotherUnit.h" +void SecondaryBase::VirtualMember() +{ +} + +int SecondaryBase::property() +{ + return 0; +} + +void SecondaryBase::setProperty(int value) +{ +} + +void SecondaryBase::function(bool* ok) +{ +} + +void SecondaryBase::protectedFunction() +{ +} + +int SecondaryBase::protectedProperty() +{ + return 0; +} + +void SecondaryBase::setProtectedProperty(int value) +{ +} + void functionInAnotherUnit() { } +MultipleInheritance::MultipleInheritance() +{ +} + +MultipleInheritance::~MultipleInheritance() +{ +} + namespace HasFreeConstant { extern const int DLL_API FREE_CONSTANT_IN_NAMESPACE = 5; diff --git a/tests/CSharp/AnotherUnit.h b/tests/CSharp/AnotherUnit.h index 511d980e..edb3236c 100644 --- a/tests/CSharp/AnotherUnit.h +++ b/tests/CSharp/AnotherUnit.h @@ -3,6 +3,32 @@ #pragma once +class DLL_API SecondaryBase +{ +public: + enum Property + { + P1, + P2 + }; + enum Function + { + M1, + M2 + }; + + virtual void VirtualMember(); + int property(); + void setProperty(int value); + void function(bool* ok = 0); + typedef void HasPointerToEnum(Property* pointerToEnum); + HasPointerToEnum* hasPointerToEnum; +protected: + void protectedFunction(); + int protectedProperty(); + void setProtectedProperty(int value); +}; + void DLL_API functionInAnotherUnit(); struct DLL_API ForwardDeclaredStruct; @@ -19,6 +45,13 @@ class ForwardInOtherUnitButSameModule { }; +class DLL_API MultipleInheritance : ForwardInOtherUnitButSameModule, SecondaryBase +{ +public: + MultipleInheritance(); + ~MultipleInheritance(); +}; + namespace HasFreeConstant { extern const int DLL_API FREE_CONSTANT_IN_NAMESPACE; diff --git a/tests/CSharp/CSharp.Tests.cs b/tests/CSharp/CSharp.Tests.cs index 9288bc31..0173bcf1 100644 --- a/tests/CSharp/CSharp.Tests.cs +++ b/tests/CSharp/CSharp.Tests.cs @@ -23,6 +23,7 @@ public unsafe class CSharpTests : GeneratorTestFixture #pragma warning disable 0219 // warning CS0219: The variable `foo' is assigned but its value is never used ALLCAPS_UNDERSCORES a; + new MultipleInheritance().Dispose(); using (var testRenaming = new TestRenaming()) { testRenaming.name(); diff --git a/tests/CSharp/CSharp.cpp b/tests/CSharp/CSharp.cpp index a6e05219..81b050d0 100644 --- a/tests/CSharp/CSharp.cpp +++ b/tests/CSharp/CSharp.cpp @@ -839,36 +839,6 @@ HasVirtualDtor1* CallDtorVirtually::getHasVirtualDtor1(HasVirtualDtor1* returned return returned; } -void SecondaryBase::VirtualMember() -{ -} - -int SecondaryBase::property() -{ - return 0; -} - -void SecondaryBase::setProperty(int value) -{ -} - -void SecondaryBase::function(bool* ok) -{ -} - -void SecondaryBase::protectedFunction() -{ -} - -int SecondaryBase::protectedProperty() -{ - return 0; -} - -void SecondaryBase::setProtectedProperty(int value) -{ -} - TestOverrideFromSecondaryBase::TestOverrideFromSecondaryBase() { } diff --git a/tests/CSharp/CSharp.h b/tests/CSharp/CSharp.h index 6f8114e8..b7428ecf 100644 --- a/tests/CSharp/CSharp.h +++ b/tests/CSharp/CSharp.h @@ -684,32 +684,6 @@ protected: } u; }; -class DLL_API SecondaryBase -{ -public: - enum Property - { - P1, - P2 - }; - enum Function - { - M1, - M2 - }; - - virtual void VirtualMember(); - int property(); - void setProperty(int value); - void function(bool* ok = 0); - typedef void HasPointerToEnum(Property* pointerToEnum); - HasPointerToEnum* hasPointerToEnum; -protected: - void protectedFunction(); - int protectedProperty(); - void setProtectedProperty(int value); -}; - class DLL_API TestOverrideFromSecondaryBase : public Foo, public SecondaryBase { public: