[][src]Attribute Macro inkwell_internal_macros::llvm_enum

#[llvm_enum]

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:

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

Examples

This example is not tested
#[llvm_enum(LLVMOpcode)]
enum InstructionOpcode {
    Call,
    #[llvm_versions(3.8..=latest)]
    CatchPad,
    ...,
    #[llvm_variant(LLVMRet)]
    Return,
    ...
}

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.