Skip to content

Commit 0e5f22b

Browse files
committed
Recognize inline namespaces using clang's dedicated API for that
1 parent 1eb1045 commit 0e5f22b

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

bindgen-tests/tests/expectations/tests/inline_namespace_macro.rs

Lines changed: 9 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen/clang.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,11 @@ impl Cursor {
970970
})
971971
}
972972
}
973+
974+
/// Is this cursor's referent a namespace that is inline?
975+
pub(crate) fn is_inline_namespace(&self) -> bool {
976+
unsafe { clang_Cursor_isInlineNamespace(self.x) != 0 }
977+
}
973978
}
974979

975980
/// A struct that owns the tokenizer result from a given cursor.

bindgen/ir/context.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2328,6 +2328,10 @@ If you encounter an error missing from this list, please file an issue or a PR!"
23282328
}
23292329
}
23302330

2331+
if cursor.is_inline_namespace() {
2332+
kind = ModuleKind::Inline;
2333+
}
2334+
23312335
(module_name, kind)
23322336
}
23332337

0 commit comments

Comments
 (0)