Skip to content

ir: Skip function template earlier. #365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libbindgen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
5 changes: 5 additions & 0 deletions libbindgen/src/ir/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
10 changes: 10 additions & 0 deletions libbindgen/tests/expectations/tests/template_function_with_auto.rs
Original file line number Diff line number Diff line change
@@ -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;
}
9 changes: 9 additions & 0 deletions libbindgen/tests/headers/template_function_with_auto.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// bindgen-flags: -- -std=c++14

template<typename T> auto Test1() {
return T(1);
}

auto Test2() {
return Test1<unsigned int>();
}