Skip to content

Commit 6764df1

Browse files
committed
Upgraded to Clang 14.0.4.
* ClangSharp has joined the .NET Foundation since we last updated. In the process its license and copyright notice changed. * ClangSharp no longer supports .NET 5, as such we no longer support .NET 5. (See MochiLibraries/Biohazrd#241 (comment)) * Fixed minor race condition in LibClangSharpResolver found while testing these changes.
1 parent 328cede commit 6764df1

File tree

9 files changed

+86
-30
lines changed

9 files changed

+86
-30
lines changed

.github/workflows/ClangSharp.Pathogen.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ jobs:
147147
- name: Setup .NET
148148
uses: actions/setup-dotnet@v1
149149
with:
150-
dotnet-version: 5.0.x
150+
dotnet-version: 6.0.x
151151

152152
- name: Configure versioning
153153
run: python .github/workflows/configure-build.py
@@ -235,7 +235,7 @@ jobs:
235235
- name: Setup .NET
236236
uses: actions/setup-dotnet@v1
237237
with:
238-
dotnet-version: 5.0.x
238+
dotnet-version: 6.0.x
239239

240240
# ----------------------------------------------------------------------- Configure Versioning
241241
- name: Configure build
@@ -373,7 +373,7 @@ jobs:
373373
- name: Setup .NET
374374
uses: actions/setup-dotnet@v1
375375
with:
376-
dotnet-version: 5.0.x
376+
dotnet-version: 6.0.x
377377

378378
# ----------------------------------------------------------------------- Download built packages
379379
- name: Download built packages
@@ -418,7 +418,7 @@ jobs:
418418
419419
# ----------------------------------------------------------------------- Push to GitHub Packages
420420
- name: Push to GitHub Packages
421-
run: dotnet nuget push "*.nupkg" --skip-duplicate --no-symbols true --api-key ${{secrets.GITHUB_TOKEN}} --source https://nuget.pkg.github.com/${{github.repository_owner}}
421+
run: dotnet nuget push "*.nupkg" --skip-duplicate --no-symbols --api-key ${{secrets.GITHUB_TOKEN}} --source https://nuget.pkg.github.com/${{github.repository_owner}}
422422
env:
423423
# This is a workaround for https://github.com/NuGet/Home/issues/9775
424424
DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER: 0
@@ -439,7 +439,7 @@ jobs:
439439
- name: Setup .NET
440440
uses: actions/setup-dotnet@v1
441441
with:
442-
dotnet-version: 5.0.x
442+
dotnet-version: 6.0.x
443443

444444
# ----------------------------------------------------------------------- Download built packages
445445
- name: Download built packages

ClangSharp.Pathogen.Native/ClangSharp.Pathogen.Native.csproj

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,21 @@
2020
Package Info
2121
=============================================================================================================== -->
2222
<PackageId>$(MSBuildProjectName).$(RuntimeIdentifier)</PackageId>
23-
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
23+
<PackageLicenseFile>LICENSE-COMBINED.md</PackageLicenseFile>
2424
<Description>Native runtime support package for ClangSharp.Pathogen on $(RuntimeIdentifier).&#10;&#10;This package exists primarily to support Biohazrd and should only be used as instructed.</Description>
2525
<!-- Microsoft is here because we embed components of libClangSharp -->
26-
<Authors>LLVM Team, Microsoft, David Maas, and Contributors</Authors>
26+
<Authors>LLVM Team, .NET Foundation, David Maas, and Contributors</Authors>
2727
<!-- LLVM does not have a good canonical copyright string. They're supposed to put it in their source file as part of Apache 2.0 but they don't. -->
28-
<Copyright>Pathogen extensions copyright David Maas and Contributors. libClangSharp copyright © Microsoft and Contributors. LLVM copyright (c) 2003-2019 University of Illinois at Urbana-Champaign, LLVM Team.</Copyright>
28+
<Copyright>Pathogen extensions copyright David Maas and Contributors. libClangSharp copyright © .NET Foundation and Contributors. LLVM copyright (c) 2003-2019 University of Illinois at Urbana-Champaign, LLVM Team.</Copyright>
2929

3030
<!-- This package is only for native runtime, don't try to build/pack the .NET assembly or specify a framework dependency -->
3131
<IncludeBuildOutput>false</IncludeBuildOutput>
3232
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
3333
</PropertyGroup>
3434
<ItemGroup>
3535
<None Condition="Exists('$(PathogenExtensionsCppPath)')" Include="$(PathogenExtensionsCppPath)" Link="PathogenExtensions.cpp" />
36-
<None Condition="Exists('$(ClangLicensePath)')" Include="$(ClangLicensePath)" Link="LICENSE.txt" Pack="true" PackagePath="LICENSE.txt" />
36+
<None Condition="Exists('$(ClangLicensePath)')" Include="$(ClangLicensePath)" Link="LICENSE-LLVM.txt" Pack="true" PackagePath="LICENSE-LLVM.txt" />
37+
<None Condition="Exists('$(LibClangSharpLicensePath)')" Include="$(LibClangSharpLicensePath)" Link="LICENSE-LIBCLANGSHARP.md" Pack="true" PackagePath="LICENSE-LIBCLANGSHARP.md" />
3738
<None Include="$(LibClangPath)" Link="$(LibClangPathogenFileName)" Condition="Exists('$(LibClangPath)')">
3839
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3940
<Pack>true</Pack>
@@ -45,8 +46,51 @@
4546
<!-- PathogenExtensions.cpp is only used to check if LLVM is cloned and it's our fork. Don't check for it on CI where we might not actually clone LLVM. -->
4647
<Error Text="PathogenExtensions.cpp is missing, ensure Git submodules are up-to-date." Condition="!Exists('$(PathogenExtensionsCppPath)') and '$(ContinuousIntegrationBuild)' != 'true'" />
4748
<Error Text="Clang LICENSE.TXT is missing, ensure Git submodules are up-to-date." Condition="!Exists('$(ClangLicensePath)')" />
49+
<Error Text="libClangSharp LICENSE.md is missing, ensure Git submodules are up-to-date." Condition="!Exists('$(LibClangSharpLicensePath)')" />
4850
<Error Text="Could not automatically determine LibClangSubPath based on runtime identifier '$(RuntimeIdentifier)'" Condition="'$(LibClangSubPath)' == ''" />
4951
<Error Text="Could not automatically determine LibClangPathogenFileName based on runtime identifier '$(RuntimeIdentifier)'" Condition="'$(LibClangPathogenFileName)' == ''" />
5052
<Error Text="Could not locate native runtime for '$(RuntimeIdentifier)' at '$(LibClangPath)', did you run build-native.cmd/sh?" Condition="!Exists('$(LibClangPath)')" />
5153
</Target>
54+
<UsingTask TaskName="_GenerateCombinedLicenseFileTask" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
55+
<ParameterGroup>
56+
<PackageId ParameterType="System.String" Required="true" />
57+
<Path ParameterType="System.String" Required="true" />
58+
<ClangLicensePath ParameterType="System.String" Required="true" />
59+
<LibClangSharpLicensePath ParameterType="System.String" Required="true" />
60+
</ParameterGroup>
61+
<Task>
62+
<Using Namespace="System.IO" />
63+
<Using Namespace="System.Linq" />
64+
<Code Type="Fragment" Language="cs">
65+
<![CDATA[
66+
string[] clangLicense = File.ReadAllLines(ClangLicensePath);
67+
string[] libClangSharpLicense = File.ReadAllLines(LibClangSharpLicensePath);
68+
69+
using StreamWriter f = new(Path);
70+
f.WriteLine($"{PackageId} incorporates multiple components licensed as follows.");
71+
f.WriteLine();
72+
f.WriteLine("# The LLVM Project");
73+
f.WriteLine();
74+
f.WriteLine("```");
75+
foreach (string line in clangLicense)
76+
{ f.WriteLine(line); }
77+
f.WriteLine("```");
78+
f.WriteLine();
79+
f.WriteLine("# libClangSharp");
80+
f.WriteLine();
81+
foreach (string line in libClangSharpLicense)
82+
{ f.WriteLine($"> {line}"); }
83+
]]>
84+
</Code>
85+
</Task>
86+
</UsingTask>
87+
<Target Name="_GenerateCombinedLicenseFile" DependsOnTargets="_NativeRuntimeChecks" BeforeTargets="GetCopyToOutputDirectoryItems;Build;GenerateNuspec;Pack;_GetPackageFiles">
88+
<PropertyGroup>
89+
<_CombinedLicenseFile>$(IntermediateOutputPath)LICENSE-COMBINED.md</_CombinedLicenseFile>
90+
</PropertyGroup>
91+
<_GenerateCombinedLicenseFileTask PackageId="$(PackageId)" Path="$(_CombinedLicenseFile)" ClangLicensePath="$(ClangLicensePath)" LibClangSharpLicensePath="$(LibClangSharpLicensePath)" />
92+
<ItemGroup>
93+
<None Include="$(_CombinedLicenseFile)" Visible="false" Pack="true" PackagePath="LICENSE-COMBINED.md" />
94+
</ItemGroup>
95+
</Target>
5296
</Project>

ClangSharp.Pathogen/ClangSharp.Pathogen.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net5.0</TargetFramework>
3+
<TargetFramework>net6.0</TargetFramework>
44

55
<!-- Package Info -->
66
<PackageLicenseExpression>MIT</PackageLicenseExpression>
@@ -10,8 +10,8 @@
1010
<IncludeSymbols>true</IncludeSymbols>
1111
</PropertyGroup>
1212
<ItemGroup>
13-
<!-- This is pinned to a specific version since ClangSharp.Pathogen.Runtime includes libClangSharp -->
14-
<PackageReference Include="ClangSharp" Version="[12.0.0-beta2]" />
13+
<!-- This is pinned to a specific version since ClangSharp.Pathogen.Native includes libClangSharp -->
14+
<PackageReference Include="ClangSharp" Version="[14.0.0-beta2]" />
1515
</ItemGroup>
1616
<ItemGroup>
1717
<None Include="..\LICENSE.txt" Pack="true" PackagePath="" Visible="false" />

ClangSharp.Pathogen/LibClangSharpResolver.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public static void OverrideNativeRuntime(IntPtr nativeRuntimeHandle)
6262
if (NativeRuntimeHandle == nativeRuntimeHandle)
6363
{ return; }
6464

65-
if (Interlocked.CompareExchange(ref NativeRuntimeHandle, nativeRuntimeHandle, IntPtr.Zero) != IntPtr.Zero)
65+
IntPtr oldHandle = Interlocked.CompareExchange(ref NativeRuntimeHandle, nativeRuntimeHandle, IntPtr.Zero);
66+
if (oldHandle != IntPtr.Zero && oldHandle != nativeRuntimeHandle)
6667
{ throw new InvalidOperationException("The native libclang-pathogen runtime has already previously been loaded or overridden."); }
6768
}
6869

ClangSharp.Pathogen/PathogenClangCallingConventionKind.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public enum PathogenClangCallingConventionKind : byte
1717
SpirFunction,
1818
OpenCLKernel,
1919
Swift,
20+
SwiftAsync,
2021
PreserveMost,
2122
PreserveAll,
2223
AArch64VectorCall,

ClangSharp.Pathogen/PathogenLlvmCallingConventionKind.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public enum PathogenLlvmCallingConventionKind : byte
1515
CXX_FAST_TLS = 17,
1616
Tail = 18,
1717
CFGuard_Check = 19,
18+
SwiftTail = 20,
1819
FirstTargetCC = 64,
1920
X86_StdCall = 64,
2021
X86_FastCall = 65,
@@ -49,6 +50,8 @@ public enum PathogenLlvmCallingConventionKind : byte
4950
AMDGPU_ES = 96,
5051
AArch64_VectorCall = 97,
5152
AArch64_SVE_VectorCall = 98,
52-
WASM_EmscriptenInvoke = 99
53+
WASM_EmscriptenInvoke = 99,
54+
AMDGPU_Gfx = 100,
55+
M68k_INTR = 101,
5356
}
5457
}

THIRD-PARTY-NOTICES.md

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,26 @@ ClangSharp.Pathogen incorporates third-party libraries licensed as follows.
99

1010
# ClangSharp
1111

12-
```
13-
University of Illinois/NCSA Open Source License
14-
Copyright (c) Microsoft and Contributors
15-
All rights reserved.
16-
17-
Developed by: Microsoft and Contributors
18-
19-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
20-
21-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers.
22-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimers in the documentation and/or other materials provided with the distribution.
23-
Neither the names of Microsoft, nor the names of its contributors may be used to endorse or promote products derived from this Software without specific prior written permission.
24-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
25-
```
12+
> # The MIT License (MIT)
13+
>
14+
> Copyright © .NET Foundation and Contributors. All Rights Reserved.
15+
>
16+
> Permission is hereby granted, free of charge, to any person obtaining a copy of
17+
> this software and associated documentation files (the "Software"), to deal in
18+
> the Software without restriction, including without limitation the rights to
19+
> use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
20+
> the Software, and to permit persons to whom the Software is furnished to do so,
21+
> subject to the following conditions:
22+
>
23+
> The above copyright notice and this permission notice shall be included in all
24+
> copies or substantial portions of the Software.
25+
>
26+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
28+
> FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
29+
> COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
30+
> IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31+
> CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2632
2733
# The LLVM Project
2834

external/llvm-project

tooling/Common.csproj.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323

2424
<!-- ClangSharp.Pathogen-specific -->
2525
<LlvmBuildOutputRoot>$(MSBuildThisFileDirectory)../bin/llvm/</LlvmBuildOutputRoot>
26-
<LlvmVersion>12.0.1</LlvmVersion>
26+
<LlvmVersion>14.0.4</LlvmVersion>
2727
<LlvmSourceRoot>$(MSBuildThisFileDirectory)../external/llvm-project/</LlvmSourceRoot>
2828
<ClangLicensePath>$(LlvmSourceRoot)clang/LICENSE.TXT</ClangLicensePath>
29+
<LibClangSharpLicensePath>$(LlvmSourceRoot)clang/tools/libclang/libClangSharp/LICENSE.md</LibClangSharpLicensePath>
2930
</PropertyGroup>
3031
<ItemGroup>
3132
<!-- Enable Source Link -->

0 commit comments

Comments
 (0)