Skip to content

Commit

Permalink
Cleanup to resolves some bugs and codegen issues (#215)
Browse files Browse the repository at this point in the history
* Adding an option for generating a VtblIndex attribute

* Adding tests validating the VtblIndexAttribute, NativeInheritanceAttribute, and explicit vtbl generation

* Move fnptr and nint codegen to be part of latest by default

* Ensure multi-dimensional fixed-sized buffers use the correct name for the first field

* Ensure multi-dimensional buffers are correctly handled for variable declarations

* Ensure we use main and beta3 in our CI and versions
  • Loading branch information
tannergooding authored Mar 22, 2021
1 parent 491e24b commit 7105c10
Show file tree
Hide file tree
Showing 100 changed files with 2,327 additions and 509 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<PackageOutputPath>$(BaseArtifactsPath)pkg/$(Configuration)/</PackageOutputPath>
<Product>ClangSharp</Product>
<VersionPrefix>11.0.0</VersionPrefix>
<VersionSuffix>beta2</VersionSuffix>
<VersionSuffix>beta3</VersionSuffix>
<VersionSuffix Condition="'$(BUILD_REASON)' == 'PullRequest'">pr</VersionSuffix>
</PropertyGroup>

Expand Down
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ ClangSharp provides Clang bindings written in C#. It is self-hosted and auto-gen

| Job | Debug Status | Release Status |
| --- | ------------ | -------------- |
| Windows x86 | [![Build Status](https://dev.azure.com/ms/ClangSharp/_apis/build/status/microsoft.ClangSharp?branchName=master&jobName=windows_debug_x86)](https://dev.azure.com/ms/ClangSharp/_build/latest?definitionId=155&branchName=master) | [![Build Status](https://dev.azure.com/ms/ClangSharp/_apis/build/status/microsoft.ClangSharp?branchName=master&jobName=windows_release_x86)](https://dev.azure.com/ms/ClangSharp/_build/latest?definitionId=155&branchName=master) |
| Windows x64 | [![Build Status](https://dev.azure.com/ms/ClangSharp/_apis/build/status/microsoft.ClangSharp?branchName=master&jobName=windows_debug_x64)](https://dev.azure.com/ms/ClangSharp/_build/latest?definitionId=155&branchName=master) | [![Build Status](https://dev.azure.com/ms/ClangSharp/_apis/build/status/microsoft.ClangSharp?branchName=master&jobName=windows_release_x64)](https://dev.azure.com/ms/ClangSharp/_build/latest?definitionId=155&branchName=master) |
| Ubuntu 18.04 x64 | [![Build Status](https://dev.azure.com/ms/ClangSharp/_apis/build/status/microsoft.ClangSharp?branchName=master&jobName=ubuntu_debug_x64)](https://dev.azure.com/ms/ClangSharp/_build/latest?definitionId=155&branchName=master) | [![Build Status](https://dev.azure.com/ms/ClangSharp/_apis/build/status/microsoft.ClangSharp?branchName=master&jobName=ubuntu_release_x64)](https://dev.azure.com/ms/ClangSharp/_build/latest?definitionId=155&branchName=master) |
| MacOS x64 | [![Build Status](https://dev.azure.com/ms/ClangSharp/_apis/build/status/microsoft.ClangSharp?branchName=master&jobName=macos_debug_x64)](https://dev.azure.com/ms/ClangSharp/_build/latest?definitionId=155&branchName=master) | [![Build Status](https://dev.azure.com/ms/ClangSharp/_apis/build/status/microsoft.ClangSharp?branchName=master&jobName=macos_release_x64)](https://dev.azure.com/ms/ClangSharp/_build/latest?definitionId=155&branchName=master) |
| Windows x86 | [![Build Status](https://dev.azure.com/ms/ClangSharp/_apis/build/status/microsoft.ClangSharp?branchName=main&jobName=windows_debug_x86)](https://dev.azure.com/ms/ClangSharp/_build/latest?definitionId=155&branchName=main) | [![Build Status](https://dev.azure.com/ms/ClangSharp/_apis/build/status/microsoft.ClangSharp?branchName=main&jobName=windows_release_x86)](https://dev.azure.com/ms/ClangSharp/_build/latest?definitionId=155&branchName=main) |
| Windows x64 | [![Build Status](https://dev.azure.com/ms/ClangSharp/_apis/build/status/microsoft.ClangSharp?branchName=main&jobName=windows_debug_x64)](https://dev.azure.com/ms/ClangSharp/_build/latest?definitionId=155&branchName=main) | [![Build Status](https://dev.azure.com/ms/ClangSharp/_apis/build/status/microsoft.ClangSharp?branchName=main&jobName=windows_release_x64)](https://dev.azure.com/ms/ClangSharp/_build/latest?definitionId=155&branchName=main) |
| Ubuntu 18.04 x64 | [![Build Status](https://dev.azure.com/ms/ClangSharp/_apis/build/status/microsoft.ClangSharp?branchName=main&jobName=ubuntu_debug_x64)](https://dev.azure.com/ms/ClangSharp/_build/latest?definitionId=155&branchName=main) | [![Build Status](https://dev.azure.com/ms/ClangSharp/_apis/build/status/microsoft.ClangSharp?branchName=main&jobName=ubuntu_release_x64)](https://dev.azure.com/ms/ClangSharp/_build/latest?definitionId=155&branchName=main) |
| MacOS x64 | [![Build Status](https://dev.azure.com/ms/ClangSharp/_apis/build/status/microsoft.ClangSharp?branchName=main&jobName=macos_debug_x64)](https://dev.azure.com/ms/ClangSharp/_build/latest?definitionId=155&branchName=main) | [![Build Status](https://dev.azure.com/ms/ClangSharp/_apis/build/status/microsoft.ClangSharp?branchName=main&jobName=macos_release_x64)](https://dev.azure.com/ms/ClangSharp/_build/latest?definitionId=155&branchName=main) |

A nuget package for the project is provided here: https://www.nuget.org/packages/clangsharp.
A .NET tool for the P/Invoke generator project is provided here: https://www.nuget.org/packages/ClangSharpPInvokeGenerator
Expand Down Expand Up @@ -93,7 +93,7 @@ dotnet tool install --global ClangSharpPInvokeGenerator --version 11.0.0-beta2
ClangSharpPInvokeGenerator @generate.rsp
```

A response file allows you to specify and checkin the command line arguments in a text file, with one argument per line. For example: https://github.com/microsoft/ClangSharp/blob/master/sources/ClangSharpPInvokeGenerator/Properties/GenerateClang.rsp
A response file allows you to specify and checkin the command line arguments in a text file, with one argument per line. For example: https://github.com/microsoft/ClangSharp/blob/main/sources/ClangSharpPInvokeGenerator/Properties/GenerateClang.rsp
At a minimum, the command line expects one or more input files (`-f`), an output namespace (`-n`), and an output location (`-o`). A typical response file may also specify explicit files to traverse, configuration options, name remappings, and other fixups.

The full set of available switches:
Expand Down Expand Up @@ -194,7 +194,11 @@ Options:
are commonly encountered for opaque handle like types such as HWND.
exclude-enum-operators Bindings for operators over enum types should not be generated. These are
largely unnecessary in C# as the operators are available by default.
exclude-fnptr-codegen Generated bindings for latest or preview codegen should not use function
pointers.
exclude-funcs-with-body Bindings for functions with bodies should not be generated.
preview-codegen-nint Generated bindings for latest or preview codegen should not use nint or
nuint.
exclude-using-statics-for-enums Enum usages should be fully qualified and should not include a
corresponding 'using static EnumName;'
Expand All @@ -209,24 +213,21 @@ Options:
generate-aggressive-inlining [MethodImpl(MethodImplOptions.AggressiveInlining)] should be added to
generated helper functions.
generate-cpp-attributes A[CppAttributeList("")] should be generated to document the encountered C++
generate-cpp-attributes [CppAttributeList("")] should be generated to document the encountered C++
attributes.
generate-macro-bindings Bindings for macro-definitions should be generated. This currently only
works with value like macros and not function-like ones.
generate-native-inheritance-attribute A[NativeInheritance("")] attribute should be generated to document the
generate-native-inheritance-attribute [NativeInheritance("")] attribute should be generated to document the
encountered C++ base type.
generate-vtbl-index-attribute [VtblIndex(#)] attribute should be generated to document the underlying
VTBL index for a helper method.
log-exclusions Alist of excluded declaration types should be generated. This will also log
if the exclusion was due to an exact or partial match.
log-potential-typedef-remappings Alist of potential typedef remappings should be generated. This can help
identify missing remappings.
log-visited-files Alist of the visited files should be generated. This can help identify
traversal issues.
preview-codegen-fnptr Generated bindings should use function pointers instead of IntPtr where
possible.
preview-codegen-nint Generated bindings should use nint and nuint instead of IntPtr and UIntPtr
where possible.
```

## Spotlight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>libClangSharp.runtime.freebsd.11-x64</id>
<version>11.0.0-beta2</version>
<version>11.0.0-beta3</version>
<authors>Microsoft and Contributors</authors>
<owners>Microsoft and Contributors</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<license type="expression">NCSA</license>
<projectUrl>https://github.com/microsoft/clangsharp</projectUrl>
<description>freebsd 11 x64 native library for libClangSharp.</description>
<copyright>Copyright © Microsoft and Contributors</copyright>
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="master" />
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="main" />
</metadata>
<files>
<file src="..\libClangSharp\LICENSE.TXT" target="LICENSE.TXT" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>libClangSharp.runtime.freebsd.11-x86</id>
<version>11.0.0-beta2</version>
<version>11.0.0-beta3</version>
<authors>Microsoft and Contributors</authors>
<owners>Microsoft and Contributors</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<license type="expression">NCSA</license>
<projectUrl>https://github.com/microsoft/clangsharp</projectUrl>
<description>freebsd 11 x86 native library for libClangSharp.</description>
<copyright>Copyright © Microsoft and Contributors</copyright>
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="master" />
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="main" />
</metadata>
<files>
<file src="..\libClangSharp\LICENSE.TXT" target="LICENSE.TXT" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>libClangSharp.runtime.linux-arm</id>
<version>11.0.0-beta2</version>
<version>11.0.0-beta3</version>
<authors>Microsoft and Contributors</authors>
<owners>Microsoft and Contributors</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<license type="expression">NCSA</license>
<projectUrl>https://github.com/microsoft/clangsharp</projectUrl>
<description>linux arm native library for libClangSharp.</description>
<copyright>Copyright © Microsoft and Contributors</copyright>
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="master" />
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="main" />
</metadata>
<files>
<file src="..\libClangSharp\LICENSE.TXT" target="LICENSE.TXT" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>libClangSharp.runtime.linux-arm64</id>
<version>11.0.0-beta2</version>
<version>11.0.0-beta3</version>
<authors>Microsoft and Contributors</authors>
<owners>Microsoft and Contributors</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<license type="expression">NCSA</license>
<projectUrl>https://github.com/microsoft/clangsharp</projectUrl>
<description>linux arm64 native library for libClangSharp.</description>
<copyright>Copyright © Microsoft and Contributors</copyright>
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="master" />
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="main" />
</metadata>
<files>
<file src="..\libClangSharp\LICENSE.TXT" target="LICENSE.TXT" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>libClangSharp.runtime.osx-x64</id>
<version>11.0.0-beta2</version>
<version>11.0.0-beta3</version>
<authors>Microsoft and Contributors</authors>
<owners>Microsoft and Contributors</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<license type="expression">NCSA</license>
<projectUrl>https://github.com/microsoft/clangsharp</projectUrl>
<description>osx x64 native library for libClangSharp.</description>
<copyright>Copyright © Microsoft and Contributors</copyright>
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="master" />
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="main" />
</metadata>
<files>
<file src="..\libClangSharp\LICENSE.TXT" target="LICENSE.TXT" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>libClangSharp.runtime.ubuntu.18.04-x64</id>
<version>11.0.0-beta2</version>
<version>11.0.0-beta3</version>
<authors>Microsoft and Contributors</authors>
<owners>Microsoft and Contributors</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<license type="expression">NCSA</license>
<projectUrl>https://github.com/microsoft/clangsharp</projectUrl>
<description>ubuntu 18.04 x64 native library for libClangSharp.</description>
<copyright>Copyright © Microsoft and Contributors</copyright>
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="master" />
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="main" />
</metadata>
<files>
<file src="..\libClangSharp\LICENSE.TXT" target="LICENSE.TXT" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>libClangSharp.runtime.ubuntu.20.04-x64</id>
<version>11.0.0-beta2</version>
<version>11.0.0-beta3</version>
<authors>Microsoft and Contributors</authors>
<owners>Microsoft and Contributors</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<license type="expression">NCSA</license>
<projectUrl>https://github.com/microsoft/clangsharp</projectUrl>
<description>ubuntu 20.04 x64 native library for libClangSharp.</description>
<copyright>Copyright © Microsoft and Contributors</copyright>
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="master" />
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="main" />
</metadata>
<files>
<file src="..\libClangSharp\LICENSE.TXT" target="LICENSE.TXT" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>libClangSharp.runtime.win-x64</id>
<version>11.0.0-beta2</version>
<version>11.0.0-beta3</version>
<authors>Microsoft and Contributors</authors>
<owners>Microsoft and Contributors</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<license type="expression">NCSA</license>
<projectUrl>https://github.com/microsoft/clangsharp</projectUrl>
<description>win x64 native library for libClangSharp.</description>
<copyright>Copyright © Microsoft and Contributors</copyright>
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="master" />
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="main" />
</metadata>
<files>
<file src="..\libClangSharp\LICENSE.TXT" target="LICENSE.TXT" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>libClangSharp.runtime.win-x86</id>
<version>11.0.0-beta2</version>
<version>11.0.0-beta3</version>
<authors>Microsoft and Contributors</authors>
<owners>Microsoft and Contributors</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<license type="expression">NCSA</license>
<projectUrl>https://github.com/microsoft/clangsharp</projectUrl>
<description>win x86 native library for libClangSharp.</description>
<copyright>Copyright © Microsoft and Contributors</copyright>
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="master" />
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="main" />
</metadata>
<files>
<file src="..\libClangSharp\LICENSE.TXT" target="LICENSE.TXT" />
Expand Down
4 changes: 2 additions & 2 deletions packages/libClangSharp/libClangSharp/libClangSharp.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>libClangSharp</id>
<version>11.0.0-beta2</version>
<version>11.0.0-beta3</version>
<authors>Microsoft and Contributors</authors>
<owners>Microsoft and Contributors</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<license type="expression">NCSA</license>
<projectUrl>https://github.com/microsoft/clangsharp</projectUrl>
<description>Multi-platform native library for libClangSharp.</description>
<copyright>Copyright © Microsoft and Contributors</copyright>
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="master" />
<repository type="git" url="https://github.com/microsoft/clangsharp" branch="main" />
<dependencies>
<group targetFramework=".NETStandard1.0">
<dependency id="Microsoft.NETCore.Platforms" version="1.0.1" />
Expand Down
18 changes: 9 additions & 9 deletions packages/libClangSharp/libClangSharp/runtime.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,47 @@
"runtimes": {
"freebsd.11-x64": {
"libClangSharp": {
"libClangSharp.runtime.freebsd.11-x64": "11.0.0-beta2"
"libClangSharp.runtime.freebsd.11-x64": "11.0.0-beta3"
}
},
"freebsd.11-x86": {
"libClangSharp": {
"libClangSharp.runtime.freebsd.11-x86": "11.0.0-beta2"
"libClangSharp.runtime.freebsd.11-x86": "11.0.0-beta3"
}
},
"linux-arm": {
"libClangSharp": {
"libClangSharp.runtime.linux-arm": "11.0.0-beta2"
"libClangSharp.runtime.linux-arm": "11.0.0-beta3"
}
},
"linux-arm64": {
"libClangSharp": {
"libClangSharp.runtime.linux-arm64": "11.0.0-beta2"
"libClangSharp.runtime.linux-arm64": "11.0.0-beta3"
}
},
"osx-x64": {
"libClangSharp": {
"libClangSharp.runtime.osx-x64": "11.0.0-beta2"
"libClangSharp.runtime.osx-x64": "11.0.0-beta3"
}
},
"ubuntu.18.04-x64": {
"libClangSharp": {
"libClangSharp.runtime.ubuntu.18.04-x64": "11.0.0-beta2"
"libClangSharp.runtime.ubuntu.18.04-x64": "11.0.0-beta3"
}
},
"ubuntu.20.04-x64": {
"libClangSharp": {
"libClangSharp.runtime.ubuntu.20.04-x64": "11.0.0-beta2"
"libClangSharp.runtime.ubuntu.20.04-x64": "11.0.0-beta3"
}
},
"win-x64": {
"libClangSharp": {
"libClangSharp.runtime.win-x64": "11.0.0-beta2"
"libClangSharp.runtime.win-x64": "11.0.0-beta3"
}
},
"win-x86": {
"libClangSharp": {
"libClangSharp.runtime.win-x86": "11.0.0-beta2"
"libClangSharp.runtime.win-x86": "11.0.0-beta3"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
trigger:
- master
- main

pr:
- master
- main

jobs:
- template: azure-windows.yml
Expand Down
Loading

0 comments on commit 7105c10

Please sign in to comment.