Skip to content

clang::Cursor::args should return an Option<Vec<Cursor>> #130

Closed
@fitzgen

Description

@fitzgen

Right now it always returns a Vec<Cursor> but it makes FFI calls to clang_Cursor_getArgument which are only valid if the cursor's referent is a function or method declarations and calls:

http://clang.llvm.org/doxygen/group__CINDEX__TYPES.html#ga673c5529d33eedd0b78aca5ac6fc1d7c

The argument cursor can be determined for calls as well as for declarations of functions or methods. For other cursors and for invalid indices, an invalid cursor is returned.

We should check whether the cursor referent is a valid kind, and if it is not, we should return None. This will be one less foot gun.

I can mentor whoever would like to pick up this bug.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions