Skip to content

Commit 29af048

Browse files
authored
Merge pull request rust-lang#4 from nox/inline
Ignore inlined functions
2 parents 2c1d615 + 82d2c01 commit 29af048

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
@@ -135,6 +135,10 @@ impl Cursor {
135135
}
136136
}
137137

138+
pub fn is_inlined_function(&self) -> bool {
139+
unsafe { clang_Cursor_isFunctionInlined(self.x) != 0 }
140+
}
141+
138142
// bitfield
139143
pub fn bit_width(&self) -> Option<u32> {
140144
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
@@ -888,6 +888,10 @@ fn visit_composite(cursor: &Cursor, parent: &Cursor,
888888
return CXChildVisit_Continue;
889889
}
890890

891+
if cursor.is_inlined_function() {
892+
return CXChildVisit_Continue;
893+
}
894+
891895
// XXX no methods yet for templates
892896
if !ci.args.is_empty() {
893897
return CXChildVisit_Continue;
@@ -1198,6 +1202,10 @@ fn visit_top(cursor: &Cursor,
11981202
return CXChildVisit_Continue;
11991203
}
12001204

1205+
if cursor.is_inlined_function() {
1206+
return CXChildVisit_Continue;
1207+
}
1208+
12011209
let spelling = cursor.spelling();
12021210
if spelling.len() > 8 &&
12031211
&(spelling)[..8] == "operator" {

0 commit comments

Comments
 (0)