Skip to content

Unnamed types have a name when switching to llvm >= 16.0.0 #2488

Closed
@Ilia-Kosenkov

Description

Sorry for not using the issue template, I have no minimal reproducible example right now.

Hi. We at extendr/libR-sys use bindgen to generate bindings for a set of headers provided by the R programming language. We have a complicated setup which creates bindings for all three mainstream OSes. On Windows, we rely on the MSYS2 and its version of LLVM.

Recently our CI for Windows started failing with the following errors:

  • warning: unused option: --allowlist-function followed by a collection of |-separated entries of our allow list
  • warning: unused option: --allowlist-var
  • warning: unused option: --allowlist-type

The builder configuration is (approximately) the following:

let mut bindgen_builder = bindgen::Builder::default()
        .allowlist_function(&allowlist_pattern)
        .allowlist_var(&allowlist_pattern)
        .allowlist_type(&allowlist_pattern)
        .header("wrapper.h")
        .parse_callbacks(Box::new(bindgen::CargoCallbacks))
        .clang_args(&[
           format!("-I{}", r_paths.include.display()),
           format!("--target={}", target),
        ])            
        .blocklist_item("max_align_t")
        .blocklist_item("__mingw_ldbl_type_t")
        .generate_comments(true)
        .parse_callbacks(Box::new(RCallbacks))
        .clang_arg("-fparse-all-comments");        

While it might be messy, you can see that we have some patterns specified for allow lists, and we have identical allow lists on all three OSes, and the allow list has not been recently changed.

I was able to locally reproduce this error if I install llvm 16.0.0 or higher (this time I am talking about native Windows version), but if I roll back to llvm 15.0.7, it works as before. This, to me, suggests that there is some (breaking?) change in, perhaps, CLI API or elsewhere that affects us.

I tried to scout clang-sys and this repo, but found no relevant issues. I am aware that this could be a problem in clang-sys, but I have a very limited understanding of llvm infrastructure, so I decided to start my investigation from here.

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions