Browse Source

Ignored all system declarations until we can properly support them.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/661/head
Dimitar Dobrev 9 years ago
parent
commit
002565971f
  1. 1
      src/Generator/Driver.cs
  2. 3
      src/Generator/Generators/CLI/CLITypeReferences.cs
  3. 7
      src/Generator/Passes/CheckDuplicatedNamesPass.cs
  4. 5
      src/Generator/Passes/DelegatesPass.cs
  5. 2
      src/Generator/Passes/HandleDefaultParamValuesPass.cs
  6. 2
      src/Generator/Passes/IgnoreAbstractOperatorsPass.cs
  7. 14
      src/Generator/Passes/IgnoreSystemDeclarationsPass.cs
  8. 3
      src/Generator/Types/Types.cs
  9. 4
      tests/Common/Common.h

1
src/Generator/Driver.cs

@ -299,6 +299,7 @@ namespace CppSharp @@ -299,6 +299,7 @@ namespace CppSharp
{
TranslationUnitPasses.AddPass(new SortDeclarationsPass());
TranslationUnitPasses.AddPass(new ResolveIncompleteDeclsPass());
TranslationUnitPasses.AddPass(new IgnoreSystemDeclarationsPass());
TranslationUnitPasses.AddPass(new CheckIgnoredDeclsPass());
if (Options.IsCSharpGenerator)

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

@ -177,9 +177,6 @@ namespace CppSharp.Generators.CLI @@ -177,9 +177,6 @@ namespace CppSharp.Generators.CLI
public override bool VisitDeclaration(Declaration decl)
{
if (decl.Namespace != null && decl.Namespace.TranslationUnit.IsSystemHeader)
return false;
return decl.IsDeclared;
}

7
src/Generator/Passes/CheckDuplicatedNamesPass.cs

@ -194,13 +194,6 @@ namespace CppSharp.Passes @@ -194,13 +194,6 @@ namespace CppSharp.Passes
return false;
}
public override bool VisitDeclaration(Declaration decl)
{
if (decl.Namespace != null && decl.TranslationUnit.IsSystemHeader)
return false;
return base.VisitDeclaration(decl);
}
private static IEnumerable<Field> GetAllFields(Class @class, List<Field> fields = null)
{
fields = fields ?? new List<Field>();

5
src/Generator/Passes/DelegatesPass.cs

@ -41,7 +41,7 @@ namespace CppSharp.Passes @@ -41,7 +41,7 @@ namespace CppSharp.Passes
libsDelegates[library] = new Dictionary<string, DelegateDefinition>();
var unit = context.TranslationUnits.LastOrDefault(u => u.IsValid && u.IsGenerated &&
!u.IsSystemHeader && u.HasDeclarations);
u.HasDeclarations);
if (unit == null)
return false;
@ -86,8 +86,7 @@ namespace CppSharp.Passes @@ -86,8 +86,7 @@ namespace CppSharp.Passes
public override bool VisitMethodDecl(Method method)
{
if (!base.VisitMethodDecl(method) || !method.IsVirtual || method.Ignore
|| method.TranslationUnit.IsSystemHeader)
if (!base.VisitMethodDecl(method) || !method.IsVirtual || method.Ignore)
return false;
var @params = method.GatherInternalParams(Driver.Options.IsItaniumLikeAbi, true).ToList();

2
src/Generator/Passes/HandleDefaultParamValuesPass.cs

@ -37,7 +37,7 @@ namespace CppSharp.Passes @@ -37,7 +37,7 @@ namespace CppSharp.Passes
public override bool VisitFunctionDecl(Function function)
{
if (!base.VisitFunctionDecl(function) || function.TranslationUnit.IsSystemHeader)
if (!base.VisitFunctionDecl(function) || function.Ignore)
return false;
Generator.CurrentOutputNamespace = function.TranslationUnit.Module.OutputNamespace;

2
src/Generator/Passes/IgnoreAbstractOperatorsPass.cs

@ -6,7 +6,7 @@ namespace CppSharp.Passes @@ -6,7 +6,7 @@ namespace CppSharp.Passes
{
public override bool VisitMethodDecl(Method method)
{
if (!base.VisitMethodDecl(method) || method.TranslationUnit.IsSystemHeader)
if (!base.VisitMethodDecl(method))
return false;
if (method.IsPure && method.IsOperator)

14
src/Generator/Passes/IgnoreSystemDeclarationsPass.cs

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
using CppSharp.AST;
namespace CppSharp.Passes
{
public class IgnoreSystemDeclarationsPass : TranslationUnitPass
{
public override bool VisitDeclaration(Declaration decl)
{
if (decl.Namespace != null && decl.TranslationUnit.IsSystemHeader)
decl.ExplicitlyIgnore();
return base.VisitDeclaration(decl);
}
}
}

3
src/Generator/Types/Types.cs

@ -32,8 +32,7 @@ namespace CppSharp @@ -32,8 +32,7 @@ namespace CppSharp
if (decl.CompleteDeclaration != null)
return VisitDeclaration(decl.CompleteDeclaration);
if (!(decl is TypedefDecl) && (!decl.IsGenerated ||
(decl is Class && decl.TranslationUnit.IsSystemHeader)))
if (!(decl is TypedefDecl) && !decl.IsGenerated)
{
Ignore();
return false;

4
tests/Common/Common.h

@ -1160,3 +1160,7 @@ struct polygon @@ -1160,3 +1160,7 @@ struct polygon
{
InteriorRings<T> interior_rings;
};
class HasSystemBase : public std::string
{
};

Loading…
Cancel
Save