summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJyun-Yan You <jyyou.tw@gmail.com>2016-01-13 19:02:38 +0800
committerJyun-Yan You <jyyou.tw@gmail.com>2016-01-13 19:02:38 +0800
commitd1c73522ada363393eb528248502c46a1a6b7527 (patch)
tree2dddf830029a83fe3b33fca416aea9c8abc4cac7
parentb40786aadd73b291a059a77dbcd11f075eef91c0 (diff)
parent8a5186040470a800f7867477daeaf70a62534d36 (diff)
Merge pull request #250 from nox/extern
Recurse into unexposed decls
-rw-r--r--src/parser.rs3
-rw-r--r--tests/headers/extern.hpp3
-rw-r--r--tests/test_extern.rs8
-rw-r--r--tests/tests.rs1
4 files changed, 15 insertions, 0 deletions
diff --git a/src/parser.rs b/src/parser.rs
index 8c80ea3e..075470a5 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -498,6 +498,9 @@ fn visit_top<'r>(cursor: &Cursor,
}
match cursor.kind() {
+ CXCursor_UnexposedDecl => {
+ return CXChildVisit_Recurse;
+ }
CXCursor_StructDecl | CXCursor_UnionDecl => {
fwd_decl(ctx, cursor, |ctx_| {
let decl = decl_name(ctx_, cursor);
diff --git a/tests/headers/extern.hpp b/tests/headers/extern.hpp
new file mode 100644
index 00000000..0779e038
--- /dev/null
+++ b/tests/headers/extern.hpp
@@ -0,0 +1,3 @@
+extern "C" {
+#include "func_proto.h"
+}
diff --git a/tests/test_extern.rs b/tests/test_extern.rs
new file mode 100644
index 00000000..495bf160
--- /dev/null
+++ b/tests/test_extern.rs
@@ -0,0 +1,8 @@
+use support::assert_bind_eq;
+
+#[test]
+fn extern_c_in_hpp() {
+ assert_bind_eq("headers/extern.hpp", "
+ pub type foo = extern \"C\" fn(bar: ::libc::c_int) -> ::libc::c_int;
+ ");
+}
diff --git a/tests/tests.rs b/tests/tests.rs
index ea9350f9..38472737 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -10,6 +10,7 @@ mod support;
//mod test_cmath;
mod test_enum;
mod test_decl;
+mod test_extern;
mod test_func;
mod test_struct;
mod test_union;