Skip to content
New issue

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

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

Already on GitHub? # to your account

Recognize inline namespaces using clang's dedicated API for that #2951

Merged
merged 2 commits into from
Nov 28, 2024

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Oct 16, 2024

Fixes #2950.


/// Is this cursor's referent a namespace that is inline?
pub(crate) fn is_inline_namespace(&self) -> bool {
unsafe { clang_Cursor_isInlineNamespace(self.x) != 0 }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://docs.rs/clang-sys/1.8.1/clang_sys/fn.clang_Cursor_isInlineNamespace.html, this function is available in libclang 9.0 and later.

Since #2932, bindgen only supports libclang 9.0 or later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for saving me the time of checking it :)

@dtolnay
Copy link
Member Author

dtolnay commented Oct 16, 2024

CI failures appear unrelated. I sent a fix in #2952.


/// Is this cursor's referent a namespace that is inline?
pub(crate) fn is_inline_namespace(&self) -> bool {
unsafe { clang_Cursor_isInlineNamespace(self.x) != 0 }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for saving me the time of checking it :)

@emilio emilio added this pull request to the merge queue Nov 28, 2024
Merged via the queue into rust-lang:main with commit 7fd78ad Nov 28, 2024
28 checks passed
@dtolnay dtolnay deleted the inlinenamespace branch November 28, 2024 18:03
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inadequate recognition of inline namespaces
2 participants