Browse Source

Stubbed support for pack expansions to avoid crashes in certain cases such as variadic templates.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
pull/189/head
Dimitar Dobrev 12 years ago
parent
commit
66363787b4
  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 @@ -217,6 +217,11 @@ namespace CppSharp.AST
return true;
}
public bool VisitPackExpansionType(PackExpansionType packExpansionType, TypeQualifiers quals)
{
return true;
}
public virtual bool VisitPrimitiveType(PrimitiveType type, TypeQualifiers quals)
{
return true;

9
src/AST/Type.cs

@ -786,6 +786,14 @@ namespace CppSharp.AST @@ -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
/// <summary>
@ -891,6 +899,7 @@ namespace CppSharp.AST @@ -891,6 +899,7 @@ namespace CppSharp.AST
TypeQualifiers quals);
T VisitDependentNameType(DependentNameType dependent,
TypeQualifiers quals);
T VisitPackExpansionType(PackExpansionType packExpansionType, TypeQualifiers quals);
T VisitCILType(CILType type, TypeQualifiers quals);
}
}

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

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

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

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

5
src/Generator/Passes/CheckVirtualOverrideReturnCovariance.cs

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

5
src/Generator/Types/CppTypePrinter.cs

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

5
src/Parser/Parser.cpp

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

Loading…
Cancel
Save