tinygo-org/go-llvm

Support LLVMCreateTypeAttribute

ryan-berger opened this issue · 3 comments

Hello, and thank you for your project! I wrote a compiler in Go for a compiler course, and this project has made converting the compiler over to an LLVM backend super easy.

As I was working on calling some external C code that uses structs, I was trying to use the byval attribute, and noticed that Verify was crashing with a null pointer exception. As of r362128, byval can optionally accept a type, and LLVMCreateEnumAttribute returns the attribute with a null type causing a null pointer access when Verify is checking the module.

The solution here is to use LLVMCreateTypeAttribute which allows you to pass in the attribute kind and type.

I'll try to get a PR for this, but if you feel free if you beat me to it.

Fixed in #40

I wrote a compiler in Go for a compiler course, and this project has made converting the compiler over to an LLVM backend super easy.

Cool! I'm glad it's been useful.

Closing, this has been implemented.