Skip to content

Allow specifying certain types we shouldn't derive/impl Debug for #961

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
11 tasks
fitzgen opened this issue Sep 7, 2017 · 7 comments
Closed
11 tasks

Allow specifying certain types we shouldn't derive/impl Debug for #961

fitzgen opened this issue Sep 7, 2017 · 7 comments

Comments

@fitzgen
Copy link
Member

fitzgen commented Sep 7, 2017

Add --no-debug <regex> and Builder::no_debug(String) to supply regexes for matching against types that we should not derive or implement Debug for.

Adding this feature involves:

  • Adding a new RegexSet member to bindgen::Builder (similar to the whitelisted_types set).

  • A Builder method to add strings to that RegexSet.

  • Plumbing in src/options.rs to convert --no-debug <regex> CLI flags into invocations of the builder method.

  • Making the MonotoneFramework::constrain function in src/ir/analysis/derive_debug.rs check if the given item is explicitly marked not to be Debug, and if so, inserting it into the self.cannot_derive_debug set via return self.insert(id).

  • Skipping any item explicitly marked not to be Debug in src/codegen/derive_debug.rs so that we don't generate an impl Debug for ... for these types when --impl-debug is passed.

  • Tests!

    • When --impl-debug is also supplied

    • When --impl-debug is not also supplied

    • When the no-debug type is transitively referenced by a whitelisted item

    • When the no-debug type is explicitly whitelisted

    • When the no-debug type is marked opaque

@fitzgen
Copy link
Member Author

fitzgen commented Sep 7, 2017

cc @jdm

@njayinthehouse
Copy link

Hey! I'd like to give this one a shot.

@pepyakin
Copy link
Contributor

pepyakin commented Oct 4, 2017

@njayinthehouse
Hi!
Feel free to ask if you run into any questions!

@ivanovaleksey
Copy link

ivanovaleksey commented Dec 8, 2017

Hello, there seems no activity on this issue, I would like to give a try.
@highfive: assign me

@highfive
Copy link

highfive commented Dec 8, 2017

Hey @ivanovaleksey! Thanks for your interest in working on this issue. It's now assigned to you!

@pepyakin
Copy link
Contributor

pepyakin commented Dec 8, 2017

@ivanovaleksey hi! dont hestiate to ask questions, i will glad to answer!

@pvdrz
Copy link
Contributor

pvdrz commented Nov 11, 2022

Already implemented

@pvdrz pvdrz closed this as completed Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants