Permalink
Browse files

Fixed a regression when a public virtual is overridden as private.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
  • Loading branch information...
ddobrev committed Jul 28, 2017
1 parent 2f2f13f commit 8b9c3ab89fb00998b4236c5ce65b250087099883
Showing with 17 additions and 1 deletion.
  1. +2 −1 src/Generator/Driver.cs
  2. +14 −0 src/Generator/Passes/EqualiseAccessOfOverrideAndBasePass.cs
  3. +1 −0 tests/Common/Common.h
@@ -281,6 +281,8 @@ public void SetupPasses(ILibrary library)
TranslationUnitPasses.AddPass(new SortDeclarationsPass());
TranslationUnitPasses.AddPass(new ResolveIncompleteDeclsPass());
TranslationUnitPasses.AddPass(new IgnoreSystemDeclarationsPass());
if (Options.IsCSharpGenerator)
TranslationUnitPasses.AddPass(new EqualiseAccessOfOverrideAndBasePass());
TranslationUnitPasses.AddPass(new CheckIgnoredDeclsPass());
if (Options.IsCSharpGenerator)
@@ -323,7 +325,6 @@ public void SetupPasses(ILibrary library)
TranslationUnitPasses.AddPass(new MultipleInheritancePass());
TranslationUnitPasses.AddPass(new ParamTypeToInterfacePass());
TranslationUnitPasses.AddPass(new DelegatesPass());
TranslationUnitPasses.AddPass(new EqualiseAccessOfOverrideAndBasePass());
}
TranslationUnitPasses.AddPass(new GetterSetterToPropertyPass());
@@ -6,6 +6,20 @@ namespace CppSharp.Passes
{
public class EqualiseAccessOfOverrideAndBasePass : TranslationUnitPass
{
public EqualiseAccessOfOverrideAndBasePass()
{
VisitOptions.VisitClassBases = false;
VisitOptions.VisitClassFields = false;
VisitOptions.VisitClassProperties = false;
VisitOptions.VisitEventParameters = false;
VisitOptions.VisitFunctionParameters = false;
VisitOptions.VisitFunctionReturnType = false;
VisitOptions.VisitNamespaceEnums = false;
VisitOptions.VisitNamespaceEvents = false;
VisitOptions.VisitNamespaceVariables = false;
VisitOptions.VisitTemplateArguments = false;
}
public override bool VisitASTContext(ASTContext context)
{
var result = base.VisitASTContext(context);
@@ -261,6 +261,7 @@ class DLL_API ImplementsAbstractFoo : public AbstractFoo
typedef int typedefInOverride;
virtual int pureFunction(typedefInOverride i = 0);
virtual int pureFunction1();
private:
virtual int pureFunction2(bool* ok = 0);
};

0 comments on commit 8b9c3ab

Please sign in to comment.