-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup how the PInvokeGenerator handles CXType and resolves names (#61)
* Include launchsettings.json in the list of project files. * Changing the PInvokeGenerator to use \n by default. * Fixing PInvokeGenerator to use Equals rather than EndsWith when checking for multi-file * Updating the PInvokeGenerator types to more closely match the Clang C++ hierarchy. * Improving how type and cursor names are resolved. * Regenerating the ClangSharp bindings.
- Loading branch information
1 parent
23e8db8
commit 696cb97
Showing
33 changed files
with
825 additions
and
630 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 2 additions & 5 deletions
7
sources/ClangSharp.PInvokeGenerator/Cursors/Decls/FunctionTemplateDecl.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,15 @@ | ||
using System; | ||
using System.Diagnostics; | ||
|
||
namespace ClangSharp | ||
{ | ||
internal sealed class FunctionTemplateDecl : RedeclarableTemplateDecl | ||
{ | ||
private readonly Lazy<Type> _type; | ||
|
||
public FunctionTemplateDecl(CXCursor handle, Cursor parent) : base(handle, parent) | ||
{ | ||
Debug.Assert(handle.Kind == CXCursorKind.CXCursor_FunctionTemplate); | ||
_type = new Lazy<Type>(() => TranslationUnit.GetOrCreateType(Handle.Type, () => Type.Create(Handle.Type, TranslationUnit))); | ||
Type = TranslationUnit.GetOrCreateType(Handle.Type, () => Type.Create(Handle.Type, TranslationUnit)); | ||
} | ||
|
||
public Type Type => _type.Value; | ||
public Type Type { get; } | ||
} | ||
} |
8 changes: 2 additions & 6 deletions
8
sources/ClangSharp.PInvokeGenerator/Cursors/Decls/TypeDecl.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
using System; | ||
|
||
namespace ClangSharp | ||
{ | ||
internal class TypeDecl : NamedDecl | ||
{ | ||
private readonly Lazy<Type> _type; | ||
|
||
protected TypeDecl(CXCursor handle, Cursor parent) : base(handle, parent) | ||
{ | ||
_type = new Lazy<Type>(() => TranslationUnit.GetOrCreateType(Handle.Type, () => Type.Create(Handle.Type, TranslationUnit))); | ||
Type = TranslationUnit.GetOrCreateType(Handle.Type, () => Type.Create(Handle.Type, TranslationUnit)); | ||
} | ||
|
||
public Type Type => _type.Value; | ||
public Type Type { get; } | ||
} | ||
} |
8 changes: 2 additions & 6 deletions
8
sources/ClangSharp.PInvokeGenerator/Cursors/Decls/TypedefNameDecl.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
using System; | ||
|
||
namespace ClangSharp | ||
{ | ||
internal class TypedefNameDecl : TypeDecl | ||
{ | ||
private readonly Lazy<Type> _underlyingType; | ||
|
||
protected TypedefNameDecl(CXCursor handle, Cursor parent) : base(handle, parent) | ||
{ | ||
_underlyingType = new Lazy<Type>(() => TranslationUnit.GetOrCreateType(Handle.TypedefDeclUnderlyingType, () => Type.Create(Handle.TypedefDeclUnderlyingType, TranslationUnit))); | ||
UnderlyingType = TranslationUnit.GetOrCreateType(Handle.TypedefDeclUnderlyingType, () => Type.Create(Handle.TypedefDeclUnderlyingType, TranslationUnit)); | ||
} | ||
|
||
public Type UnderlyingType => _underlyingType.Value; | ||
public Type UnderlyingType { get; } | ||
} | ||
} |
8 changes: 2 additions & 6 deletions
8
sources/ClangSharp.PInvokeGenerator/Cursors/Decls/ValueDecl.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
using System; | ||
|
||
namespace ClangSharp | ||
{ | ||
internal class ValueDecl : NamedDecl | ||
{ | ||
private readonly Lazy<Type> _type; | ||
|
||
protected ValueDecl(CXCursor handle, Cursor parent) : base(handle, parent) | ||
{ | ||
_type = new Lazy<Type>(() => TranslationUnit.GetOrCreateType(Handle.Type, () => Type.Create(Handle.Type, TranslationUnit))); | ||
Type = TranslationUnit.GetOrCreateType(Handle.Type, () => Type.Create(Handle.Type, TranslationUnit)); | ||
} | ||
|
||
public Type Type => _type.Value; | ||
public Type Type { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.