Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<PackageValidationBaselineVersion>17.0.0</PackageValidationBaselineVersion>
<Product>ClangSharp</Product>
<RootNamespace>ClangSharp</RootNamespace>
<VersionPrefix>21.1.8</VersionPrefix>
<VersionPrefix>21.1.8.2</VersionPrefix>
<VersionSuffix Condition="'$(PACKAGE_PUBLISH_MODE)' != 'stable'">rc1</VersionSuffix>
<VersionSuffix Condition="'$(GITHUB_EVENT_NAME)' == 'pull_request'">pr</VersionSuffix>
</PropertyGroup>
Expand Down
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
<!-- Package versions for package references across all projects -->
<ItemGroup>
<PackageVersion Include="libClang" Version="21.1.8" />
<PackageVersion Include="libClangSharp" Version="21.1.8.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageVersion Include="libClangSharp" Version="21.1.8.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="NUnit" Version="4.4.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="5.1.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="6.1.0" />
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta3.22114.1" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>libClangSharp.runtime.linux-arm64</id>
<version>21.1.8.1</version>
<version>21.1.8.2</version>
<authors>.NET Foundation and Contributors</authors>
<owners>.NET Foundation and Contributors</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>libClangSharp.runtime.linux-x64</id>
<version>21.1.8.1</version>
<version>21.1.8.2</version>
<authors>.NET Foundation and Contributors</authors>
<owners>.NET Foundation and Contributors</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>libClangSharp.runtime.osx-arm64</id>
<version>21.1.8.1</version>
<version>21.1.8.2</version>
<authors>.NET Foundation and Contributors</authors>
<owners>.NET Foundation and Contributors</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>libClangSharp.runtime.win-arm64</id>
<version>21.1.8.1</version>
<version>21.1.8.2</version>
<authors>.NET Foundation and Contributors</authors>
<owners>.NET Foundation and Contributors</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>libClangSharp.runtime.win-x64</id>
<version>21.1.8.1</version>
<version>21.1.8.2</version>
<authors>.NET Foundation and Contributors</authors>
<owners>.NET Foundation and Contributors</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
Expand Down
2 changes: 1 addition & 1 deletion packages/libClangSharp/libClangSharp/libClangSharp.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>libClangSharp</id>
<version>21.1.8.1</version>
<version>21.1.8.2</version>
<authors>.NET Foundation and Contributors</authors>
<owners>.NET Foundation and Contributors</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
Expand Down
10 changes: 5 additions & 5 deletions packages/libClangSharp/libClangSharp/runtime.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
"runtimes": {
"linux-arm64": {
"libClangSharp": {
"libClangSharp.runtime.linux-arm64": "21.1.8.1"
"libClangSharp.runtime.linux-arm64": "21.1.8.2"
}
},
"linux-x64": {
"libClangSharp": {
"libClangSharp.runtime.linux-x64": "21.1.8.1"
"libClangSharp.runtime.linux-x64": "21.1.8.2"
}
},
"osx-arm64": {
"libClangSharp": {
"libClangSharp.runtime.osx-arm64": "21.1.8.1"
"libClangSharp.runtime.osx-arm64": "21.1.8.2"
}
},
"win-arm64": {
"libClangSharp": {
"libClangSharp.runtime.win-arm64": "21.1.8.1"
"libClangSharp.runtime.win-arm64": "21.1.8.2"
}
},
"win-x64": {
"libClangSharp": {
"libClangSharp.runtime.win-x64": "21.1.8.1"
"libClangSharp.runtime.win-x64": "21.1.8.2"
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions tests/ClangSharp.UnitTests/CXCursor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ public void AttrKindSpelling()
[Test]
public void IsExternC()
{
AssertNeedNewClangSharp();

var inputContents =
$$"""
extern "C" {
Expand Down
32 changes: 18 additions & 14 deletions tests/ClangSharp.UnitTests/CursorTests/DeclTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using ClangSharp.Interop;
using NUnit.Framework;
using static ClangSharp.Interop.CX_CXXAccessSpecifier;
using static ClangSharp.Interop.CX_StmtClass;

namespace ClangSharp.UnitTests;

Expand Down Expand Up @@ -100,8 +101,6 @@ class tuple;
[Test]
public void IsPodTest()
{
AssertNeedNewClangSharp();

var inputContents = $$"""
struct A {
int a;
Expand Down Expand Up @@ -130,8 +129,6 @@ struct B {
[Test]
public void QualifiedNameTest()
{
AssertNeedNewClangSharp();

var inputContents = """
class C {
void M();
Expand Down Expand Up @@ -162,8 +159,6 @@ struct S {
[Test]
public void UnsignedValue()
{
ObjectiveCTest.AssertNeedNewClangSharp();

var inputContents = $$"""
enum E {
A = 1,
Expand Down Expand Up @@ -191,16 +186,25 @@ enum E {
Assert.That(initExpr, Is.Not.Null, $"enum E::{fieldName} InitExpr is null");

var isNegativeExpression = false;
var castExpr = (ImplicitCastExpr)initExpr!;
var subExpr = castExpr.SubExpr;
if (subExpr is UnaryOperator unaryOperator)

if (initExpr is not IntegerLiteral literalExpr)
{
Assert.That(unaryOperator.Opcode, Is.EqualTo(CXUnaryOperatorKind.CXUnaryOperator_Minus), $"enum E::{fieldName} InitExpr is not a minus UnaryOperator");
subExpr = unaryOperator.SubExpr;
isNegativeExpression = true;
if (initExpr is not { StmtClass: CX_StmtClass_UnaryOperator } subExpr)
{
var castExpr = (ImplicitCastExpr)initExpr!;
subExpr = castExpr.SubExpr;
}

if (subExpr is UnaryOperator unaryOperator)
{
Assert.That(unaryOperator.Opcode, Is.EqualTo(CXUnaryOperatorKind.CXUnaryOperator_Minus), $"enum E::{fieldName} InitExpr is not a minus UnaryOperator");
subExpr = unaryOperator.SubExpr;
isNegativeExpression = true;
}

literalExpr = (IntegerLiteral)subExpr;
}
var literalExpr = subExpr as IntegerLiteral;
Assert.That(literalExpr, Is.Not.Null, $"enum E::{fieldName} InitExpr is not IntegerLiteral {castExpr.SubExpr!.GetType().Name}");
Assert.That(literalExpr, Is.Not.Null, $"enum E::{fieldName} InitExpr is not IntegerLiteral {initExpr?.GetType().Name}");
Assert.That(literalExpr!.Value, Is.EqualTo(expectedValue), $"enum E::{fieldName} value mismatch");
Assert.That(literalExpr!.UnsignedValue, Is.EqualTo(expectedUnsignedValue), $"enum E::{fieldName} unsigned value mismatch");
Assert.That(negative, Is.EqualTo(isNegativeExpression), $"enum E::{fieldName} negative mismatch");
Expand Down
26 changes: 0 additions & 26 deletions tests/ClangSharp.UnitTests/ObjectiveCTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ public sealed class ObjectiveCTest : TranslationUnitTest
[Test]
public void Attribute_ObjCRuntimeName()
{
AssertNeedNewClangSharp();

var inputContents = $$"""
__attribute__((objc_runtime_name("MyRenamedClass")))
@interface MyClass
Expand Down Expand Up @@ -50,8 +48,6 @@ @protocol MyProtocol
[Test]
public void Type_IsObjCInstanceType()
{
AssertNeedNewClangSharp();

var inputContents = $@"
@interface MyClass
-(instancetype) instanceMethod;
Expand All @@ -78,8 +74,6 @@ @interface MyClass
[Test]
public void Method_Selector()
{
AssertNeedNewClangSharp();

var inputContents = $@"
@interface MyClass
@property int P1;
Expand Down Expand Up @@ -115,8 +109,6 @@ @interface MyClass
[Test]
public void Method_Family()
{
AssertNeedNewClangSharp();

var inputContents = $@"
@interface NSObject
-(void) none;
Expand Down Expand Up @@ -260,8 +252,6 @@ @interface MyClass
[Test]
public void Category_TypeParamList()
{
AssertNeedNewClangSharp();

var inputContents = $@"
@interface MyClass
@end
Expand All @@ -281,8 +271,6 @@ @interface MyClass (MyCategory)
[Test]
public void ClassWithProtocols()
{
AssertNeedNewClangSharp();

var inputContents = $@"
@protocol P1
@end
Expand All @@ -308,8 +296,6 @@ @protocol P2
[Test]
public void Method_IsPropertyAccessor()
{
AssertNeedNewClangSharp();

var inputContents = $@"
@interface MyClass
@property int P1;
Expand Down Expand Up @@ -345,8 +331,6 @@ @interface MyClass
[Test]
public void TypeParams()
{
AssertNeedNewClangSharp();

var inputContents = $$"""
@interface NSObject
@end
Expand Down Expand Up @@ -421,8 +405,6 @@ @interface MyClass<T, Y> (MyCategory)
[Test]
public void PointerTypes()
{
AssertNeedNewClangSharp();

var inputContents = """
@interface MyClass
-(void)instanceMethod:(MyClass **)ptrToPtrToMyClass;
Expand Down Expand Up @@ -452,8 +434,6 @@ @interface MyClass
[Test]
public void BlockTypes()
{
AssertNeedNewClangSharp();

var inputContents = $$"""
@interface MyClass
-(MyClass *(^)(id))instanceMethod1;
Expand Down Expand Up @@ -495,8 +475,6 @@ @interface MyClass
[Test]
public void Attribute_AvailabilityAttributes()
{
AssertNeedNewClangSharp();

var inputContents = $$"""
__attribute__((availability(ios,unavailable,message="Use another class")))
__attribute__((availability(tvos,introduced=10.0)))
Expand Down Expand Up @@ -615,8 +593,6 @@ @property int P1
[Test]
public void Attribute_PrettyPrint()
{
AssertNeedNewClangSharp();

var inputContents = $@"
__attribute__((availability(ios,introduced=10.0)))
@interface MyClass
Expand Down Expand Up @@ -664,8 +640,6 @@ @interface MyClass
[Test]
public void Property_PropertyAttributes()
{
AssertNeedNewClangSharp();

var inputContents = $$"""
@class NSObject;

Expand Down
11 changes: 0 additions & 11 deletions tests/ClangSharp.UnitTests/TranslationUnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,4 @@ public abstract class TranslationUnitTest

return TranslationUnit.GetOrCreate(translationUnit);
}

protected static void AssertNeedNewClangSharp()
{
var forceRun = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("FORCE_RUN"));

if (forceRun)
{
return;
}
Assert.Ignore("TODO: this needs a new version of libClangSharp published.");
}
}