summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2016-04-21 15:51:21 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2016-04-22 11:13:18 +0200
commit82d2c01d574e4d5a80091bc25f5015cc8e071d1c (patch)
tree64795d854ed3b1eb3e1fd63d0b1bcd24d8f4da64
parent9539d3d38399b0481349a2c489f3d2308cf1a1b2 (diff)
Ignore inlined functions
-rw-r--r--src/clang.rs4
-rw-r--r--src/clangll.rs1
-rw-r--r--src/parser.rs8
3 files changed, 13 insertions, 0 deletions
diff --git a/src/clang.rs b/src/clang.rs
index a5cf1007..d60de336 100644
--- a/src/clang.rs
+++ b/src/clang.rs
@@ -123,6 +123,10 @@ impl Cursor {
}
}
+ pub fn is_inlined_function(&self) -> bool {
+ unsafe { clang_Cursor_isFunctionInlined(self.x) != 0 }
+ }
+
// bitfield
pub fn bit_width(&self) -> Option<u32> {
unsafe {
diff --git a/src/clangll.rs b/src/clangll.rs
index 984f0aa5..4d2ae32d 100644
--- a/src/clangll.rs
+++ b/src/clangll.rs
@@ -1109,6 +1109,7 @@ extern "C" {
pub fn clang_Type_getTemplateArgumentAsType(T: CXType, i: c_int) ->
CXType;
pub fn clang_Cursor_isBitField(C: CXCursor) -> c_uint;
+ pub fn clang_Cursor_isFunctionInlined(C: CXCursor) -> c_uint;
pub fn clang_isVirtualBase(arg1: CXCursor) -> c_uint;
pub fn clang_getCXXAccessSpecifier(arg1: CXCursor) ->
Enum_CX_CXXAccessSpecifier;
diff --git a/src/parser.rs b/src/parser.rs
index 3fc03d57..be91d769 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -771,6 +771,10 @@ fn visit_composite(cursor: &Cursor, parent: &Cursor,
return CXChildVisit_Continue;
}
+ if cursor.is_inlined_function() {
+ return CXChildVisit_Continue;
+ }
+
// XXX no methods yet for templates
if !ci.args.is_empty() {
return CXChildVisit_Continue;
@@ -999,6 +1003,10 @@ fn visit_top(cursor: &Cursor,
return CXChildVisit_Continue;
}
+ if cursor.is_inlined_function() {
+ return CXChildVisit_Continue;
+ }
+
let spelling = cursor.spelling();
if spelling.len() > 8 &&
&(spelling)[..8] == "operator" {