Browse Source

Add per-declaration support for decl maps.

pull/1514/head
Joao Matos 5 years ago committed by João Matos
parent
commit
714fb7ecc4
  1. 4
      src/AST/Declaration.cs
  2. 6
      src/Generator/Types/DeclMapDatabase.cs

4
src/AST/Declaration.cs

@ -334,6 +334,9 @@ namespace CppSharp.AST @@ -334,6 +334,9 @@ namespace CppSharp.AST
public List<Declaration> Redeclarations { get; } = new List<Declaration>();
// Custom declaration map for custom code generation.
public object DeclMap { get; set; }
protected Declaration()
{
Access = AccessSpecifier.Public;
@ -372,6 +375,7 @@ namespace CppSharp.AST @@ -372,6 +375,7 @@ namespace CppSharp.AST
LineNumberEnd = declaration.LineNumberEnd;
IsImplicit = declaration.IsImplicit;
AssociatedDeclaration = declaration.AssociatedDeclaration;
DeclMap = declaration.DeclMap;
}
public override string ToString()

6
src/Generator/Types/DeclMapDatabase.cs

@ -60,6 +60,12 @@ namespace CppSharp.Types @@ -60,6 +60,12 @@ namespace CppSharp.Types
public bool FindDeclMap(Declaration decl, out DeclMap declMap)
{
if (decl.DeclMap != null)
{
declMap = decl.DeclMap as DeclMap;
return true;
}
// Looks up the decl in the cache map.
if (declMaps.ContainsKey(decl))
{

Loading…
Cancel
Save