diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index cbc734c..86727d1 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -27,7 +27,7 @@ jobs: run: go test -v -tags=llvm${{ matrix.llvm }} - name: Test default LLVM - if: matrix.llvm == 19 + if: matrix.llvm == 21 run: go test -v test-linux: @@ -52,7 +52,7 @@ jobs: run: go test -v -tags=llvm${{ matrix.llvm }} - name: Test default LLVM - if: matrix.llvm == 19 + if: matrix.llvm == 21 run: go test -v test-windows: @@ -169,7 +169,7 @@ jobs: gcc --version go test -v -tags=llvm${{ matrix.llvm }} - name: Test default LLVM - if: matrix.llvm == 19 + if: matrix.llvm == 21 shell: msys2 {0} run: | set -euo pipefail @@ -202,6 +202,6 @@ jobs: run: go test -v -tags=llvm${{ matrix.llvm }} - name: Test default LLVM - if: matrix.llvm == 19 + if: matrix.llvm == 21 run: go test -v diff --git a/README.markdown b/README.markdown index 3884324..3abfe6e 100644 --- a/README.markdown +++ b/README.markdown @@ -16,8 +16,8 @@ Currently supported: * LLVM 22, 21, 20, 19, 18, 17, 16, 15 and 14 in an MSYS2 MINGW64 environment on Windows (see the setup below). * Any of the above versions with a manually built LLVM through the `byollvm` build tag. You need to set up `CFLAGS`/`LDFLAGS` etc yourself in this case. -You can select the LLVM version using a build tag, for example `-tags=llvm17` -to use LLVM 17. +LLVM 21 is selected by default. You can select another LLVM version using a +build tag, for example `-tags=llvm19` to use LLVM 19. ## Usage @@ -30,7 +30,7 @@ You can use build tags to select a LLVM version. For example, use `-tags=llvm15` ### Windows (MSYS2 MINGW64) The Windows bindings expect `pkg-config` metadata named after the selected LLVM -major version, such as `llvm-19`. After installing a MinGW-compatible LLVM, +major version, such as `llvm-21`. After installing a MinGW-compatible LLVM, `mingw-w64-x86_64-gcc`, and `mingw-w64-x86_64-pkgconf` in a MINGW64 environment, generate that file from `llvm-config`: diff --git a/ir.go b/ir.go index 6cc60e5..4db5b1b 100644 --- a/ir.go +++ b/ir.go @@ -678,6 +678,7 @@ func (t Type) StructSetBody(elementTypes []Type, packed bool) { } func (t Type) IsStructPacked() bool { return C.LLVMIsPackedStruct(t.C) != 0 } +func (t Type) IsStructOpaque() bool { return C.LLVMIsOpaqueStruct(t.C) != 0 } func (t Type) StructElementTypesCount() int { return int(C.LLVMCountStructElementTypes(t.C)) } func (t Type) StructElementTypes() []Type { out := make([]Type, t.StructElementTypesCount()) diff --git a/ir_test.go b/ir_test.go index 0a9d5e8..b28f737 100644 --- a/ir_test.go +++ b/ir_test.go @@ -18,6 +18,21 @@ import ( "testing" ) +func TestStructIsOpaque(t *testing.T) { + ctx := NewContext() + defer ctx.Dispose() + + typ := ctx.StructCreateNamed("T") + if !typ.IsStructOpaque() { + t.Fatal("new named struct is not opaque") + } + + typ.StructSetBody(nil, false) + if typ.IsStructOpaque() { + t.Fatal("defined empty named struct is opaque") + } +} + func testAttribute(t *testing.T, name string) { ctx := NewContext() mod := ctx.NewModule("") diff --git a/llvm_config_llvm19.go b/llvm_config_llvm19.go index 83a0f1a..29692bd 100644 --- a/llvm_config_llvm19.go +++ b/llvm_config_llvm19.go @@ -1,5 +1,5 @@ -//go:build !byollvm && !llvm14 && !llvm15 && !llvm16 && !llvm17 && !llvm18 && !llvm20 && !llvm21 && !llvm22 -// +build !byollvm,!llvm14,!llvm15,!llvm16,!llvm17,!llvm18,!llvm20,!llvm21,!llvm22 +//go:build !byollvm && llvm19 +// +build !byollvm,llvm19 package llvm diff --git a/llvm_config_llvm21.go b/llvm_config_llvm21.go index bff0dba..602f460 100644 --- a/llvm_config_llvm21.go +++ b/llvm_config_llvm21.go @@ -1,4 +1,5 @@ -//go:build !byollvm && llvm21 +//go:build !byollvm && !llvm14 && !llvm15 && !llvm16 && !llvm17 && !llvm18 && !llvm19 && !llvm20 && !llvm22 +// +build !byollvm,!llvm14,!llvm15,!llvm16,!llvm17,!llvm18,!llvm19,!llvm20,!llvm22 package llvm