Browse Source

Fix invalid C++/CLI generated for anonymous types

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1204/head
Dimitar Dobrev 7 years ago
parent
commit
51d422a756
  1. 8
      src/Generator/Passes/CleanInvalidDeclNamesPass.cs
  2. 66
      tests/CSharp/CSharp.h
  3. 66
      tests/Common/Common.h

8
src/Generator/Passes/CleanInvalidDeclNamesPass.cs

@ -4,6 +4,7 @@ using System.Text; @@ -4,6 +4,7 @@ using System.Text;
using CppSharp.AST;
using CppSharp.Generators.CLI;
using CppSharp.Generators.CSharp;
using CppSharp.Generators;
namespace CppSharp.Passes
{
@ -14,6 +15,13 @@ namespace CppSharp.Passes @@ -14,6 +15,13 @@ namespace CppSharp.Passes
if (!base.VisitClassDecl(@class))
return false;
if (Options.GeneratorKind == GeneratorKind.CLI &&
string.IsNullOrEmpty(@class.OriginalName))
{
@class.ExplicitlyIgnore();
return true;
}
if (@class.Layout != null)
{
int order = 0;

66
tests/CSharp/CSharp.h

@ -1307,72 +1307,6 @@ DLL_API void va_listFunction(va_list v); @@ -1307,72 +1307,6 @@ DLL_API void va_listFunction(va_list v);
DLL_API char* returnCharPointer();
DLL_API const char* takeConstCharStarRef(const char*& c);
union
{
struct
{
struct
{
long Capabilities;
} Server;
struct
{
long Capabilities;
} Share;
} Smb2;
} ProtocolSpecific;
struct DLL_API TestNestedTypes
{
public:
struct
{
struct
{
};
};
struct
{
struct
{
};
};
struct
{
struct
{
};
};
struct
{
struct
{
};
};
union as_types
{
int as_int;
struct uchars
{
unsigned char blue, green, red, alpha;
} as_uchar;
};
};
class TestNamingAnonymousTypesInUnion
{
public:
union {
struct {
} argb;
struct {
} ahsv;
struct {
} acmyk;
} ct;
};
struct {
struct {
struct {

66
tests/Common/Common.h

@ -822,6 +822,44 @@ public: @@ -822,6 +822,44 @@ public:
DLL_API void va_listFunction(va_list v);
struct DLL_API TestNestedTypes
{
public:
struct
{
struct
{
};
};
struct
{
struct
{
};
};
struct
{
struct
{
};
};
struct
{
struct
{
};
};
union as_types
{
int as_int;
struct uchars
{
unsigned char blue, green, red, alpha;
} as_uchar;
};
};
class DLL_API HasStdString
{
public:
@ -883,6 +921,19 @@ private: @@ -883,6 +921,19 @@ private:
DLL_API bool operator ==(const DifferentConstOverloads& d, const char* s);
class TestNamingAnonymousTypesInUnion
{
public:
union {
struct {
} argb;
struct {
} ahsv;
struct {
} acmyk;
} ct;
};
class DLL_API RefTypeClassPassTry { };
void DLL_API funcTryRefTypePtrOut(CS_OUT RefTypeClassPassTry* classTry);
@ -1380,6 +1431,21 @@ inline namespace InlineNamespace @@ -1380,6 +1431,21 @@ inline namespace InlineNamespace
}
}
union
{
struct
{
struct
{
long Capabilities;
} Server;
struct
{
long Capabilities;
} Share;
} Smb2;
} ProtocolSpecific;
template<class _Other>
using UsingTemplatePtr = _Other *;

Loading…
Cancel
Save