Skip to content

Commit 86f3dbe

Browse files
dtolnayemilio
authored andcommitted
Handle CXCursor_LinkageSpec in Clang 18+
1 parent c006d5e commit 86f3dbe

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

bindgen/ir/item.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1433,8 +1433,11 @@ impl Item {
14331433
}
14341434

14351435
match cursor.kind() {
1436-
// Guess how does clang treat extern "C" blocks?
1437-
CXCursor_UnexposedDecl => Err(ParseError::Recurse),
1436+
// On Clang 18+, extern "C" is reported accurately as a LinkageSpec.
1437+
// Older LLVM treat it as UnexposedDecl.
1438+
CXCursor_LinkageSpec | CXCursor_UnexposedDecl => {
1439+
Err(ParseError::Recurse)
1440+
}
14381441

14391442
// We allowlist cursors here known to be unhandled, to prevent being
14401443
// too noisy about this.

0 commit comments

Comments
 (0)