diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-12-28 01:47:57 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-28 01:47:57 -0800 |
commit | ba1cb0a005cae7b7eac48673d1af317f181325b1 (patch) | |
tree | e76647498967883c068199869754eb82ebdb7ed6 | |
parent | 3ba3a76f8c7f393c81bc14eb497ae2b3047ead98 (diff) | |
parent | 912abe5b584960e9c15a3cd050f965ab69bf5f7e (diff) |
Auto merge of #365 - upsuper:skip-functpl, r=emilio
ir: Skip function template earlier.
This fixes #364.
r? @emilio
-rw-r--r-- | libbindgen/Cargo.toml | 2 | ||||
-rw-r--r-- | libbindgen/src/ir/function.rs | 5 | ||||
-rw-r--r-- | libbindgen/tests/expectations/tests/template_function_with_auto.rs | 10 | ||||
-rw-r--r-- | libbindgen/tests/headers/template_function_with_auto.hpp | 9 |
4 files changed, 25 insertions, 1 deletions
diff --git a/libbindgen/Cargo.toml b/libbindgen/Cargo.toml index e6e9a5db..dfaba98b 100644 --- a/libbindgen/Cargo.toml +++ b/libbindgen/Cargo.toml @@ -12,7 +12,7 @@ license = "BSD-3-Clause" name = "libbindgen" readme = "README.md" repository = "https://github.com/servo/rust-bindgen" -version = "0.1.4" +version = "0.1.5" workspace = ".." [dev-dependencies] diff --git a/libbindgen/src/ir/function.rs b/libbindgen/src/ir/function.rs index 7aed3d7e..88ab861d 100644 --- a/libbindgen/src/ir/function.rs +++ b/libbindgen/src/ir/function.rs @@ -134,6 +134,11 @@ impl FunctionSig { use clang_sys::*; debug!("FunctionSig::from_ty {:?} {:?}", ty, cursor); + // Skip function templates + if cursor.kind() == CXCursor_FunctionTemplate { + return Err(ParseError::Continue); + } + // Don't parse operatorxx functions in C++ let spelling = cursor.spelling(); if spelling.starts_with("operator") { diff --git a/libbindgen/tests/expectations/tests/template_function_with_auto.rs b/libbindgen/tests/expectations/tests/template_function_with_auto.rs new file mode 100644 index 00000000..b86d8224 --- /dev/null +++ b/libbindgen/tests/expectations/tests/template_function_with_auto.rs @@ -0,0 +1,10 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +extern "C" { + #[link_name = "_Z5Test2v"] + pub fn Test2() -> ::std::os::raw::c_uint; +} diff --git a/libbindgen/tests/headers/template_function_with_auto.hpp b/libbindgen/tests/headers/template_function_with_auto.hpp new file mode 100644 index 00000000..3bd4a64f --- /dev/null +++ b/libbindgen/tests/headers/template_function_with_auto.hpp @@ -0,0 +1,9 @@ +// bindgen-flags: -- -std=c++14 + +template<typename T> auto Test1() { + return T(1); +} + +auto Test2() { + return Test1<unsigned int>(); +} |