|
|
|
@ -3,7 +3,6 @@ using System.IO;
@@ -3,7 +3,6 @@ using System.IO;
|
|
|
|
|
using System.Linq; |
|
|
|
|
using System.Text; |
|
|
|
|
using CppSharp.AST; |
|
|
|
|
using CppSharp.AST.Extensions; |
|
|
|
|
using CppSharp.Types; |
|
|
|
|
|
|
|
|
|
namespace CppSharp.Passes |
|
|
|
@ -17,18 +16,13 @@ namespace CppSharp.Passes
@@ -17,18 +16,13 @@ namespace CppSharp.Passes
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override bool VisitTemplateSpecializationType(TemplateSpecializationType template, TypeQualifiers quals) |
|
|
|
|
public override bool VisitClassTemplateSpecializationDecl(ClassTemplateSpecialization specialization) |
|
|
|
|
{ |
|
|
|
|
if (AlreadyVisited(template) || template.Template.Access == AccessSpecifier.Private) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
if (template.Arguments.Select(a => a.Type.Type.Desugar()).All(t => t.IsAddress() && !t.GetFinalPointee().IsDependent)) |
|
|
|
|
if (!specialization.IsDependent) |
|
|
|
|
{ |
|
|
|
|
var cppTypePrinter = new CppTypePrinter { PrintScopeKind = CppTypePrintScopeKind.Qualified }; |
|
|
|
|
templateInstantiations.Add(string.Format("{0}<{1}>", template.Template.Name, |
|
|
|
|
string.Join(", ", template.Arguments.Select(a => a.Type.Type.Visit(cppTypePrinter))))); |
|
|
|
|
templateInstantiations.Add(specialization.Visit(cppTypePrinter)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -40,7 +34,8 @@ namespace CppSharp.Passes
@@ -40,7 +34,8 @@ namespace CppSharp.Passes
|
|
|
|
|
foreach (var header in module.Headers) |
|
|
|
|
cppBuilder.AppendFormat("#include <{0}>\n", header); |
|
|
|
|
foreach (var templateInstantiation in templateInstantiations) |
|
|
|
|
cppBuilder.AppendFormat("\ntemplate class {0};", templateInstantiation); |
|
|
|
|
cppBuilder.AppendFormat("\ntemplate class {0}{1};", |
|
|
|
|
Platform.IsWindows ? "__declspec(dllexport) " : string.Empty, templateInstantiation); |
|
|
|
|
var cpp = string.Format("{0}.cpp", module.TemplatesLibraryName); |
|
|
|
|
Directory.CreateDirectory(Driver.Options.OutputDir); |
|
|
|
|
var path = Path.Combine(Driver.Options.OutputDir, cpp); |
|
|
|
|