diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-01-16 20:03:30 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-01-16 20:04:18 +0100 |
commit | d021caab5ea0180395cb790eb8ecafa8f66dc7b6 (patch) | |
tree | ffe5b5e678a8bfb632dc31b04abd237c8e5f0e6e /libbindgen/src/ir/function.rs | |
parent | b570ce853e33bfcfa05dd339bf432377c4a2fab8 (diff) |
ir: Unify function checks so they apply to non-methods.
Diffstat (limited to 'libbindgen/src/ir/function.rs')
-rw-r--r-- | libbindgen/src/ir/function.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libbindgen/src/ir/function.rs b/libbindgen/src/ir/function.rs index 88ab861d..50c442db 100644 --- a/libbindgen/src/ir/function.rs +++ b/libbindgen/src/ir/function.rs @@ -150,6 +150,7 @@ impl FunctionSig { } else { ty.declaration() }; + let mut args: Vec<_> = match cursor.kind() { CXCursor_FunctionDecl | CXCursor_Constructor | @@ -262,6 +263,24 @@ impl ClangSubItemParser for Function { debug!("Function::parse({:?}, {:?})", cursor, cursor.cur_type()); + let visibility = cursor.visibility(); + if visibility != CXVisibility_Default { + return Err(ParseError::Continue); + } + + if cursor.access_specifier() == CX_CXXPrivate { + return Err(ParseError::Continue); + } + + if cursor.is_inlined_function() { + return Err(ParseError::Continue); + } + + let linkage = cursor.linkage(); + if linkage != CXLinkage_External && linkage != CXLinkage_UniqueExternal { + return Err(ParseError::Continue); + } + // Grab the signature using Item::from_ty. let sig = try!(Item::from_ty(&cursor.cur_type(), Some(cursor), |