diff options
author | Emilio Cobos Álvarez <ecoal95@gmail.com> | 2016-06-22 16:58:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-22 16:58:01 +0200 |
commit | 29af0483253c58a1863d6454e8b962e8e515e8d3 (patch) | |
tree | 1d28303ad7db079ed6b2f2ae22e7433a1a2177f3 | |
parent | 2c1d615a6984c2114748bf75269269d3aae37c1d (diff) | |
parent | 82d2c01d574e4d5a80091bc25f5015cc8e071d1c (diff) |
Merge pull request #4 from nox/inline
Ignore inlined functions
-rw-r--r-- | src/clang.rs | 4 | ||||
-rw-r--r-- | src/clangll.rs | 1 | ||||
-rw-r--r-- | src/parser.rs | 8 |
3 files changed, 13 insertions, 0 deletions
diff --git a/src/clang.rs b/src/clang.rs index 0b87cd9d..9c46a94e 100644 --- a/src/clang.rs +++ b/src/clang.rs @@ -135,6 +135,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 dfd92cee..4877ea70 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 2d46d791..6b942b2a 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -888,6 +888,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; @@ -1198,6 +1202,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" { |