Skip to content

Generated bindings don't transfer doxygen documentation comments for enum variants #1250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
albel727 opened this issue Feb 12, 2018 · 3 comments

Comments

@albel727
Copy link

Used software versions

bindgen: v0.32.3
llvm/clang: 5.0.1

Input C/C++ Header

/** Document enum */
enum B {
    /// Document field with three slashes
    VAR_A = 0,
    /** Document field with preceeding star */
    VAR_B = 1,
    /*! Document field with preceeding exclamation */
    VAR_C = 2,
    VAR_D = 3, /**< Document field with following star */
    VAR_E = 4, /*!< Document field with following exclamation */
};

Bindgen Invocation

    let bindings = bindgen::Builder::default()
        .header("input.h")
        .layout_tests(false)
        .generate().unwrap();

Also same with any of .constified_enum(".*")/.rustified_enum(".*")/.bitfield_enum(".*")/.prepend_enum_name("false").

Actual Results

pub const B_VAR_A: B = 0;
pub const B_VAR_B: B = 1;
pub const B_VAR_C: B = 2;
pub const B_VAR_D: B = 3;
pub const B_VAR_E: B = 4;
pub type B = u32;

Expected Results

Generated enum constants and, when possible, enum type itself, should have the documentation comments, just like it is now done for struct.

@fitzgen
Copy link
Member

fitzgen commented Feb 12, 2018

Thanks for filing an issue! I agree that it would be great if these comments were persisted in the emitted bindings.

@emilio
Copy link
Contributor

emilio commented Feb 12, 2018

We already have that info from clang, so should be straight forward...

@emilio emilio self-assigned this Feb 12, 2018
bors-servo pushed a commit that referenced this issue Feb 13, 2018
codegen: expose enum variant documentation.

Fixes #1250.
@albel727
Copy link
Author

Works for me. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants