Browse Source

Merge pull request #361 from ddobrev/master

Fixed a regression causing ignored types with bases without empty ctors to fail
pull/363/head
João Matos 11 years ago
parent
commit
aa05b1059b
  1. 2
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs
  2. 6
      src/Generator/Passes/CleanInvalidDeclNamesPass.cs
  3. 2
      tests/CSharpTemp/CSharpTemp.cs
  4. 9
      tests/CSharpTemp/CSharpTemp.h

2
src/Generator/Generators/CSharp/CSharpTextTemplate.cs

@ -744,7 +744,7 @@ namespace CppSharp.Generators.CSharp @@ -744,7 +744,7 @@ namespace CppSharp.Generators.CSharp
var bases = new List<string>();
var needsBase = @class.HasGeneratedBase;
var needsBase = @class.HasGeneratedBase && @class.IsGenerated;
if (needsBase)
{

6
src/Generator/Passes/CleanInvalidDeclNamesPass.cs

@ -123,6 +123,12 @@ namespace CppSharp.Passes @@ -123,6 +123,12 @@ namespace CppSharp.Passes
return base.VisitTypedefDecl(typedef);
}
public override bool VisitVariableDecl(Variable variable)
{
variable.Name = CheckName(variable.Name);
return base.VisitVariableDecl(variable);
}
private static void CheckEnumName(Enumeration @enum)
{
// If we still do not have a valid name, then try to guess one

2
tests/CSharpTemp/CSharpTemp.cs

@ -82,6 +82,8 @@ namespace CppSharp.Tests @@ -82,6 +82,8 @@ namespace CppSharp.Tests
{
ctx.SetClassAsValueType("TestCopyConstructorVal");
ctx.SetClassAsValueType("QGenericArgument");
ctx.IgnoreClassWithName("IgnoredTypeInheritingNonIgnoredWithNoEmptyCtor");
}
public override void Postprocess(Driver driver, ASTContext ctx)

9
tests/CSharpTemp/CSharpTemp.h

@ -10,6 +10,8 @@ public: @@ -10,6 +10,8 @@ public:
int& operator[](int i);
int A;
static int null;
protected:
int P;
};
@ -20,6 +22,7 @@ public: @@ -20,6 +22,7 @@ public:
Qux();
Qux(Foo foo);
int farAwayFunc() const;
int array[3];
void obsolete();
};
@ -253,6 +256,10 @@ class DLL_API IgnoredType @@ -253,6 +256,10 @@ class DLL_API IgnoredType
{
};
class DLL_API IgnoredTypeInheritingNonIgnoredWithNoEmptyCtor : public P
{
};
class DLL_API PropertyWithIgnoredType
{
public:
@ -260,4 +267,4 @@ public: @@ -260,4 +267,4 @@ public:
void setIgnoredType(const IgnoredType<int>& value);
private:
IgnoredType<int> _ignoredType;
};
};

Loading…
Cancel
Save