Commit 997d02a8 authored by Ole Christian Eidheim's avatar Ole Christian Eidheim
Browse files

Added Cursor::get_all_overridden_cursors

parent ee37617c
......@@ -161,6 +161,28 @@ std::vector<clangmm::Cursor> clangmm::Cursor::get_arguments() const {
return cursors;
}
std::vector<clangmm::Cursor> clangmm::Cursor::get_all_overridden_cursors() const {
std::vector<Cursor> result;
if(get_kind()!=Kind::CXXMethod)
return result;
class Recursive {
public:
static void overridden(std::vector<Cursor> &result, const Cursor &cursor, int depth) {
if(depth>0)
result.emplace_back(cursor);
CXCursor *cursors;
unsigned size;
clang_getOverriddenCursors(cursor.cx_cursor, &cursors, &size);
for(unsigned c=0;c<size;++c)
overridden(result, cursors[c], depth+1);
clang_disposeOverriddenCursors(cursors);
}
};
Recursive::overridden(result, *this, 0);
return result;
}
clangmm::Cursor::operator bool() const {
return !clang_Cursor_isNull(cx_cursor);
}
......
......@@ -208,6 +208,7 @@ namespace clangmm {
Cursor get_definition() const;
Cursor get_semantic_parent() const;
std::vector<Cursor> get_arguments() const;
std::vector<Cursor> get_all_overridden_cursors() const;
operator bool() const;
bool operator==(const Cursor& rhs) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment