Attribute Macro inkwell_internals::llvm_enum[][src]


This attribute macro allows you to decorate an enum declaration which represents an LLVM enum with versioning constraints and/or custom variant names. There are a few expectations around the LLVM and Rust enums:

  • Both enums have the same number of variants
  • The name of the LLVM variant can be derived by appending 'LLVM' to the Rust variant

The latter can be worked around manually with #[llvm_variant] if desired.


enum InstructionOpcode {

The use of #[llvm_variant(NAME)] allows you to override the default naming scheme by providing the variant name which the source enum maps to. In the above example, Ret was deemed unnecessarily concise, so the source variant is named Return and mapped manually to LLVMRet.