Skip to content

rustified_enum doesn't work with anonymous enums #1161

Open
@tamird

Description

@tamird

Input C/C++ Header

https://github.com/llvm-mirror/llvm/blob/master/include/llvm/IR/CallingConv.h

Bindgen Invocation

bindgen::Builder::default()
    .header("llvm/IR/CallingConv.h")
    .whitelisted_type("llvm::CallingConv.*")
    .rustified_enum("llvm::CallingConv.*")
    .generate()
    .unwrap()
    .write_to_file("bindings.rs")
    .unwrap();

Actual Results

/// LLVM IR allows to use arbitrary numbers as calling convention identifiers. 
pub type llvm_CallingConv_ID = :: std :: os :: raw :: c_uint ; pub const C : llvm_CallingConv__bindgen_ty_1 = 0 ;
pub const Fast : llvm_CallingConv__bindgen_ty_1 = 8 ;
pub const Cold : llvm_CallingConv__bindgen_ty_1 = 9 ;
pub const GHC : llvm_CallingConv__bindgen_ty_1 = 10;
pub const HiPE : llvm_CallingConv__bindgen_ty_1 = 11 ;
pub const WebKit_JS : llvm_CallingConv__bindgen_ty_1 = 12 ;
pub const AnyReg : llvm_CallingConv__bindgen_ty_1 = 13 ;
pub const PreserveMost : llvm_CallingConv__bindgen_ty_1 = 14 ;
pub const PreserveAll : llvm_CallingConv__bindgen_ty_1 = 15 ;
pub const Swift : llvm_CallingConv__bindgen_ty_1 = 16 ;
pub const CXX_FAST_TLS : llvm_CallingConv__bindgen_ty_1 = 17 ;
pub const FirstTargetCC : llvm_CallingConv__bindgen_ty_1 = 64 ;
pub const X86_StdCall : llvm_CallingConv__bindgen_ty_1 = 64 ;
pub const X86_FastCall : llvm_CallingConv__bindgen_ty_1 = 65 ;
pub const ARM_APCS : llvm_CallingConv__bindgen_ty_1 = 66 ;
...
pub const MaxID : llvm_CallingConv__bindgen_ty_1 = 1023 ;
pub type llvm_CallingConv__bindgen_ty_1 = :: std :: os :: raw :: c_uint ; 

Expected Results

A Rust enum resembling:

pub enum LLVMRustResult { Success = 0 , Failure = 1 , }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions