Skip to content

Commit d1c7352

Browse files
committed
Merge pull request rust-lang#250 from nox/extern
Recurse into unexposed decls
2 parents b40786a + 8a51860 commit d1c7352

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

src/parser.rs

+3
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,9 @@ fn visit_top<'r>(cursor: &Cursor,
498498
}
499499

500500
match cursor.kind() {
501+
CXCursor_UnexposedDecl => {
502+
return CXChildVisit_Recurse;
503+
}
501504
CXCursor_StructDecl | CXCursor_UnionDecl => {
502505
fwd_decl(ctx, cursor, |ctx_| {
503506
let decl = decl_name(ctx_, cursor);

tests/headers/extern.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
extern "C" {
2+
#include "func_proto.h"
3+
}

tests/test_extern.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
use support::assert_bind_eq;
2+
3+
#[test]
4+
fn extern_c_in_hpp() {
5+
assert_bind_eq("headers/extern.hpp", "
6+
pub type foo = extern \"C\" fn(bar: ::libc::c_int) -> ::libc::c_int;
7+
");
8+
}

tests/tests.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ mod support;
1010
//mod test_cmath;
1111
mod test_enum;
1212
mod test_decl;
13+
mod test_extern;
1314
mod test_func;
1415
mod test_struct;
1516
mod test_union;

0 commit comments

Comments
 (0)