Tools and libraries to glue C/C++ APIs to high-level languages
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

42 lines
1.0 KiB

using System;
using CppSharp.Types;
namespace CppSharp.Passes
{
public class ResolveIncompleteDeclsPass : TranslationUnitPass
{
public ResolveIncompleteDeclsPass()
{
}
public override bool VisitClassDecl(Class @class)
{
if (@class.Ignore)
return false;
if (!@class.IsIncomplete)
goto Out;
if (@class.CompleteDeclaration != null)
goto Out;
@class.CompleteDeclaration = Library.FindCompleteClass(@class.Name);
if (@class.CompleteDeclaration == null)
Console.WriteLine("Unresolved declaration: {0}", @class.Name);
Out:
return base.VisitClassDecl(@class);
}
}
public static class ResolveIncompleteDeclsExtensions
{
public static void ResolveIncompleteDecls(this PassBuilder builder)
{
var pass = new ResolveIncompleteDeclsPass();
builder.AddPass(pass);
}
}
}