Browse Source

Merge pull request #189 from ddobrev/master

Stubbed support for pack expansions to avoid crashes in certain cases such as variadic templates
pull/190/head
João Matos 12 years ago
parent
commit
6b4e434667
  1. 5
      src/AST/ASTVisitor.cs
  2. 9
      src/AST/Type.cs
  3. 5
      src/Generator/Generators/CLI/CLITypePrinter.cs
  4. 5
      src/Generator/Generators/CSharp/CSharpTypePrinter.cs
  5. 5
      src/Generator/Passes/CheckVirtualOverrideReturnCovariance.cs
  6. 5
      src/Generator/Types/CppTypePrinter.cs
  7. 5
      src/Parser/Parser.cpp

5
src/AST/ASTVisitor.cs

@ -217,6 +217,11 @@ namespace CppSharp.AST
return true; return true;
} }
public bool VisitPackExpansionType(PackExpansionType packExpansionType, TypeQualifiers quals)
{
return true;
}
public virtual bool VisitPrimitiveType(PrimitiveType type, TypeQualifiers quals) public virtual bool VisitPrimitiveType(PrimitiveType type, TypeQualifiers quals)
{ {
return true; return true;

9
src/AST/Type.cs

@ -786,6 +786,14 @@ namespace CppSharp.AST
} }
} }
public class PackExpansionType : Type
{
public override T Visit<T>(ITypeVisitor<T> visitor, TypeQualifiers quals = new TypeQualifiers())
{
return visitor.VisitPackExpansionType(this, quals);
}
}
#region Primitives #region Primitives
/// <summary> /// <summary>
@ -891,6 +899,7 @@ namespace CppSharp.AST
TypeQualifiers quals); TypeQualifiers quals);
T VisitDependentNameType(DependentNameType dependent, T VisitDependentNameType(DependentNameType dependent,
TypeQualifiers quals); TypeQualifiers quals);
T VisitPackExpansionType(PackExpansionType packExpansionType, TypeQualifiers quals);
T VisitCILType(CILType type, TypeQualifiers quals); T VisitCILType(CILType type, TypeQualifiers quals);
} }
} }

5
src/Generator/Generators/CLI/CLITypePrinter.cs

@ -259,6 +259,11 @@ namespace CppSharp.Generators.CLI
throw new NotImplementedException(); throw new NotImplementedException();
} }
public string VisitPackExpansionType(PackExpansionType packExpansionType, TypeQualifiers quals)
{
return string.Empty;
}
public string VisitCILType(CILType type, TypeQualifiers quals) public string VisitCILType(CILType type, TypeQualifiers quals)
{ {
return type.Type.FullName.Replace(".", "::") + "^"; return type.Type.FullName.Replace(".", "::") + "^";

5
src/Generator/Generators/CSharp/CSharpTypePrinter.cs

@ -348,6 +348,11 @@ namespace CppSharp.Generators.CSharp
throw new NotImplementedException(); throw new NotImplementedException();
} }
public CSharpTypePrinterResult VisitPackExpansionType(PackExpansionType packExpansionType, TypeQualifiers quals)
{
return string.Empty;
}
public CSharpTypePrinterResult VisitCILType(CILType type, TypeQualifiers quals) public CSharpTypePrinterResult VisitCILType(CILType type, TypeQualifiers quals)
{ {
return type.Type.FullName; return type.Type.FullName;

5
src/Generator/Passes/CheckVirtualOverrideReturnCovariance.cs

@ -151,6 +151,11 @@ namespace CppSharp.Passes
return false; return false;
} }
public bool VisitPackExpansionType(PackExpansionType packExpansionType, TypeQualifiers quals)
{
return true;
}
public bool VisitCILType(CILType type, TypeQualifiers quals) public bool VisitCILType(CILType type, TypeQualifiers quals)
{ {
return false; return false;

5
src/Generator/Types/CppTypePrinter.cs

@ -178,6 +178,11 @@ namespace CppSharp.Types
throw new System.NotImplementedException(); throw new System.NotImplementedException();
} }
public string VisitPackExpansionType(PackExpansionType packExpansionType, TypeQualifiers quals)
{
return string.Empty;
}
public string VisitCILType(CILType type, TypeQualifiers quals) public string VisitCILType(CILType type, TypeQualifiers quals)
{ {
return string.Empty; return string.Empty;

5
src/Parser/Parser.cpp

@ -1653,8 +1653,9 @@ CppSharp::AST::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc*
} }
case Type::PackExpansion: case Type::PackExpansion:
{ {
// Ignored. // TODO: stubbed
return nullptr; Ty = gcnew CppSharp::AST::PackExpansionType();
break;
} }
default: default:
{ {

Loading…
Cancel
Save