Skip to content

Commit

Permalink
Ignore inlined functions
Browse files Browse the repository at this point in the history
  • Loading branch information
nox committed Apr 22, 2016
1 parent 9539d3d commit 82d2c01
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/clang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/clangll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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" {
Expand Down

0 comments on commit 82d2c01

Please sign in to comment.