Browse Source

Improved the CLI include collector to keep track of originating translation units.

pull/53/merge
triton 13 years ago
parent
commit
fb00f8e7b5
  1. 10
      src/Generator/Generators/CLI/CLIHeadersTemplate.cs
  2. 2
      src/Generator/Generators/CLI/CLITextTemplate.cs
  3. 1
      src/Generator/Generators/CLI/CLITypeReferences.cs

10
src/Generator/Generators/CLI/CLIHeadersTemplate.cs

@ -51,11 +51,19 @@ namespace CppSharp.Generators.CLI @@ -51,11 +51,19 @@ namespace CppSharp.Generators.CLI
var includes = new SortedSet<string>(StringComparer.InvariantCulture);
foreach (var typeRef in typeReferenceCollector.TypeReferences)
{
{
if (typeRef.Include.TranslationUnit == TranslationUnit)
continue;
if (typeRef.Include.File == TranslationUnit.FileName)
continue;
var include = typeRef.Include;
var unit = include.TranslationUnit;
if (unit != null && unit.Ignore)
continue;
if(!string.IsNullOrEmpty(include.File) && include.InHeader)
includes.Add(include.ToString());
}

2
src/Generator/Generators/CLI/CLITextTemplate.cs

@ -13,6 +13,8 @@ namespace CppSharp.Generators.CLI @@ -13,6 +13,8 @@ namespace CppSharp.Generators.CLI
}
public string File;
public TranslationUnit TranslationUnit;
public IncludeKind Kind;
public bool InHeader;

1
src/Generator/Generators/CLI/CLITypeReferences.cs

@ -88,6 +88,7 @@ namespace CppSharp.Generators.CLI @@ -88,6 +88,7 @@ namespace CppSharp.Generators.CLI
GetTypeReference(decl).Include = new Include()
{
File = declFile,
TranslationUnit = decl.Namespace.TranslationUnit,
Kind = Include.IncludeKind.Quoted,
InHeader = IsIncludeInHeader(record)
};

Loading…
Cancel
Save