Skip to content

Sync with ClangSharp and regenerate against LLVM 21.1.8 - #251

Merged
tannergooding merged 2 commits into
dotnet:mainfrom
tannergooding:tannergooding-sync-with-clangsharp
Jul 15, 2026
Merged

tannergooding merged 2 commits into
dotnet:mainfrom
tannergooding:tannergooding-sync-with-clangsharp

Conversation

@tannergooding

@tannergooding tannergooding commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

Brings LLVMSharp back in line with its sibling ClangSharp and retargets the bindings to LLVM 21.1.8 (matching the Clang version ClangSharp targets).

Infrastructure sync

Props/targets, CI workflow, scripts, .editorconfig, and README are brought in line with ClangSharp, adjusting for LLVMSharp's agnostic-only packaging (no per-RID runtime packages, no win32metadata regression test):

  • Adopt the PACKAGE_PUBLISH_MODE packaging flow (Directory.Build.props/.targets), enable the AOT/single-file analyzers for .NETCoreApp, and fix the .editorconfig file header to the standard .NET Foundation text.
  • Split the pkg upload into its own CI artifact, modernize the signing job (Azure login + prerelease sign tool), and drop the retired nightly-feed publish jobs / stale badge + feed URL.
  • Bump Microsoft.NET.Test.Sdk (18.0.1) and NUnit3TestAdapter (6.1.0).
  • Add .github/copilot-instructions.md documenting the repo layout (hand-written vs generated), build/test, and the regen workflow + gotchas.

Regenerate bindings to LLVM 21.1.8

Bump the libLLVM pin and VersionPrefix to 21.1.8 and regenerate the raw interop.

  • Refresh the anonymous-enum remaps to the new header line numbers, add the LLVMGEPNoWrapFlags remap/enum, and pull in llvm-c/LLJITUtils.h (the Orc DumpObjects APIs moved there from LLJIT.h).
  • Make GenerateLLVM.rsp self-contained with --file-directory and --libraryPath libLLVM, since -- unlike ClangSharp -- this repo has no generator project / launchSettings.json to supply them (previously the P/Invokes generated with an empty [DllImport("")]).

API surface changes (all genuine upstream LLVM 21 changes):

  • Added: LLVMConstDataArray, LLVMGetRawDataValues, LLVMReplaceArrays, LLVMGet/SetICmpSameSign, several DIBuilder APIs, LLVMOrcCreateNewThreadSafeContextFromLLVMContext, LLVMDISubprogramReplaceType; new enum members (LLVMAtomicRMWBinOpFMaximum/FMinimum, new metadata kinds) and the new LLVMGEPNoWrapFlags enum.
  • Removed: LLVMConstMul/LLVMConstNSWMul/LLVMConstNUWMul (mul is no longer a constant expression upstream -- no replacement) and LLVMOrcThreadSafeContextGetContext, along with the three hand-written const-mul wrappers in Extensions/LLVMValueRef.cs. LLVMLandingPadClauseTy is dropped (removed from the headers).
  • The generated struct-layout tests are removed since generate-disable-runtime-marshalling now suppresses them (ClangSharp is the same -- it ships zero generated interop struct tests).

Notes / callouts

  • LLVMAttributeIndex / LLVMJITSymbolGenericFlags kept as int enums. Generator 21.1.8.3 now preserves the headers' U literal suffixes (0U, 1U << n), which break int enums (CS0266), but the repo's unsuppressed CA1028 requires Int32-underlying enums (so uint isn't viable either). Both enums' members/values are unchanged from 20.1.2, so they're kept in their committed int form with only the version header bumped -- documented as the one expected post-regen manual fixup.
  • Target aggregators restored to the full 20-target list. The clang+llvm-21.1.8-x86_64-pc-windows-msvc release binary used for regen was configured with a reduced LLVM_TARGETS_TO_BUILD, which would have silently dropped 13 backends from the InitializeAll* aggregators (they're static inline in Target.h, expanded over Config/*.def). Restored to the canonical set; documented as a regen gotcha.
  • The libLLVMSharp-helper interop (GenerateLLVMSharp.rsp -> llvmsharp/) was not regenerated -- it needs the built native helper, unavailable in this environment.

Build is clean (0 warnings, TreatWarningsAsErrors on) and all 2587 tests pass.

Note

This PR body was drafted by Copilot.

tannergooding and others added 2 commits July 14, 2026 20:54
Bring the props/targets, CI workflow, scripts, editorconfig, and README in
line with the sibling ClangSharp repo, adjusting for LLVMSharp's agnostic-only
packaging (no per-RID runtime packages, no win32metadata test). Adopt the
PACKAGE_PUBLISH_MODE packaging flow, split the pkg upload into its own CI
artifact, drop the retired nightly-feed publish jobs, and add a
.github/copilot-instructions.md documenting the repo layout and regen workflow.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Bump the libLLVM pin and VersionPrefix to 21.1.8 and regenerate the raw
interop. Refresh the anonymous-enum remaps to the new header line numbers, add
the LLVMGEPNoWrapFlags remap/enum, and pull in llvm-c/LLJITUtils.h (the Orc
DumpObjects APIs moved there from LLJIT.h). Make GenerateLLVM.rsp self-contained
with --file-directory and --libraryPath libLLVM since the repo has no generator
project/launchSettings to supply them.

Adds the new LLVM 21 APIs (LLVMConstDataArray, LLVMGetRawDataValues,
LLVMReplaceArrays, LLVMGet/SetICmpSameSign, several DIBuilder APIs,
LLVMOrcCreateNewThreadSafeContextFromLLVMContext), drops LLVMConstMul/NSWMul/NUWMul
and LLVMOrcThreadSafeContextGetContext (removed upstream) along with their
hand-written wrappers, and removes LLVMLandingPadClauseTy. The generated struct
layout tests are gone since generate-disable-runtime-marshalling now suppresses
them, matching ClangSharp.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@tannergooding
tannergooding merged commit 260c4df into dotnet:main Jul 15, 2026
12 checks passed
@tannergooding
tannergooding deleted the tannergooding-sync-with-clangsharp branch July 15, 2026 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant