diff --git a/.github/workflows/llvm.yml b/.github/workflows/llvm.yml index 4d8929492a82..6857f23cbbf4 100644 --- a/.github/workflows/llvm.yml +++ b/.github/workflows/llvm.yml @@ -41,17 +41,22 @@ jobs: - {llvm_version: 18, runs-on: ubuntu-24.04, codename: noble} - {llvm_version: 19, runs-on: ubuntu-24.04, codename: noble} - {llvm_version: 20, runs-on: ubuntu-24.04, codename: noble} - name: "LLVM ${{ matrix.llvm_version }}" + - {runs-on: ubuntu-24.04, codename: noble} + name: "LLVM ${{ matrix.llvm_version || 'Nightly' }}" steps: - name: Checkout Crystal source uses: actions/checkout@v4 - - name: Install LLVM ${{ matrix.llvm_version }} + - name: Install LLVM ${{ matrix.llvm_version || 'Nightly' }} run: | sudo apt remove 'llvm-*' 'libllvm*' wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc - sudo apt-add-repository -y deb http://apt.llvm.org/${{ matrix.codename }}/ llvm-toolchain-${{ matrix.codename }}-${{ matrix.llvm_version }} main - sudo apt install -y llvm-${{ matrix.llvm_version }}-dev lld + sudo apt-add-repository -y \ + deb \ + http://apt.llvm.org/${{ matrix.codename }}/ \ + llvm-toolchain-${{ matrix.codename }}${{ matrix.llvm_version && format('-{0}', matrix.llvm_version) || '' }} \ + main + sudo apt install -y llvm${{ matrix.llvm_version && format('-{0}', matrix.llvm_version) || '' }}-dev lld - name: Install Crystal uses: crystal-lang/install-crystal@v1 diff --git a/src/compiler/crystal/codegen/codegen.cr b/src/compiler/crystal/codegen/codegen.cr index 07153e3a7789..c6b4b3d7bca7 100644 --- a/src/compiler/crystal/codegen/codegen.cr +++ b/src/compiler/crystal/codegen/codegen.cr @@ -2544,7 +2544,7 @@ module Crystal name = "'#{name}'" key = StringKey.new(@llvm_mod, str) @strings[key] ||= begin - global = @llvm_mod.globals.add(@llvm_typer.llvm_string_type(str.bytesize), name) + global = @llvm_mod.globals.add(@llvm_typer.llvm_string_type(str.bytesize), name.gsub('\\', "\\\\")) global.linkage = LLVM::Linkage::Private global.global_constant = true global.initializer = llvm_context.const_struct [ diff --git a/src/llvm/enums.cr b/src/llvm/enums.cr index c944e360574d..8203df32da8a 100644 --- a/src/llvm/enums.cr +++ b/src/llvm/enums.cr @@ -57,6 +57,7 @@ module LLVM WillReturn WriteOnly ZExt + Captures # NOTE: enum body does not allow `class_getter` or `TypeDeclaration`, hence # the nil cast @@ -91,6 +92,7 @@ module LLVM kinds[ArgMemOnly] = kind_for_name("argmemonly") kinds[Builtin] = kind_for_name("builtin") kinds[ByVal] = kind_for_name("byval") + kinds[Captures] = kind_for_name("captures") kinds[Cold] = kind_for_name("cold") kinds[Convergent] = kind_for_name("convergent") kinds[Dereferenceable] = kind_for_name("dereferenceable") diff --git a/src/llvm/ext/llvm-versions.txt b/src/llvm/ext/llvm-versions.txt index a5d4cfac2515..7e0184868f7b 100644 --- a/src/llvm/ext/llvm-versions.txt +++ b/src/llvm/ext/llvm-versions.txt @@ -1 +1 @@ -20.1 19.1 18.1 17.0 16.0 15.0 14.0 13.0 12.0 11.1 11.0 10.0 9.0 8.0 +21.0 20.1 19.1 18.1 17.0 16.0 15.0 14.0 13.0 12.0 11.1 11.0 10.0 9.0 8.0 diff --git a/src/llvm/lib_llvm.cr b/src/llvm/lib_llvm.cr index 7369026e12a5..db82fae25b72 100644 --- a/src/llvm/lib_llvm.cr +++ b/src/llvm/lib_llvm.cr @@ -73,6 +73,7 @@ IS_LT_180 = {{compare_versions(LibLLVM::VERSION, "18.0.0") < 0}} IS_LT_190 = {{compare_versions(LibLLVM::VERSION, "19.0.0") < 0}} IS_LT_200 = {{compare_versions(LibLLVM::VERSION, "20.0.0") < 0}} + IS_LT_210 = {{compare_versions(LibLLVM::VERSION, "21.0.0") < 0}} end {% end %}