Browse Source

Ignored templates specialised with types external to the template itself.

Supporting such external types is quite difficult so it will be done later on.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/787/head
Dimitar Dobrev 9 years ago
parent
commit
8fe6e346c5
  1. 2
      src/Generator/Passes/CheckIgnoredDecls.cs
  2. 8
      src/Generator/Passes/TrimSpecializationsPass.cs

2
src/Generator/Passes/CheckIgnoredDecls.cs

@ -403,7 +403,7 @@ namespace CppSharp.Passes @@ -403,7 +403,7 @@ namespace CppSharp.Passes
return !decl.IsIncomplete || decl.CompleteDeclaration != null;
}
private bool IsTypeExternal(Module module, Type type)
public static bool IsTypeExternal(Module module, Type type)
{
Declaration declaration;
if (!(type.GetFinalPointee() ?? type).TryGetDeclaration(out declaration))

8
src/Generator/Passes/TrimSpecializationsPass.cs

@ -15,6 +15,11 @@ namespace CppSharp.Passes @@ -15,6 +15,11 @@ namespace CppSharp.Passes
@class.Specializations.RemoveAll(
s => s.Fields.Any(f => f.Type.IsPrimitiveType(PrimitiveType.Void)));
foreach (var specialization in @class.Specializations.Where(s => s.Arguments.Any(
a => a.Type.Type != null &&
CheckIgnoredDeclsPass.IsTypeExternal(@class.TranslationUnit.Module, a.Type.Type))))
specialization.ExplicitlyIgnore();
if (@class.Specializations.Count == 0)
return false;
@ -28,8 +33,7 @@ namespace CppSharp.Passes @@ -28,8 +33,7 @@ namespace CppSharp.Passes
@class.Specializations.Remove(specialization);
for (int i = @class.Specializations.Count - 1; i >= 0; i--)
if (@class.Specializations[i] is ClassTemplatePartialSpecialization &&
!@class.Specializations[i].Arguments.All(allPointers))
if (@class.Specializations[i] is ClassTemplatePartialSpecialization)
@class.Specializations.RemoveAt(i);
return true;

Loading…
Cancel
Save