Skip to content

Commit 82d2c01

Browse files
committed
Ignore inlined functions
1 parent 9539d3d commit 82d2c01

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/clang.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ impl Cursor {
123123
}
124124
}
125125

126+
pub fn is_inlined_function(&self) -> bool {
127+
unsafe { clang_Cursor_isFunctionInlined(self.x) != 0 }
128+
}
129+
126130
// bitfield
127131
pub fn bit_width(&self) -> Option<u32> {
128132
unsafe {

src/clangll.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,7 @@ extern "C" {
11091109
pub fn clang_Type_getTemplateArgumentAsType(T: CXType, i: c_int) ->
11101110
CXType;
11111111
pub fn clang_Cursor_isBitField(C: CXCursor) -> c_uint;
1112+
pub fn clang_Cursor_isFunctionInlined(C: CXCursor) -> c_uint;
11121113
pub fn clang_isVirtualBase(arg1: CXCursor) -> c_uint;
11131114
pub fn clang_getCXXAccessSpecifier(arg1: CXCursor) ->
11141115
Enum_CX_CXXAccessSpecifier;

src/parser.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,10 @@ fn visit_composite(cursor: &Cursor, parent: &Cursor,
771771
return CXChildVisit_Continue;
772772
}
773773

774+
if cursor.is_inlined_function() {
775+
return CXChildVisit_Continue;
776+
}
777+
774778
// XXX no methods yet for templates
775779
if !ci.args.is_empty() {
776780
return CXChildVisit_Continue;
@@ -999,6 +1003,10 @@ fn visit_top(cursor: &Cursor,
9991003
return CXChildVisit_Continue;
10001004
}
10011005

1006+
if cursor.is_inlined_function() {
1007+
return CXChildVisit_Continue;
1008+
}
1009+
10021010
let spelling = cursor.spelling();
10031011
if spelling.len() > 8 &&
10041012
&(spelling)[..8] == "operator" {

0 commit comments

Comments
 (0)