Module: FFIGen::Clang

Extended by:
FFI::Library
Defined in:
lib/ffi_gen/clang.rb

Defined Under Namespace

Classes: CodeCompleteResults, CompletionResult, Cursor, CursorAndRangeVisitor, CursorSetImpl, SourceLocation, SourceRange, TUResourceUsage, TUResourceUsageEntry, Token, TranslationUnitImpl, Type, UnsavedFile

Class Method Summary collapse

Class Method Details

._callback_cursor_visitor_(cursor, parent, client_data) ⇒ Symbol from _enum_child_visit_result_

Visitor invoked for each cursor found by a traversal.

This visitor function will be invoked for each cursor found by clang_visitCursorChildren(). Its first argument is the cursor being visited, its second argument is the parent visitor for that cursor, and its third argument is the client data provided to clang_visitCursorChildren().

The visitor should return one of the c CXChildVisitResult values to direct clang_visitCursorChildren().

This entry is only for documentation and no real method.

Parameters:

  • cursor (Cursor)
  • parent (Cursor)
  • client_data (FFI::Pointer(ClientData))

Returns:



2600
# File 'lib/ffi_gen/clang.rb', line 2600

callback :cursor_visitor, [Cursor.by_value, Cursor.by_value, :pointer], :child_visit_result

._callback_inclusion_visitor_(inclusion_stack, include_len, client_data) ⇒ FFI::Pointer(File)

Visitor invoked for each file in a translation unit

(used with clang_getInclusions()).

This visitor function will be invoked by clang_getInclusions() for each file included (either at the top-level or by #include directives) within a translation unit. The first argument is the file being included, and the second and third arguments provide the inclusion stack. The array is sorted in order of immediate inclusion. For example, the first element refers to the location that included ‘included_file’.

This entry is only for documentation and no real method.

Parameters:

  • inclusion_stack (FFI::Pointer(*SourceLocation))
  • include_len (Integer)
  • client_data (FFI::Pointer(ClientData))

Returns:

  • (FFI::Pointer(File))


3609
# File 'lib/ffi_gen/clang.rb', line 3609

callback :inclusion_visitor, [:pointer, :uint, :pointer], :pointer

._enum_availability_kind_Symbol

Describes the availability of a particular entity, which indicates whether the use of this entity will result in a warning or error due to it being deprecated or unavailable.

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:availability_kind).

Options:

:available

The entity is available.

:deprecated

The entity is available, but has been deprecated (and its use is not recommended).

:not_available

The entity is not available; any use of it will be an error.

:not_accessible

The entity is available, but not accessible; any use of it will be an error.

Returns:

  • (Symbol)


55
56
57
58
59
60
# File 'lib/ffi_gen/clang.rb', line 55

enum :availability_kind, [
  :available,
  :deprecated,
  :not_available,
  :not_accessible
]

._enum_child_visit_result_Symbol

Describes how the traversal of the children of a particular cursor should proceed after visiting a particular child cursor.

A value of this enumeration type should be returned by each c CXCursorVisitor to indicate how clang_visitChildren() proceed.

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:child_visit_result).

Options:

:break

Terminates the cursor traversal.

:continue

Continues the cursor traversal with the next sibling of the cursor just visited, without visiting its children.

:recurse

Recursively traverse the children of this cursor, using the same visitor and client data.

Returns:

  • (Symbol)


2575
2576
2577
2578
2579
# File 'lib/ffi_gen/clang.rb', line 2575

enum :child_visit_result, [
  :break,
  :continue,
  :recurse
]

._enum_code_complete_flags_Symbol

Flags that can be passed to c clang_codeCompleteAt() to modify its behavior.

The enumerators in this enumeration can be bitwise-OR’d together to provide multiple options to c clang_codeCompleteAt().

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:code_complete_flags).

Options:

:include_macros

Whether to include macros within the set of code completions returned.

:include_code_patterns

Whether to include code patterns for language constructs within the set of code completions, e.g., for loops.

Returns:

  • (Symbol)


3388
3389
3390
3391
# File 'lib/ffi_gen/clang.rb', line 3388

enum :code_complete_flags, [
  :include_macros, 0x01,
  :include_code_patterns, 0x02
]

._enum_completion_chunk_kind_Symbol

Describes a single piece of text within a code-completion string.

Each “chunk” within a code-completion string (c CXCompletionString) is either a piece of text with a specific “kind” that describes how that text should be interpreted by the client or is another completion string.

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:completion_chunk_kind).

Options:

:optional

A code-completion string that describes “optional” text that could be a part of the template (but is not required).

The Optional chunk is the only kind of chunk that has a code-completion string for its representation, which is accessible via c clang_getCompletionChunkCompletionString(). The code-completion string describes an additional part of the template that is completely optional. For example, optional chunks can be used to describe the placeholders for arguments that match up with defaulted function parameters, e.g. given:

code void f(int x, float y = 3.14, double z = 2.71828); endcode

The code-completion string for this function would contain:

- a TypedText chunk for "f".
- a LeftParen chunk for "(".
- a Placeholder chunk for "int x"
- an Optional chunk containing the remaining defaulted arguments, e.g.,
    - a Comma chunk for ","
    - a Placeholder chunk for "float y"
    - an Optional chunk containing the last defaulted argument:
        - a Comma chunk for ","
        - a Placeholder chunk for "double z"
- a RightParen chunk for ")"

There are many ways to handle Optional chunks. Two simple approaches are:

- Completely ignore optional chunks, in which case the template for the
  function "f" would only include the first parameter ("int x").
- Fully expand all optional chunks, in which case the template for the
  function "f" would have all of the parameters.
:typed_text

Text that a user would be expected to type to get this code-completion result.

There will be exactly one “typed text” chunk in a semantic string, which will typically provide the spelling of a keyword or the name of a declaration that could be used at the current code point. Clients are expected to filter the code-completion results based on the text in this chunk.

:text

Text that should be inserted as part of a code-completion result.

A “text” chunk represents text that is part of the template to be inserted into user code should this particular code-completion result be selected.

:placeholder

Placeholder text that should be replaced by the user.

A “placeholder” chunk marks a place where the user should insert text into the code-completion template. For example, placeholders might mark the function parameters for a function declaration, to indicate that the user should provide arguments for each of those parameters. The actual text in a placeholder is a suggestion for the text to display before the user replaces the placeholder with real code.

:informative

Informative text that should be displayed but never inserted as part of the template.

An “informative” chunk contains annotations that can be displayed to help the user decide whether a particular code-completion result is the right option, but which is not part of the actual template to be inserted by code completion.

:current_parameter

Text that describes the current parameter when code-completion is referring to function call, message send, or template specialization.

A “current parameter” chunk occurs when code-completion is providing information about a parameter corresponding to the argument at the code-completion point. For example, given a function

code int add(int x, int y); endcode

and the source code c add(, where the code-completion point is after the “(”, the code-completion string will contain a “current parameter” chunk for “int x”, indicating that the current argument will initialize that parameter. After typing further, to c add(17, (where the code-completion point is after the “,”), the code-completion string will contain a “current paremeter” chunk to “int y”.

:left_paren

A left parenthesis (‘(’), used to initiate a function call or signal the beginning of a function parameter list.

:right_paren

A right parenthesis (‘)’), used to finish a function call or signal the end of a function parameter list.

:left_bracket

A left bracket (‘(’).

:right_bracket

A right bracket (‘)’).

:left_brace

A left brace (‘

:right_brace

A right brace (‘’).

:left_angle

A left angle bracket (‘<’).

:right_angle

A right angle bracket (‘>’).

:comma

A comma separator (‘,’).

:result_type

Text that specifies the result type of a given result.

This special kind of informative chunk is not meant to be inserted into the text buffer. Rather, it is meant to illustrate the type that an expression using the given completion string would have.

:colon

A colon (‘:’).

:semi_colon

A semicolon (‘;’).

:equal

An ‘=’ sign.

:horizontal_space

Horizontal space (‘ ’).

:vertical_space

Vertical space (‘n’), after which it is generally a good idea to perform indentation.

Returns:

  • (Symbol)


3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
# File 'lib/ffi_gen/clang.rb', line 3237

enum :completion_chunk_kind, [
  :optional,
  :typed_text,
  :text,
  :placeholder,
  :informative,
  :current_parameter,
  :left_paren,
  :right_paren,
  :left_bracket,
  :right_bracket,
  :left_brace,
  :right_brace,
  :left_angle,
  :right_angle,
  :comma,
  :result_type,
  :colon,
  :semi_colon,
  :equal,
  :horizontal_space,
  :vertical_space
]

._enum_completion_context_Symbol

Bits that represent the context under which completion is occurring.

The enumerators in this enumeration may be bitwise-OR’d together if multiple contexts are occurring simultaneously.

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:completion_context).

Options:

:completion_context_unexposed

The context for completions is unexposed, as only Clang results should be included. (This is equivalent to having no context bits set.)

Returns:

  • (Symbol)


3408
3409
3410
# File 'lib/ffi_gen/clang.rb', line 3408

enum :completion_context, [
  :completion_context_unexposed, 0
]

._enum_cursor_kind_Symbol

Describes the kind of entity that a cursor refers to.

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:cursor_kind).

Options:

:unexposed_decl

A declaration whose specific kind is not exposed via this interface.

Unexposed declarations have the same operations as any other kind of declaration; one can extract their location information, spelling, find their definitions, etc. However, the specific kind of the declaration is not reported.

:struct_decl

A C or C++ struct.

:union_decl

A C or C++ union.

:class_decl

A C++ class.

:enum_decl

An enumeration.

:field_decl

A field (in C) or non-static data member (in C++) in a struct, union, or C++ class.

:enum_constant_decl

An enumerator constant.

:function_decl

A function.

:var_decl

A variable.

:parm_decl

A function or method parameter.

:obj_c_interface_decl

An Objective-C @interface.

:obj_c_category_decl

An Objective-C @interface for a category.

:obj_c_protocol_decl

An Objective-C @protocol declaration.

:obj_c_property_decl

An Objective-C @property declaration.

:obj_c_ivar_decl

An Objective-C instance variable.

:obj_c_instance_method_decl

An Objective-C instance method.

:obj_c_class_method_decl

An Objective-C class method.

:obj_c_implementation_decl

An Objective-C @implementation.

:obj_c_category_impl_decl

An Objective-C @implementation for a category.

:typedef_decl

A typedef

:x_method

A C++ class method.

:namespace

A C++ namespace.

:linkage_spec

A linkage specification, e.g. ‘extern “C”’.

:constructor

A C++ constructor.

:destructor

A C++ destructor.

:conversion_function

A C++ conversion function.

:template_type_parameter

A C++ template type parameter.

:non_type_template_parameter

A C++ non-type template parameter.

:template_template_parameter

A C++ template template parameter.

:function_template

A C++ function template.

:class_template

A C++ class template.

:class_template_partial_specialization

A C++ class template partial specialization.

:namespace_alias

A C++ namespace alias declaration.

:using_directive

A C++ using directive.

:using_declaration

A C++ using declaration.

:type_alias_decl

A C++ alias declaration

:obj_c_synthesize_decl

An Objective-C @synthesize definition.

:obj_c_dynamic_decl

An Objective-C @dynamic definition.

:x_access_specifier

An access specifier.

:first_ref

References

:obj_c_super_class_ref

Decl references

:obj_c_protocol_ref
:obj_c_class_ref
:type_ref

A reference to a type declaration.

A type reference occurs anywhere where a type is named but not declared. For example, given:

code typedef unsigned size_type; size_type size; endcode

The typedef is a declaration of size_type (CXCursor_TypedefDecl), while the type of the variable “size” is referenced. The cursor referenced by the type of size is the typedef for size_type.

:x_base_specifier
:template_ref

A reference to a class template, function template, template template parameter, or class template partial specialization.

:namespace_ref

A reference to a namespace or namespace alias.

:member_ref

A reference to a member of a struct, union, or class that occurs in some non-expression context, e.g., a designated initializer.

:label_ref

A reference to a labeled statement.

This cursor kind is used to describe the jump to “start_over” in the goto statement in the following example:

code

start_over:
  ++counter;

  goto start_over;

endcode

A label reference cursor refers to a label statement.

:overloaded_decl_ref

A reference to a set of overloaded functions or function templates that has not yet been resolved to a specific function or function template.

An overloaded declaration reference cursor occurs in C++ templates where a dependent name refers to a function. For example:

code template<typename T> void swap(T&, T&);

struct X { … }; void swap(X&, X&);

template<typename T> void reverse(T* first, T* last) {

while (first < last - 1) {
  swap(*first, *--last);
  ++first;
}

}

struct Y { }; void swap(Y&, Y&); endcode

Here, the identifier “swap” is associated with an overloaded declaration reference. In the template definition, “swap” refers to either of the two “swap” functions declared above, so both results will be available. At instantiation time, “swap” may also refer to other functions found via argument-dependent lookup (e.g., the “swap” function at the end of the example).

The functions c clang_getNumOverloadedDecls() and c clang_getOverloadedDecl() can be used to retrieve the definitions referenced by this cursor.

:first_invalid

Error conditions

:invalid_file
:no_decl_found
:not_implemented
:invalid_code
:first_expr

Expressions

:unexposed_expr

An expression whose specific kind is not exposed via this interface.

Unexposed expressions have the same operations as any other kind of expression; one can extract their location information, spelling, children, etc. However, the specific kind of the expression is not reported.

:decl_ref_expr

An expression that refers to some value declaration, such as a function, varible, or enumerator.

:member_ref_expr

An expression that refers to a member of a struct, union, class, Objective-C class, etc.

:call_expr

An expression that calls a function.

:obj_c_message_expr

An expression that sends a message to an Objective-C

object or class.
:block_expr

An expression that represents a block literal.

:integer_literal

An integer literal.

:floating_literal

A floating point number literal.

:imaginary_literal

An imaginary number literal.

:string_literal

A string literal.

:character_literal

A character literal.

:paren_expr

A parenthesized expression, e.g. “(1)”.

This AST node is only formed if full location information is requested.

:unary_operator

This represents the unary-expression’s (except sizeof and alignof).

:array_subscript_expr

(C99 6.5.2.1) Array Subscripting.

:binary_operator

A builtin binary operation expression such as “x + y” or “x <= y”.

:compound_assign_operator

Compound assignment such as “+=”.

:conditional_operator

The ?: ternary operator.

:c_style_cast_expr

An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ (expr.cast)), which uses the syntax (Type)expr.

For example: (int)f.

:compound_literal_expr

(C99 6.5.2.5)

:init_list_expr

Describes an C or C++ initializer list.

:addr_label_expr

The GNU address of label extension, representing &&label.

:stmt_expr

This is the GNU Statement Expression extension: (X=4; X;)

:generic_selection_expr

Represents a C1X generic selection.

:gnu_null_expr

Implements the GNU __null extension, which is a name for a null pointer constant that has integral type (e.g., int or long) and is the same size and alignment as a pointer.

The __null extension is typically only used by system headers, which define NULL as __null in C++ rather than using 0 (which is an integer that may not match the size of a pointer).

:x_static_cast_expr

C++‘s static_cast<> expression.

:x_dynamic_cast_expr

C++‘s dynamic_cast<> expression.

:x_reinterpret_cast_expr

C++‘s reinterpret_cast<> expression.

:x_const_cast_expr

C++‘s const_cast<> expression.

:x_functional_cast_expr

Represents an explicit C++ type conversion that uses “functional” notion (C++ (expr.type.conv)).

Example: code

x = int(0.5);

endcode

:x_typeid_expr

A C++ typeid expression (C++ (expr.typeid)).

:x_bool_literal_expr

(C++ 2.13.5) C++ Boolean Literal.

:x_null_ptr_literal_expr

(C++0x 2.14.7) C++ Pointer Literal.

:x_this_expr

Represents the “this” expression in C++

:x_throw_expr

(C++ 15) C++ Throw Expression.

This handles ‘throw’ and ‘throw’ assignment-expression. When assignment-expression isn’t present, Op will be null.

:x_new_expr

A new expression for memory allocation and constructor calls, e.g: “new CXXNewExpr(foo)”.

:x_delete_expr

A delete expression for memory deallocation and destructor calls, e.g. “delete() pArray”.

:unary_expr

A unary expression.

:obj_c_string_literal

ObjCStringLiteral, used for Objective-C string literals i.e. “foo”.

:obj_c_encode_expr

ObjCEncodeExpr, used for in Objective-C.

:obj_c_selector_expr

ObjCSelectorExpr used for in Objective-C.

:obj_c_protocol_expr

Objective-C’s protocol expression.

:obj_c_bridged_cast_expr

An Objective-C “bridged” cast expression, which casts between Objective-C pointers and C pointers, transferring ownership in the process.

code

NSString *str = (__bridge_transfer NSString *)CFCreateString();

endcode

:pack_expansion_expr

Represents a C++0x pack expansion that produces a sequence of expressions.

A pack expansion expression contains a pattern (which itself is an expression) followed by an ellipsis. For example:

code template<typename F, typename …Types> void forward(F f, Types &&…args)

f(static_cast<Types&&>(args)...);

endcode

:size_of_pack_expr

Represents an expression that computes the length of a parameter pack.

code template<typename …Types> struct count

static const unsigned value = sizeof...(Types);

; endcode

:first_stmt

Statements

:unexposed_stmt

A statement whose specific kind is not exposed via this interface.

Unexposed statements have the same operations as any other kind of statement; one can extract their location information, spelling, children, etc. However, the specific kind of the statement is not reported.

:label_stmt

A labelled statement in a function.

This cursor kind is used to describe the “start_over:” label statement in the following example:

code

start_over:
  ++counter;

endcode

:compound_stmt

A group of statements like { stmt stmt }.

This cursor kind is used to describe compound statements, e.g. function bodies.

:case_stmt

A case statment.

:default_stmt

A default statement.

:if_stmt

An if statement

:switch_stmt

A switch statement.

:while_stmt

A while statement.

:do_stmt

A do statement.

:for_stmt

A for statement.

:goto_stmt

A goto statement.

:indirect_goto_stmt

An indirect goto statement.

:continue_stmt

A continue statement.

:break_stmt

A break statement.

:return_stmt

A return statement.

:asm_stmt

A GNU inline assembly statement extension.

:obj_c_at_try_stmt

Objective-C’s overall @try-@catc-@finall statement.

:obj_c_at_catch_stmt

Objective-C’s @catch statement.

:obj_c_at_finally_stmt

Objective-C’s @finally statement.

:obj_c_at_throw_stmt

Objective-C’s @throw statement.

:obj_c_at_synchronized_stmt

Objective-C’s @synchronized statement.

:obj_c_autorelease_pool_stmt

Objective-C’s autorelease pool statement.

:obj_c_for_collection_stmt

Objective-C’s collection statement.

:x_catch_stmt

C++‘s catch statement.

:x_try_stmt

C++‘s try statement.

:x_for_range_stmt

C++‘s for (* : *) statement.

:seh_try_stmt

Windows Structured Exception Handling’s try statement.

:seh_except_stmt

Windows Structured Exception Handling’s except statement.

:seh_finally_stmt

Windows Structured Exception Handling’s finally statement.

:null_stmt

The null satement “;”: C99 6.8.3p3.

This cursor kind is used to describe the null statement.

:decl_stmt

Adaptor class for mixing declarations with statements and expressions.

:translation_unit

Cursor that represents the translation unit itself.

The translation unit cursor exists primarily to act as the root cursor for traversing the contents of a translation unit.

:first_attr

Attributes

:unexposed_attr

An attribute whose specific kind is not exposed via this interface.

:ib_action_attr
:ib_outlet_attr
:ib_outlet_collection_attr
:x_final_attr
:x_override_attr
:annotate_attr
:preprocessing_directive

Preprocessing

:macro_definition
:macro_expansion
:inclusion_directive

Returns:

  • (Symbol)


1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
# File 'lib/ffi_gen/clang.rb', line 1566

enum :cursor_kind, [
  :unexposed_decl, 1,
  :struct_decl, 2,
  :union_decl, 3,
  :class_decl, 4,
  :enum_decl, 5,
  :field_decl, 6,
  :enum_constant_decl, 7,
  :function_decl, 8,
  :var_decl, 9,
  :parm_decl, 10,
  :obj_c_interface_decl, 11,
  :obj_c_category_decl, 12,
  :obj_c_protocol_decl, 13,
  :obj_c_property_decl, 14,
  :obj_c_ivar_decl, 15,
  :obj_c_instance_method_decl, 16,
  :obj_c_class_method_decl, 17,
  :obj_c_implementation_decl, 18,
  :obj_c_category_impl_decl, 19,
  :typedef_decl, 20,
  :x_method, 21,
  :namespace, 22,
  :linkage_spec, 23,
  :constructor, 24,
  :destructor, 25,
  :conversion_function, 26,
  :template_type_parameter, 27,
  :non_type_template_parameter, 28,
  :template_template_parameter, 29,
  :function_template, 30,
  :class_template, 31,
  :class_template_partial_specialization, 32,
  :namespace_alias, 33,
  :using_directive, 34,
  :using_declaration, 35,
  :type_alias_decl, 36,
  :obj_c_synthesize_decl, 37,
  :obj_c_dynamic_decl, 38,
  :x_access_specifier, 39,
  :first_ref, 40,
  :obj_c_super_class_ref, 40,
  :obj_c_protocol_ref, 41,
  :obj_c_class_ref, 42,
  :type_ref, 43,
  :x_base_specifier, 44,
  :template_ref, 45,
  :namespace_ref, 46,
  :member_ref, 47,
  :label_ref, 48,
  :overloaded_decl_ref, 49,
  :first_invalid, 70,
  :invalid_file, 70,
  :no_decl_found, 71,
  :not_implemented, 72,
  :invalid_code, 73,
  :first_expr, 100,
  :unexposed_expr, 100,
  :decl_ref_expr, 101,
  :member_ref_expr, 102,
  :call_expr, 103,
  :obj_c_message_expr, 104,
  :block_expr, 105,
  :integer_literal, 106,
  :floating_literal, 107,
  :imaginary_literal, 108,
  :string_literal, 109,
  :character_literal, 110,
  :paren_expr, 111,
  :unary_operator, 112,
  :array_subscript_expr, 113,
  :binary_operator, 114,
  :compound_assign_operator, 115,
  :conditional_operator, 116,
  :c_style_cast_expr, 117,
  :compound_literal_expr, 118,
  :init_list_expr, 119,
  :addr_label_expr, 120,
  :stmt_expr, 121,
  :generic_selection_expr, 122,
  :gnu_null_expr, 123,
  :x_static_cast_expr, 124,
  :x_dynamic_cast_expr, 125,
  :x_reinterpret_cast_expr, 126,
  :x_const_cast_expr, 127,
  :x_functional_cast_expr, 128,
  :x_typeid_expr, 129,
  :x_bool_literal_expr, 130,
  :x_null_ptr_literal_expr, 131,
  :x_this_expr, 132,
  :x_throw_expr, 133,
  :x_new_expr, 134,
  :x_delete_expr, 135,
  :unary_expr, 136,
  :obj_c_string_literal, 137,
  :obj_c_encode_expr, 138,
  :obj_c_selector_expr, 139,
  :obj_c_protocol_expr, 140,
  :obj_c_bridged_cast_expr, 141,
  :pack_expansion_expr, 142,
  :size_of_pack_expr, 143,
  :first_stmt, 200,
  :unexposed_stmt, 200,
  :label_stmt, 201,
  :compound_stmt, 202,
  :case_stmt, 203,
  :default_stmt, 204,
  :if_stmt, 205,
  :switch_stmt, 206,
  :while_stmt, 207,
  :do_stmt, 208,
  :for_stmt, 209,
  :goto_stmt, 210,
  :indirect_goto_stmt, 211,
  :continue_stmt, 212,
  :break_stmt, 213,
  :return_stmt, 214,
  :asm_stmt, 215,
  :obj_c_at_try_stmt, 216,
  :obj_c_at_catch_stmt, 217,
  :obj_c_at_finally_stmt, 218,
  :obj_c_at_throw_stmt, 219,
  :obj_c_at_synchronized_stmt, 220,
  :obj_c_autorelease_pool_stmt, 221,
  :obj_c_for_collection_stmt, 222,
  :x_catch_stmt, 223,
  :x_try_stmt, 224,
  :x_for_range_stmt, 225,
  :seh_try_stmt, 226,
  :seh_except_stmt, 227,
  :seh_finally_stmt, 228,
  :null_stmt, 230,
  :decl_stmt, 231,
  :translation_unit, 300,
  :first_attr, 400,
  :unexposed_attr, 400,
  :ib_action_attr, 401,
  :ib_outlet_attr, 402,
  :ib_outlet_collection_attr, 403,
  :x_final_attr, 404,
  :x_override_attr, 405,
  :annotate_attr, 406,
  :preprocessing_directive, 500,
  :macro_definition, 501,
  :macro_expansion, 502,
  :inclusion_directive, 503
]

._enum_cxx_access_specifier_Symbol

Represents the C++ access control level to a base class for a cursor with kind CX_CXXBaseSpecifier.

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:cxx_access_specifier).

Options:

:x_invalid_access_specifier
:x_public
:x_protected
:x_private

Returns:

  • (Symbol)


2504
2505
2506
2507
2508
2509
# File 'lib/ffi_gen/clang.rb', line 2504

enum :cxx_access_specifier, [
  :x_invalid_access_specifier,
  :x_public,
  :x_protected,
  :x_private
]

._enum_diagnostic_display_options_Symbol

Options to control the display of diagnostics.

The values in this enum are meant to be combined to customize the behavior of c clang_displayDiagnostic().

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:diagnostic_display_options).

Options:

:display_source_location

Display the source-location information where the diagnostic was located.

When set, diagnostics will be prefixed by the file, line, and (optionally) column to which the diagnostic refers. For example,

code test.c:28: warning: extra tokens at end of #endif directive endcode

This option corresponds to the clang flag c -fshow-source-location.

:display_column

If displaying the source-location information of the diagnostic, also include the column number.

This option corresponds to the clang flag c -fshow-column.

:display_source_ranges

If displaying the source-location information of the diagnostic, also include information about source ranges in a machine-parsable format.

This option corresponds to the clang flag c -fdiagnostics-print-source-range-info.

:display_option

Display the option name associated with this diagnostic, if any.

The option name displayed (e.g., -Wconversion) will be placed in brackets after the diagnostic text. This option corresponds to the clang flag c -fdiagnostics-show-option.

:display_category_id

Display the category number associated with this diagnostic, if any.

The category number is displayed within brackets after the diagnostic text. This option corresponds to the clang flag c -fdiagnostics-show-category=id.

:display_category_name

Display the category name associated with this diagnostic, if any.

The category name is displayed within brackets after the diagnostic text. This option corresponds to the clang flag c -fdiagnostics-show-category=name.

Returns:

  • (Symbol)


503
504
505
506
507
508
509
510
# File 'lib/ffi_gen/clang.rb', line 503

enum :diagnostic_display_options, [
  :display_source_location, 0x01,
  :display_column, 0x02,
  :display_source_ranges, 0x04,
  :display_option, 0x08,
  :display_category_id, 0x10,
  :display_category_name, 0x20
]

._enum_diagnostic_severity_Symbol

Describes the severity of a particular diagnostic.

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:diagnostic_severity).

Options:

:ignored

A diagnostic that has been suppressed, e.g., by a command-line option.

:note

This diagnostic is a note that should be attached to the previous (non-note) diagnostic.

:warning

This diagnostic indicates suspicious code that may not be wrong.

:error

This diagnostic indicates that the code is ill-formed.

:fatal

This diagnostic indicates that the code is ill-formed such that future parser recovery is unlikely to produce useful results.

Returns:

  • (Symbol)


414
415
416
417
418
419
420
# File 'lib/ffi_gen/clang.rb', line 414

enum :diagnostic_severity, [
  :ignored, 0,
  :note, 1,
  :warning, 2,
  :error, 3,
  :fatal, 4
]

._enum_language_kind_Symbol

Describe the “language” of the entity referred to by a cursor.

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:language_kind).

Options:

:invalid
:c
:obj_c
:c_plus_plus

Returns:

  • (Symbol)


1939
1940
1941
1942
1943
1944
# File 'lib/ffi_gen/clang.rb', line 1939

enum :language_kind, [
  :invalid, 0,
  :c,
  :obj_c,
  :c_plus_plus
]

._enum_linkage_kind_Symbol

Describe the linkage of the entity referred to by a cursor.

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:linkage_kind).

Options:

:invalid

This value indicates that no linkage information is available for a provided CXCursor.

:no_linkage

This is the linkage for variables, parameters, and so on that

have automatic storage.  This covers normal (non-extern) local variables.
:internal

This is the linkage for static variables and static functions.

:unique_external

This is the linkage for entities with external linkage that live in C++ anonymous namespaces.

:external

This is the linkage for entities with true, external linkage.

Returns:

  • (Symbol)


1898
1899
1900
1901
1902
1903
1904
# File 'lib/ffi_gen/clang.rb', line 1898

enum :linkage_kind, [
  :invalid,
  :no_linkage,
  :internal,
  :unique_external,
  :external
]

._enum_name_ref_flags_Symbol

(Not documented)

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:name_ref_flags).

Options:

:want_qualifier
Include the nested-name-specifier, e.g. Foo

in x.Foo::y, in the

range.

:want_template_args

Include the explicit template arguments, e.g. <int> in x.f<int>, in the range.

:want_single_piece

If the name is non-contiguous, return the full spanning range.

Non-contiguous names occur in Objective-C when a selector with two or more parameters is used, or in C++ when using an operator: code (object doSomething:here withValue:there); // ObjC return some_vector(1); // C++ endcode

Returns:

  • (Symbol)


2907
2908
2909
2910
2911
# File 'lib/ffi_gen/clang.rb', line 2907

enum :name_ref_flags, [
  :want_qualifier, 0x1,
  :want_template_args, 0x2,
  :want_single_piece, 0x4
]

._enum_reparse_flags_Symbol

Flags that control the reparsing of translation units.

The enumerators in this enumeration type are meant to be bitwise ORed together to specify which options should be used when reparsing the translation unit.

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:reparse_flags).

Options:

:reparse_none

Used to indicate that no special reparsing options are needed.

Returns:

  • (Symbol)


956
957
958
# File 'lib/ffi_gen/clang.rb', line 956

enum :reparse_flags, [
  :reparse_none, 0x0
]

._enum_save_error_Symbol

Describes the kind of error that occurred (if any) in a call to c clang_saveTranslationUnit().

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:save_error).

Options:

:none

Indicates that no error occurred while saving a translation unit.

:unknown

Indicates that an unknown error occurred while attempting to save the file.

This error typically indicates that file I/O failed when attempting to write the file.

:translation_errors

Indicates that errors during translation prevented this attempt to save the translation unit.

Errors that prevent the translation unit from being saved can be extracted using c clang_getNumDiagnostics() and c clang_getDiagnostic().

:invalid_tu

Indicates that the translation unit to be saved was somehow invalid (e.g., NULL).

Returns:

  • (Symbol)


904
905
906
907
908
909
# File 'lib/ffi_gen/clang.rb', line 904

enum :save_error, [
  :none, 0,
  :unknown, 1,
  :translation_errors, 2,
  :invalid_tu, 3
]

._enum_save_translation_unit_flags_Symbol

Flags that control how translation units are saved.

The enumerators in this enumeration type are meant to be bitwise ORed together to specify which options should be used when saving the translation unit.

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:save_translation_unit_flags).

Options:

:save_translation_unit_none

Used to indicate that no special saving options are needed.

Returns:

  • (Symbol)


859
860
861
# File 'lib/ffi_gen/clang.rb', line 859

enum :save_translation_unit_flags, [
  :save_translation_unit_none, 0x0
]

._enum_token_kind_Symbol

Describes a kind of token.

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:token_kind).

Options:

:punctuation

A token that contains some kind of punctuation.

:keyword

A language keyword.

:identifier

An identifier (that is not a keyword).

:literal

A numeric, string, or character literal.

:comment

A comment.

Returns:

  • (Symbol)


2932
2933
2934
2935
2936
2937
2938
# File 'lib/ffi_gen/clang.rb', line 2932

enum :token_kind, [
  :punctuation,
  :keyword,
  :identifier,
  :literal,
  :comment
]

._enum_translation_unit_flags_Symbol

Flags that control the creation of translation units.

The enumerators in this enumeration type are meant to be bitwise ORed together to specify which options should be used when constructing the translation unit.

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:translation_unit_flags).

Options:

:none

Used to indicate that no special translation-unit options are needed.

:detailed_preprocessing_record

Used to indicate that the parser should construct a “detailed” preprocessing record, including all macro definitions and instantiations.

Constructing a detailed preprocessing record requires more memory and time to parse, since the information contained in the record is usually not retained. However, it can be useful for applications that require more detailed information about the behavior of the preprocessor.

:incomplete

Used to indicate that the translation unit is incomplete.

When a translation unit is considered “incomplete”, semantic analysis that is typically performed at the end of the translation unit will be suppressed. For example, this suppresses the completion of tentative declarations in C and of instantiation of implicitly-instantiation function templates in C++. This option is typically used when parsing a header with the intent of producing a precompiled header.

:precompiled_preamble

Used to indicate that the translation unit should be built with an implicit precompiled header for the preamble.

An implicit precompiled header is used as an optimization when a particular translation unit is likely to be reparsed many times when the sources aren’t changing that often. In this case, an implicit precompiled header will be built containing all of the initial includes at the top of the main file (what we refer to as the “preamble” of the file). In subsequent parses, if the preamble or the files in it have not changed, c clang_reparseTranslationUnit() will re-use the implicit precompiled header to improve parsing performance.

:cache_completion_results

Used to indicate that the translation unit should cache some code-completion results with each reparse of the source file.

Caching of code-completion results is a performance optimization that introduces some overhead to reparsing but improves the performance of code-completion operations.

:x_precompiled_preamble

DEPRECATED: Enable precompiled preambles in C++.

Note: this is a temporary option that is available only while we are testing C++ precompiled preamble support. It is deprecated.

:x_chained_pch

DEPRECATED: Enabled chained precompiled preambles in C++.

Note: this is a temporary option that is available only while we are testing C++ precompiled preamble support. It is deprecated.

:nested_macro_expansions

Used to indicate that the “detailed” preprocessing record, if requested, should also contain nested macro expansions.

Nested macro expansions (i.e., macro expansions that occur inside another macro expansion) can, in some code bases, require a large amount of storage to due preprocessor metaprogramming. Moreover, its fairly rare that this information is useful for libclang clients.

Returns:

  • (Symbol)


780
781
782
783
784
785
786
787
788
789
# File 'lib/ffi_gen/clang.rb', line 780

enum :translation_unit_flags, [
  :none, 0x0,
  :detailed_preprocessing_record, 0x01,
  :incomplete, 0x02,
  :precompiled_preamble, 0x04,
  :cache_completion_results, 0x08,
  :x_precompiled_preamble, 0x10,
  :x_chained_pch, 0x20,
  :nested_macro_expansions, 0x40
]

._enum_tu_resource_usage_kind_Symbol

Categorizes how memory is being used by a translation unit.

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:tu_resource_usage_kind).

Options:

:ast
:identifiers
:selectors
:global_completion_results
:source_manager_content_cache
:ast_side_tables
:source_manager_membuffer_malloc
:source_manager_membuffer_m_map
:external_ast_source_membuffer_malloc
:external_ast_source_membuffer_m_map
:preprocessor
:preprocessing_record
:source_manager_data_structures
:preprocessor_header_search

Returns:

  • (Symbol)


1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
# File 'lib/ffi_gen/clang.rb', line 1048

enum :tu_resource_usage_kind, [
  :ast, 1,
  :identifiers, 2,
  :selectors, 3,
  :global_completion_results, 4,
  :source_manager_content_cache, 5,
  :ast_side_tables, 6,
  :source_manager_membuffer_malloc, 7,
  :source_manager_membuffer_m_map, 8,
  :external_ast_source_membuffer_malloc, 9,
  :external_ast_source_membuffer_m_map, 10,
  :preprocessor, 11,
  :preprocessing_record, 12,
  :source_manager_data_structures, 13,
  :preprocessor_header_search, 14
]

._enum_type_kind_Symbol

Describes the kind of type

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:type_kind).

Options:

:invalid

Reprents an invalid type (e.g., where no type is available).

:unexposed

A type whose specific kind is not exposed via this interface.

:void

Builtin types

:bool
:char_u
:u_char
:char16
:char32
:u_short
:u_int
:u_long
:u_long_long
:u_int128
:char_s
:s_char
:w_char
:short
:int
:long
:long_long
:int128
:float
:double
:long_double
:null_ptr
:overload
:dependent
:obj_c_id
:obj_c_class
:obj_c_sel
:complex
:pointer
:block_pointer
:l_value_reference
:r_value_reference
:record
:enum
:typedef
:obj_c_interface
:obj_c_object_pointer
:function_no_proto
:function_proto
:constant_array

Returns:

  • (Symbol)


2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
# File 'lib/ffi_gen/clang.rb', line 2283

enum :type_kind, [
  :invalid, 0,
  :unexposed, 1,
  :void, 2,
  :bool, 3,
  :char_u, 4,
  :u_char, 5,
  :char16, 6,
  :char32, 7,
  :u_short, 8,
  :u_int, 9,
  :u_long, 10,
  :u_long_long, 11,
  :u_int128, 12,
  :char_s, 13,
  :s_char, 14,
  :w_char, 15,
  :short, 16,
  :int, 17,
  :long, 18,
  :long_long, 19,
  :int128, 20,
  :float, 21,
  :double, 22,
  :long_double, 23,
  :null_ptr, 24,
  :overload, 25,
  :dependent, 26,
  :obj_c_id, 27,
  :obj_c_class, 28,
  :obj_c_sel, 29,
  :complex, 100,
  :pointer, 101,
  :block_pointer, 102,
  :l_value_reference, 103,
  :r_value_reference, 104,
  :record, 105,
  :enum, 106,
  :typedef, 107,
  :obj_c_interface, 108,
  :obj_c_object_pointer, 109,
  :function_no_proto, 110,
  :function_proto, 111,
  :constant_array, 112
]

._enum_visitor_result_Symbol

defgroup CINDEX_HIGH Higher level API functions

@{

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:visitor_result).

Options:

:break
:continue

Returns:

  • (Symbol)


3676
3677
3678
3679
# File 'lib/ffi_gen/clang.rb', line 3676

enum :visitor_result, [
  :break,
  :continue
]

.annotate_tokens(tu, tokens, num_tokens, cursors) ⇒ nil

Annotate the given set of tokens by providing cursors for each token that can be mapped to a specific entity within the abstract syntax tree.

This token-annotation routine is equivalent to invoking clang_getCursor() for the source locations of each of the tokens. The cursors provided are filtered, so that only those cursors that have a direct correspondence to the token are accepted. For example, given a function call c f(x), clang_getCursor() would provide the following cursors:

* when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'.
* when the cursor is over the '(' or the ')', a CallExpr referring to 'f'.
* when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'.

Only the first and last of these cursors will occur within the annotate, since the tokens “f” and “x’ directly refer to a function and a variable, respectively, but the parentheses are just a small part of the full syntax of the function call expression, which is not provided as an annotation.

Parameters:

  • tu (TranslationUnitImpl)

    the translation unit that owns the given tokens.

  • tokens (FFI::Pointer(*Token))

    the set of tokens to annotate.

  • num_tokens (Integer)

    the number of tokens in p Tokens.

  • cursors (FFI::Pointer(*Cursor))

    an array of p NumTokens cursors, whose contents will be replaced with the cursors corresponding to each token.

Returns:

  • (nil)


3034
# File 'lib/ffi_gen/clang.rb', line 3034

attach_function :annotate_tokens, :clang_annotateTokens, [TranslationUnitImpl, :pointer, :uint, :pointer], :void

.code_complete_at(tu, complete_filename, complete_line, complete_column, unsaved_files, num_unsaved_files, options) ⇒ FFI::Pointer(*CodeCompleteResults)

Perform code completion at a given location in a translation unit.

This function performs code completion at a particular file, line, and column within source code, providing results that suggest potential code snippets based on the context of the completion. The basic model for code completion is that Clang will parse a complete source file, performing syntax checking up to the location where code-completion has been requested. At that point, a special code-completion token is passed to the parser, which recognizes this token and determines, based on the current location in the C/Objective-C/C++ grammar and the state of semantic analysis, what completions to provide. These completions are returned via a new c CXCodeCompleteResults structure.

Code completion itself is meant to be triggered by the client when the user types punctuation characters or whitespace, at which point the code-completion location will coincide with the cursor. For example, if c p is a pointer, code-completion might be triggered after the “-” and then after the “>” in c p->. When the code-completion location is afer the “>”, the completion results will provide, e.g., the members of the struct that “p” points to. The client is responsible for placing the cursor at the beginning of the token currently being typed, then filtering the results based on the contents of the token. For example, when code-completing for the expression c p->get, the client should provide the location just after the “>” (e.g., pointing at the “g”) to this code-completion hook. Then, the client can filter the results based on the current token text (“get”), only showing those results that start with “get”. The intent of this interface is to separate the relatively high-latency acquisition of code-completion results from the filtering of results on a per-character basis, which must have a lower latency.

Parameters:

  • tu (TranslationUnitImpl)

    The translation unit in which code-completion should occur. The source files for this translation unit need not be completely up-to-date (and the contents of those source files may be overridden via p unsaved_files). Cursors referring into the translation unit may be invalidated by this invocation.

  • complete_filename (String)

    The name of the source file where code completion should be performed. This filename may be any file included in the translation unit.

  • complete_line (Integer)

    The line at which code-completion should occur.

  • complete_column (Integer)

    The column at which code-completion should occur. Note that the column should point just after the syntactic construct that initiated code completion, and not in the middle of a lexical token.

  • unsaved_files (UnsavedFile)

    the Tiles that have not yet been saved to disk but may be required for parsing or code completion, including the contents of those files. The contents and name of these files (as specified by CXUnsavedFile) are copied when necessary, so the client only needs to guarantee their validity until the call to this function returns.

  • num_unsaved_files (Integer)

    The number of unsaved file entries in p unsaved_files.

  • options (Integer)

    Extra options that control the behavior of code completion, expressed as a bitwise OR of the enumerators of the CXCodeComplete_Flags enumeration. The c clang_defaultCodeCompleteOptions() function returns a default set of code-completion options.

Returns:

  • (FFI::Pointer(*CodeCompleteResults))

    If successful, a new c CXCodeCompleteResults structure containing code-completion results, which should eventually be freed with c clang_disposeCodeCompleteResults(). If code completion fails, returns NULL.



3481
# File 'lib/ffi_gen/clang.rb', line 3481

attach_function :code_complete_at, :clang_codeCompleteAt, [TranslationUnitImpl, :string, :uint, :uint, UnsavedFile, :uint, :uint], :pointer

.code_complete_get_container_kind(results, is_incomplete) ⇒ Symbol from _enum_cursor_kind_

Returns the cursor kind for the container for the current code completion context. The container is only guaranteed to be set for contexts where a container exists (i.e. member accesses or Objective-C message sends); if there is not a container, this function will return CXCursor_InvalidCode.

Parameters:

  • results (FFI::Pointer(*CodeCompleteResults))

    the code completion results to query

  • is_incomplete (FFI::Pointer(*UInt))

    on return, this value will be false if Clang has complete information about the container. If Clang does not have complete information, this value will be true.

Returns:

  • (Symbol from _enum_cursor_kind_)

    the container kind, or CXCursor_InvalidCode if there is not a container



3547
# File 'lib/ffi_gen/clang.rb', line 3547

attach_function :code_complete_get_container_kind, :clang_codeCompleteGetContainerKind, [:pointer, :pointer], :cursor_kind

.code_complete_get_container_usr(results) ⇒ String

Returns the USR for the container for the current code completion context. If there is not a container for the current context, this function will return the empty string.

Parameters:

Returns:

  • (String)

    the USR for the container



3557
# File 'lib/ffi_gen/clang.rb', line 3557

attach_function :code_complete_get_container_usr, :clang_codeCompleteGetContainerUSR, [:pointer], String.by_value

.code_complete_get_contexts(results) ⇒ Integer

Determines what compeltions are appropriate for the context the given code completion.

Parameters:

Returns:

  • (Integer)

    the kinds of completions that are appropriate for use along with the given code completion results.



3531
# File 'lib/ffi_gen/clang.rb', line 3531

attach_function :code_complete_get_contexts, :clang_codeCompleteGetContexts, [:pointer], :ulong_long

.code_complete_get_diagnostic(results, index) ⇒ FFI::Pointer(Diagnostic)

Retrieve a diagnostic associated with the given code completion.

Result: the code completion results to query.

Parameters:

  • results (FFI::Pointer(*CodeCompleteResults))
  • index (Integer)

    the zero-based diagnostic number to retrieve.

Returns:

  • (FFI::Pointer(Diagnostic))

    the requested diagnostic. This diagnostic must be freed via a call to c clang_disposeDiagnostic().



3521
# File 'lib/ffi_gen/clang.rb', line 3521

attach_function :code_complete_get_diagnostic, :clang_codeCompleteGetDiagnostic, [:pointer, :uint], :pointer

.code_complete_get_num_diagnostics(results) ⇒ Integer

Determine the number of diagnostics produced prior to the location where code completion was performed.

Parameters:

Returns:

  • (Integer)


3508
# File 'lib/ffi_gen/clang.rb', line 3508

attach_function :code_complete_get_num_diagnostics, :clang_codeCompleteGetNumDiagnostics, [:pointer], :uint

.code_complete_get_obj_c_selector(results) ⇒ String

Returns the currently-entered selector for an Objective-C message send, formatted like “initWithFoo:bar:”. Only guaranteed to return a non-empty string for CXCompletionContext_ObjCInstanceMessage and CXCompletionContext_ObjCClassMessage.

Parameters:

Returns:

  • (String)

    the selector (or partial selector) that has been entered thus far for an Objective-C message send.



3569
# File 'lib/ffi_gen/clang.rb', line 3569

attach_function :code_complete_get_obj_c_selector, :clang_codeCompleteGetObjCSelector, [:pointer], String.by_value

.construct_usr_obj_c_category(class_name, category_name) ⇒ String

Construct a USR for a specified Objective-C category.

Parameters:

Returns:



2652
# File 'lib/ffi_gen/clang.rb', line 2652

attach_function :construct_usr_obj_c_category, :clang_constructUSR_ObjCCategory, [:string, :string], String.by_value

.construct_usr_obj_c_class(class_name) ⇒ String

Construct a USR for a specified Objective-C class.

Parameters:

Returns:



2643
# File 'lib/ffi_gen/clang.rb', line 2643

attach_function :construct_usr_obj_c_class, :clang_constructUSR_ObjCClass, [:string], String.by_value

.construct_usr_obj_c_ivar(name, class_usr) ⇒ String

Construct a USR for a specified Objective-C instance variable and

the USR for its containing class.

Parameters:

Returns:



2670
# File 'lib/ffi_gen/clang.rb', line 2670

attach_function :construct_usr_obj_c_ivar, :clang_constructUSR_ObjCIvar, [:string, String.by_value], String.by_value

.construct_usr_obj_c_method(name, is_instance_method, class_usr) ⇒ String

Construct a USR for a specified Objective-C method and

the USR for its containing class.

Parameters:

  • name (String)
  • is_instance_method (Integer)
  • class_usr (String)

Returns:



2681
# File 'lib/ffi_gen/clang.rb', line 2681

attach_function :construct_usr_obj_c_method, :clang_constructUSR_ObjCMethod, [:string, :uint, String.by_value], String.by_value

.construct_usr_obj_c_property(property, class_usr) ⇒ String

Construct a USR for a specified Objective-C property and the USR

for its containing class.

Parameters:

Returns:



2691
# File 'lib/ffi_gen/clang.rb', line 2691

attach_function :construct_usr_obj_c_property, :clang_constructUSR_ObjCProperty, [:string, String.by_value], String.by_value

.construct_usr_obj_c_protocol(protocol_name) ⇒ String

Construct a USR for a specified Objective-C protocol.

Parameters:

Returns:



2660
# File 'lib/ffi_gen/clang.rb', line 2660

attach_function :construct_usr_obj_c_protocol, :clang_constructUSR_ObjCProtocol, [:string], String.by_value

.create_cx_cursor_setCursorSetImpl

Creates an empty CXCursorSet.

Returns:



1971
# File 'lib/ffi_gen/clang.rb', line 1971

attach_function :create_cx_cursor_set, :clang_createCXCursorSet, [], CursorSetImpl

.create_index(exclude_declarations_from_pch, display_diagnostics) ⇒ FFI::Pointer(Index)

clang_createIndex() provides a shared context for creating translation units. It provides two options:

  • excludeDeclarationsFromPCH: When non-zero, allows enumeration of “local”

declarations (when loading any new translation units). A “local” declaration is one that belongs in the translation unit itself and not in a precompiled header that was used by the translation unit. If zero, all declarations will be enumerated.

Here is an example:

// excludeDeclsFromPCH = 1, displayDiagnostics=1
Idx = clang_createIndex(1, 1);

// IndexTest.pch was produced with the following command:
// "clang -x c IndexTest.h -emit-ast -o IndexTest.pch"
TU = clang_createTranslationUnit(Idx, "IndexTest.pch");

// This will load all the symbols from 'IndexTest.pch'
clang_visitChildren(clang_getTranslationUnitCursor(TU),
                    TranslationUnitVisitor, 0);
clang_disposeTranslationUnit(TU);

// This will load all the symbols from 'IndexTest.c', excluding symbols
// from 'IndexTest.pch'.
char *args() = { "-Xclang", "-include-pch=IndexTest.pch" };
TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args,
                                               0, 0);
clang_visitChildren(clang_getTranslationUnitCursor(TU),
                    TranslationUnitVisitor, 0);
clang_disposeTranslationUnit(TU);

This process of creating the ‘pch’, loading it separately, and using it (via -include-pch) allows ‘excludeDeclsFromPCH’ to remove redundant callbacks (which gives the indexer the same performance benefit as the compiler).

Parameters:

  • exclude_declarations_from_pch (Integer)
  • display_diagnostics (Integer)

Returns:

  • (FFI::Pointer(Index))


136
# File 'lib/ffi_gen/clang.rb', line 136

attach_function :create_index, :clang_createIndex, [:int, :int], :pointer

.create_translation_unit(index, ast_filename) ⇒ TranslationUnitImpl

Create a translation unit from an AST file (-emit-ast).

Parameters:

  • index (FFI::Pointer(Index))
  • ast_filename (String)

Returns:



705
# File 'lib/ffi_gen/clang.rb', line 705

attach_function :create_translation_unit, :clang_createTranslationUnit, [:pointer, :string], TranslationUnitImpl

.create_translation_unit_from_source_file(c_idx, source_filename, num_clang_command_line_args, command_line_args, num_unsaved_files, unsaved_files) ⇒ TranslationUnitImpl

Return the CXTranslationUnit for a given source file and the provided command line arguments one would pass to the compiler.

Note: The ‘source_filename’ argument is optional. If the caller provides a NULL pointer, the name of the source file is expected to reside in the specified command line arguments.

Note: When encountered in ‘clang_command_line_args’, the following options are ignored:

'-c'
'-emit-ast'
'-fsyntax-only'
'-o <output file>'  (both '-o' and '<output file>' are ignored)

Parameters:

  • c_idx (FFI::Pointer(Index))

    The index object with which the translation unit will be associated.

  • source_filename (String)
    • The name of the source file to load, or NULL if the

    source file is included in p clang_command_line_args.

  • num_clang_command_line_args (Integer)

    The number of command-line arguments in p clang_command_line_args.

  • command_line_args (FFI::Pointer(**Char_S))

    The command-line arguments that would be passed to the c clang executable if it were being invoked out-of-process. These command-line options will be parsed and will affect how the translation unit is parsed. Note that the following options are ignored: ‘-c’, ‘-emit-ast’, ‘-fsyntex-only’ (which is the default), and ‘-o <output file>’.

  • num_unsaved_files (Integer)

    the number of unsaved file entries in p unsaved_files.

  • unsaved_files (UnsavedFile)

    the files that have not yet been saved to disk but may be required for code completion, including the contents of those files. The contents and name of these files (as specified by CXUnsavedFile) are copied when necessary, so the client only needs to guarantee their validity until the call to this function returns.

Returns:



696
# File 'lib/ffi_gen/clang.rb', line 696

attach_function :create_translation_unit_from_source_file, :clang_createTranslationUnitFromSourceFile, [:pointer, :string, :int, :pointer, :uint, UnsavedFile], TranslationUnitImpl

.cursor_get_translation_unit(cursor) ⇒ TranslationUnitImpl

Returns the translation unit that a cursor originated from.

Parameters:

Returns:



1960
# File 'lib/ffi_gen/clang.rb', line 1960

attach_function :cursor_get_translation_unit, :clang_Cursor_getTranslationUnit, [Cursor.by_value], TranslationUnitImpl

.cursor_is_null(cursor) ⇒ Integer

Returns non-zero if arg cursor is null.

Parameters:

Returns:

  • (Integer)


1777
# File 'lib/ffi_gen/clang.rb', line 1777

attach_function :cursor_is_null, :clang_Cursor_isNull, [Cursor.by_value], :int

.cx_cursor_set_contains(cset, cursor) ⇒ Integer

Queries a CXCursorSet to see if it contains a specific CXCursor.

Parameters:

Returns:

  • (Integer)

    non-zero if the set contains the specified cursor.



1988
# File 'lib/ffi_gen/clang.rb', line 1988

attach_function :cx_cursor_set_contains, :clang_CXCursorSet_contains, [CursorSetImpl, Cursor.by_value], :uint

.cx_cursor_set_insert(cset, cursor) ⇒ Integer

Inserts a CXCursor into a CXCursorSet.

Parameters:

Returns:

  • (Integer)

    zero if the CXCursor was already in the set, and non-zero otherwise.



1997
# File 'lib/ffi_gen/clang.rb', line 1997

attach_function :cx_cursor_set_insert, :clang_CXCursorSet_insert, [CursorSetImpl, Cursor.by_value], :uint

.cxx_method_is_static(c) ⇒ Integer

Determine if a C++ member function or member function template is declared ‘static’.

Parameters:

Returns:

  • (Integer)


2805
# File 'lib/ffi_gen/clang.rb', line 2805

attach_function :cxx_method_is_static, :clang_CXXMethod_isStatic, [Cursor.by_value], :uint

.cxx_method_is_virtual(c) ⇒ Integer

Determine if a C++ member function or member function template is explicitly declared ‘virtual’ or if it overrides a virtual method from one of the base classes.

Parameters:

Returns:

  • (Integer)


2815
# File 'lib/ffi_gen/clang.rb', line 2815

attach_function :cxx_method_is_virtual, :clang_CXXMethod_isVirtual, [Cursor.by_value], :uint

.default_code_complete_optionsInteger

Returns a default set of code-completion options that can be passed toc clang_codeCompleteAt().

Returns:

  • (Integer)


3418
# File 'lib/ffi_gen/clang.rb', line 3418

attach_function :default_code_complete_options, :clang_defaultCodeCompleteOptions, [], :uint

.default_diagnostic_display_optionsInteger

Retrieve the set of display options most similar to the default behavior of the clang compiler.

Returns:

  • (Integer)

    A set of display options suitable for use with c clang_displayDiagnostic().



534
# File 'lib/ffi_gen/clang.rb', line 534

attach_function :default_diagnostic_display_options, :clang_defaultDiagnosticDisplayOptions, [], :uint

.default_editing_translation_unit_optionsInteger

Returns the set of flags that is suitable for parsing a translation unit that is being edited.

The set of flags returned provide options for c clang_parseTranslationUnit() to indicate that the translation unit is likely to be reparsed many times, either explicitly (via c clang_reparseTranslationUnit()) or implicitly (e.g., by code completion (c clang_codeCompletionAt())). The returned flag set contains an unspecified set of optimizations (e.g., the precompiled preamble) geared toward improving the performance of these routines. The set of optimizations enabled may change from one version to the next.

Returns:

  • (Integer)


805
# File 'lib/ffi_gen/clang.rb', line 805

attach_function :default_editing_translation_unit_options, :clang_defaultEditingTranslationUnitOptions, [], :uint

.default_reparse_options(tu) ⇒ Integer

Returns the set of flags that is suitable for reparsing a translation unit.

The set of flags returned provide options for c clang_reparseTranslationUnit() by default. The returned flag set contains an unspecified set of optimizations geared toward common uses of reparsing. The set of optimizations enabled may change from one version to the next.

Parameters:

Returns:

  • (Integer)


973
# File 'lib/ffi_gen/clang.rb', line 973

attach_function :default_reparse_options, :clang_defaultReparseOptions, [TranslationUnitImpl], :uint

.default_save_options(tu) ⇒ Integer

Returns the set of flags that is suitable for saving a translation unit.

The set of flags returned provide options for c clang_saveTranslationUnit() by default. The returned flag set contains an unspecified set of options that save translation units with the most commonly-requested data.

Parameters:

Returns:

  • (Integer)


875
# File 'lib/ffi_gen/clang.rb', line 875

attach_function :default_save_options, :clang_defaultSaveOptions, [TranslationUnitImpl], :uint

.dispose_code_complete_results(results) ⇒ nil

Free the given set of code-completion results.

Parameters:

Returns:

  • (nil)


3499
# File 'lib/ffi_gen/clang.rb', line 3499

attach_function :dispose_code_complete_results, :clang_disposeCodeCompleteResults, [:pointer], :void

.dispose_cx_cursor_set(cset) ⇒ nil

Disposes a CXCursorSet and releases its associated memory.

Parameters:

Returns:

  • (nil)


1979
# File 'lib/ffi_gen/clang.rb', line 1979

attach_function :dispose_cx_cursor_set, :clang_disposeCXCursorSet, [CursorSetImpl], :void

.dispose_cxtu_resource_usage(usage) ⇒ nil

(Not documented)

Parameters:

Returns:

  • (nil)


1118
# File 'lib/ffi_gen/clang.rb', line 1118

attach_function :dispose_cxtu_resource_usage, :clang_disposeCXTUResourceUsage, [TUResourceUsage.by_value], :void

.dispose_diagnostic(diagnostic) ⇒ nil

Destroy a diagnostic.

Parameters:

  • diagnostic (FFI::Pointer(Diagnostic))

Returns:

  • (nil)


447
# File 'lib/ffi_gen/clang.rb', line 447

attach_function :dispose_diagnostic, :clang_disposeDiagnostic, [:pointer], :void

.dispose_index(index) ⇒ nil

Destroy the given index.

The index must not be destroyed until all of the translation units created within that index have been destroyed.

Parameters:

  • index (FFI::Pointer(Index))

Returns:

  • (nil)


147
# File 'lib/ffi_gen/clang.rb', line 147

attach_function :dispose_index, :clang_disposeIndex, [:pointer], :void

.dispose_overridden_cursors(overridden) ⇒ nil

Free the set of overridden cursors returned by c clang_getOverriddenCursors().

Parameters:

  • overridden (FFI::Pointer(*Cursor))

Returns:

  • (nil)


2126
# File 'lib/ffi_gen/clang.rb', line 2126

attach_function :dispose_overridden_cursors, :clang_disposeOverriddenCursors, [:pointer], :void

.dispose_string(string) ⇒ nil

Free the given string,

Parameters:

Returns:

  • (nil)


93
# File 'lib/ffi_gen/clang.rb', line 93

attach_function :dispose_string, :clang_disposeString, [String.by_value], :void

.dispose_tokens(tu, tokens, num_tokens) ⇒ nil

Free the given set of tokens.

Parameters:

Returns:

  • (nil)


3044
# File 'lib/ffi_gen/clang.rb', line 3044

attach_function :dispose_tokens, :clang_disposeTokens, [TranslationUnitImpl, :pointer, :uint], :void

.dispose_translation_unit(translation_unit_impl) ⇒ nil

Destroy the specified CXTranslationUnit object.

Parameters:

Returns:

  • (nil)


939
# File 'lib/ffi_gen/clang.rb', line 939

attach_function :dispose_translation_unit, :clang_disposeTranslationUnit, [TranslationUnitImpl], :void

.enable_stack_tracesnil

(Not documented)

Returns:

  • (nil)


3073
# File 'lib/ffi_gen/clang.rb', line 3073

attach_function :enable_stack_traces, :clang_enableStackTraces, [], :void

.equal_cursors(cursor, cursor) ⇒ Integer

Determine whether two cursors are equivalent.

Parameters:

Returns:

  • (Integer)


1769
# File 'lib/ffi_gen/clang.rb', line 1769

attach_function :equal_cursors, :clang_equalCursors, [Cursor.by_value, Cursor.by_value], :uint

.equal_locations(loc1, loc2) ⇒ Integer

Determine whether two source locations, which must refer into the same translation unit, refer to exactly the same point in the source code.

Parameters:

Returns:

  • (Integer)

    non-zero if the source locations refer to the same location, zero if they refer to different locations.



237
# File 'lib/ffi_gen/clang.rb', line 237

attach_function :equal_locations, :clang_equalLocations, [SourceLocation.by_value, SourceLocation.by_value], :uint

.equal_ranges(range1, range2) ⇒ Integer

Determine whether two ranges are equivalent.

Parameters:

Returns:

  • (Integer)

    non-zero if the ranges are the same, zero if they differ.



286
# File 'lib/ffi_gen/clang.rb', line 286

attach_function :equal_ranges, :clang_equalRanges, [SourceRange.by_value, SourceRange.by_value], :uint

.equal_types(a, b) ⇒ Integer

Determine whether two CXTypes represent the same type.

Parameters:

Returns:

  • (Integer)

    non-zero if the CXTypes represent the same type and zero otherwise.



2357
# File 'lib/ffi_gen/clang.rb', line 2357

attach_function :equal_types, :clang_equalTypes, [Type.by_value, Type.by_value], :uint

.execute_on_thread(fn, user_data, stack_size) ⇒ nil

(Not documented)

Parameters:

  • fn (FFI::Pointer(*))
  • user_data (FFI::Pointer(*Void))
  • stack_size (Integer)

Returns:

  • (nil)


3083
# File 'lib/ffi_gen/clang.rb', line 3083

attach_function :execute_on_thread, :clang_executeOnThread, [:pointer, :pointer, :uint], :void

.find_references_in_file(cursor, file, visitor) ⇒ nil

Find references of a declaration in a specific file.

Parameters:

  • cursor (Cursor)

    pointing to a declaration or a reference of one.

  • file (FFI::Pointer(File))

    to search for references.

  • visitor (CursorAndRangeVisitor)

    callback that will receive pairs of CXCursor/CXSourceRange for each reference found. The CXSourceRange will point inside the file; if the reference is inside a macro (and not a macro argument) the CXSourceRange will be invalid.

Returns:

  • (nil)


3706
# File 'lib/ffi_gen/clang.rb', line 3706

attach_function :find_references_in_file, :clang_findReferencesInFile, [Cursor.by_value, :pointer, CursorAndRangeVisitor.by_value], :void

.format_diagnostic(diagnostic, options) ⇒ String

Format the given diagnostic in a manner that is suitable for display.

This routine will format the given diagnostic to a string, rendering the diagnostic according to the various options given. The c clang_defaultDiagnosticDisplayOptions() function returns the set of options that most closely mimics the behavior of the clang compiler.

Parameters:

  • diagnostic (FFI::Pointer(Diagnostic))

    The diagnostic to print.

  • options (Integer)

    A set of options that control the diagnostic display, created by combining c CXDiagnosticDisplayOptions values.

Returns:

  • (String)

    A new string containing for formatted diagnostic.



525
# File 'lib/ffi_gen/clang.rb', line 525

attach_function :format_diagnostic, :clang_formatDiagnostic, [:pointer, :uint], String.by_value

.get_array_element_type(t) ⇒ Type

Return the element type of an array type.

If a non-array type is passed in, an invalid type is returned.

Parameters:

Returns:



2465
# File 'lib/ffi_gen/clang.rb', line 2465

attach_function :get_array_element_type, :clang_getArrayElementType, [Type.by_value], Type.by_value

.get_array_size(t) ⇒ Integer

Return the the array size of a constant array.

If a non-array type is passed in, -1 is returned.

Parameters:

Returns:

  • (Integer)


2475
# File 'lib/ffi_gen/clang.rb', line 2475

attach_function :get_array_size, :clang_getArraySize, [Type.by_value], :long_long

.get_c_string(string) ⇒ String

Retrieve the character data associated with the given string.

Parameters:

Returns:



85
# File 'lib/ffi_gen/clang.rb', line 85

attach_function :get_c_string, :clang_getCString, [String.by_value], :string

.get_canonical_cursor(cursor) ⇒ Cursor

Retrieve the canonical cursor corresponding to the given cursor.

In the C family of languages, many kinds of entities can be declared several times within a single translation unit. For example, a structure type can be forward-declared (possibly multiple times) and later defined:

code struct X; struct X; struct X

int member;

; endcode

The declarations and the definition of c X are represented by three different cursors, all of which are declarations of the same underlying entity. One of these cursor is considered the “canonical” cursor, which is effectively the representative for the underlying entity. One can determine if two cursors are declarations of the same underlying entity by comparing their canonical cursors.

Parameters:

Returns:

  • (Cursor)

    The canonical cursor for the entity referred to by the given cursor.



2796
# File 'lib/ffi_gen/clang.rb', line 2796

attach_function :get_canonical_cursor, :clang_getCanonicalCursor, [Cursor.by_value], Cursor.by_value

.get_canonical_type(t) ⇒ Type

Return the canonical type for a CXType.

Clang’s type system explicitly models typedefs and all the ways a specific type can be represented. The canonical type is the underlying type with all the “sugar” removed. For example, if ‘T’ is a typedef for ‘int’, the canonical type for ‘T’ would be ‘int’.

Parameters:

Returns:



2370
# File 'lib/ffi_gen/clang.rb', line 2370

attach_function :get_canonical_type, :clang_getCanonicalType, [Type.by_value], Type.by_value

.get_clang_versionString

Return a version string, suitable for showing to a user, but not

intended to be parsed (the format is not guaranteed to be stable).

Returns:



3577
# File 'lib/ffi_gen/clang.rb', line 3577

attach_function :get_clang_version, :clang_getClangVersion, [], String.by_value

.get_completion_annotation(completion_string, annotation_number) ⇒ String

Retrieve the annotation associated with the given completion string.

Parameters:

  • completion_string (FFI::Pointer(CompletionString))

    the completion string to query.

  • annotation_number (Integer)

    the 0-based index of the annotation of the completion string.

Returns:

  • (String)

    annotation string associated with the completion at index c annotation_number, or a NULL string if that annotation is not available.



3340
# File 'lib/ffi_gen/clang.rb', line 3340

attach_function :get_completion_annotation, :clang_getCompletionAnnotation, [:pointer, :uint], String.by_value

.get_completion_availability(completion_string) ⇒ Symbol from _enum_availability_kind_

Determine the availability of the entity that this code-completion string refers to.

Parameters:

  • completion_string (FFI::Pointer(CompletionString))

    The completion string to query.

Returns:



3319
# File 'lib/ffi_gen/clang.rb', line 3319

attach_function :get_completion_availability, :clang_getCompletionAvailability, [:pointer], :availability_kind

.get_completion_chunk_completion_string(completion_string, chunk_number) ⇒ FFI::Pointer(CompletionString)

Retrieve the completion string associated with a particular chunk within a completion string.

Parameters:

  • completion_string (FFI::Pointer(CompletionString))

    the completion string to query.

  • chunk_number (Integer)

    the 0-based index of the chunk in the completion string.

Returns:

  • (FFI::Pointer(CompletionString))

    the completion string associated with the chunk at index c chunk_number.



3289
# File 'lib/ffi_gen/clang.rb', line 3289

attach_function :get_completion_chunk_completion_string, :clang_getCompletionChunkCompletionString, [:pointer, :uint], :pointer

.get_completion_chunk_kind(completion_string, chunk_number) ⇒ Symbol from _enum_completion_chunk_kind_

Determine the kind of a particular chunk within a completion string.

Parameters:

  • completion_string (FFI::Pointer(CompletionString))

    the completion string to query.

  • chunk_number (Integer)

    the 0-based index of the chunk in the completion string.

Returns:



3268
# File 'lib/ffi_gen/clang.rb', line 3268

attach_function :get_completion_chunk_kind, :clang_getCompletionChunkKind, [:pointer, :uint], :completion_chunk_kind

.get_completion_chunk_text(completion_string, chunk_number) ⇒ String

Retrieve the text associated with a particular chunk within a completion string.

Parameters:

  • completion_string (FFI::Pointer(CompletionString))

    the completion string to query.

  • chunk_number (Integer)

    the 0-based index of the chunk in the completion string.

Returns:

  • (String)

    the text associated with the chunk at index c chunk_number.



3278
# File 'lib/ffi_gen/clang.rb', line 3278

attach_function :get_completion_chunk_text, :clang_getCompletionChunkText, [:pointer, :uint], String.by_value

.get_completion_num_annotations(completion_string) ⇒ Integer

Retrieve the number of annotations associated with the given completion string.

Parameters:

  • completion_string (FFI::Pointer(CompletionString))

    the completion string to query.

Returns:

  • (Integer)

    the number of annotations associated with the given completion string.



3329
# File 'lib/ffi_gen/clang.rb', line 3329

attach_function :get_completion_num_annotations, :clang_getCompletionNumAnnotations, [:pointer], :uint

.get_completion_priority(completion_string) ⇒ Integer

Determine the priority of this code completion.

The priority of a code completion indicates how likely it is that this particular completion is the completion that the user will select. The priority is selected by various internal heuristics.

Parameters:

  • completion_string (FFI::Pointer(CompletionString))

    The completion string to query.

Returns:

  • (Integer)

    The priority of this completion string. Smaller values indicate higher-priority (more likely) completions.



3310
# File 'lib/ffi_gen/clang.rb', line 3310

attach_function :get_completion_priority, :clang_getCompletionPriority, [:pointer], :uint

.get_cursor(translation_unit_impl, source_location) ⇒ Cursor

Map a source location to the cursor that describes the entity at that location in the source code.

clang_getCursor() maps an arbitrary source location within a translation unit down to the most specific cursor that describes the entity at that location. For example, given an expression c x + y, invoking clang_getCursor() with a source location pointing to “x” will return the cursor for “x”; similarly for “y”. If the cursor points anywhere between “x” or “y” (e.g., on the + or the whitespace around it), clang_getCursor() will return a cursor referring to the “+” expression.

Parameters:

Returns:

  • (Cursor)

    a cursor representing the entity at the given source location, or a NULL cursor if no such entity can be found.



2154
# File 'lib/ffi_gen/clang.rb', line 2154

attach_function :get_cursor, :clang_getCursor, [TranslationUnitImpl, SourceLocation.by_value], Cursor.by_value

.get_cursor_availability(cursor) ⇒ Symbol from _enum_availability_kind_

Determine the availability of the entity that this cursor refers to.

Parameters:

  • cursor (Cursor)

    The cursor to query.

Returns:



1920
# File 'lib/ffi_gen/clang.rb', line 1920

attach_function :get_cursor_availability, :clang_getCursorAvailability, [Cursor.by_value], :availability_kind

.get_cursor_completion_string(cursor) ⇒ FFI::Pointer(CompletionString)

Retrieve a completion string for an arbitrary declaration or macro definition cursor.

Parameters:

  • cursor (Cursor)

    The cursor to query.

Returns:

  • (FFI::Pointer(CompletionString))

    A non-context-sensitive completion string for declaration and macro definition cursors, or NULL for other kinds of cursors.



3350
# File 'lib/ffi_gen/clang.rb', line 3350

attach_function :get_cursor_completion_string, :clang_getCursorCompletionString, [Cursor.by_value], :pointer

.get_cursor_definition(cursor) ⇒ Cursor

For a cursor that is either a reference to or a declaration

of some entity, retrieve a cursor that describes the definition of
that entity.

Some entities can be declared multiple times within a translation
unit, but only one of those declarations can also be a
definition. For example, given:

\code
int f(int, int);
int g(int x, int y) { return f(x, y); }
int f(int a, int b) { return a + b; }
int f(int, int);
\endcode

there are three declarations of the function "f", but only the
second one is a definition. The clang_getCursorDefinition()
function will take any cursor pointing to a declaration of "f"
(the first or fourth lines of the example) or a cursor referenced
that uses "f" (the call to "f' inside "g") and will return a
declaration cursor pointing to the definition (the second "f"
declaration).

If given a cursor for which there is no corresponding definition,
e.g., because there is no definition of that entity within this
translation unit, returns a NULL cursor.

Parameters:

Returns:



2760
# File 'lib/ffi_gen/clang.rb', line 2760

attach_function :get_cursor_definition, :clang_getCursorDefinition, [Cursor.by_value], Cursor.by_value

.get_cursor_display_name(cursor) ⇒ String

Retrieve the display name for the entity referenced by this cursor.

The display name contains extra information that helps identify the cursor, such as the parameters of a function or template or the arguments of a class template specialization.

Parameters:

Returns:



2711
# File 'lib/ffi_gen/clang.rb', line 2711

attach_function :get_cursor_display_name, :clang_getCursorDisplayName, [Cursor.by_value], String.by_value

.get_cursor_extent(cursor) ⇒ SourceRange

Retrieve the physical extent of the source construct referenced by the given cursor.

The extent of a cursor starts with the file/line/column pointing at the first character within the source construct that the cursor refers to and ends with the last character withinin that source construct. For a declaration, the extent covers the declaration itself. For a reference, the extent covers the location of the reference (e.g., where the referenced entity was actually used).

Parameters:

Returns:



2185
# File 'lib/ffi_gen/clang.rb', line 2185

attach_function :get_cursor_extent, :clang_getCursorExtent, [Cursor.by_value], SourceRange.by_value

.get_cursor_kind(cursor) ⇒ Symbol from _enum_cursor_kind_

Retrieve the kind of the given cursor.

Parameters:

Returns:



1793
# File 'lib/ffi_gen/clang.rb', line 1793

attach_function :get_cursor_kind, :clang_getCursorKind, [Cursor.by_value], :cursor_kind

.get_cursor_kind_spelling(kind) ⇒ String

for debug/testing

Parameters:

Returns:



3052
# File 'lib/ffi_gen/clang.rb', line 3052

attach_function :get_cursor_kind_spelling, :clang_getCursorKindSpelling, [:cursor_kind], String.by_value

.get_cursor_language(cursor) ⇒ Symbol from _enum_language_kind_

Determine the “language” of the entity referred to by a given cursor.

Parameters:

Returns:



1952
# File 'lib/ffi_gen/clang.rb', line 1952

attach_function :get_cursor_language, :clang_getCursorLanguage, [Cursor.by_value], :language_kind

.get_cursor_lexical_parent(cursor) ⇒ Cursor

Determine the lexical parent of the given cursor.

The lexical parent of a cursor is the cursor in which the given p cursor was actually written. For many declarations, the lexical and semantic parents are equivalent (the semantic parent is returned by c clang_getCursorSemanticParent()). They diverge when declarations or definitions are provided out-of-line. For example:

code class C

void f();

;

void C::f() { } endcode

In the out-of-line definition of c C::f, the semantic parent is the the class c C, of which this function is a member. The lexical parent is the place where the declaration actually occurs in the source code; in this case, the definition occurs in the translation unit. In general, the lexical parent for a given entity can change without affecting the semantics of the program, and the lexical parent of different declarations of the same entity may be different. Changing the semantic parent of a declaration, on the other hand, can have a major impact on semantics, and redeclarations of a particular entity should all have the same semantic context.

In the example above, both declarations of c C::f have c C as their semantic context, while the lexical context of the first c C::f is c C and the lexical context of the second c C::f is the translation unit.

For declarations written in the global scope, the lexical parent is the translation unit.

Parameters:

Returns:



2074
# File 'lib/ffi_gen/clang.rb', line 2074

attach_function :get_cursor_lexical_parent, :clang_getCursorLexicalParent, [Cursor.by_value], Cursor.by_value

.get_cursor_linkage(cursor) ⇒ Symbol from _enum_linkage_kind_

Determine the linkage of the entity referred to by a given cursor.

Parameters:

Returns:



1912
# File 'lib/ffi_gen/clang.rb', line 1912

attach_function :get_cursor_linkage, :clang_getCursorLinkage, [Cursor.by_value], :linkage_kind

.get_cursor_location(cursor) ⇒ SourceLocation

Retrieve the physical location of the source constructor referenced by the given cursor.

The location of a declaration is typically the location of the name of that declaration, where the name of that declaration would occur if it is unnamed, or some keyword that introduces that particular declaration. The location of a reference is where that reference occurs within the source code.

Parameters:

Returns:



2169
# File 'lib/ffi_gen/clang.rb', line 2169

attach_function :get_cursor_location, :clang_getCursorLocation, [Cursor.by_value], SourceLocation.by_value

.get_cursor_reference_name_range(c, name_flags, piece_index) ⇒ SourceRange

Given a cursor that references something else, return the source range covering that reference.

Parameters:

  • c (Cursor)

    A cursor pointing to a member reference, a declaration reference, or an operator call.

  • name_flags (Integer)

    A bitset with three independent flags: CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and CXNameRange_WantSinglePiece.

  • piece_index (Integer)

    For contiguous names or when passing the flag CXNameRange_WantSinglePiece, only one piece with index 0 is available. When the CXNameRange_WantSinglePiece flag is not passed for a non-contiguous names, this index can be used to retreive the individual pieces of the name. See also CXNameRange_WantSinglePiece.

Returns:

  • (SourceRange)

    The piece of the name pointed to by the given cursor. If there is no name, or if the PieceIndex is out-of-range, a null-cursor will be returned.



2881
# File 'lib/ffi_gen/clang.rb', line 2881

attach_function :get_cursor_reference_name_range, :clang_getCursorReferenceNameRange, [Cursor.by_value, :uint, :uint], SourceRange.by_value

.get_cursor_referenced(cursor) ⇒ Cursor

For a cursor that is a reference, retrieve a cursor representing the entity that it references.

Reference cursors refer to other entities in the AST. For example, an Objective-C superclass reference cursor refers to an Objective-C class. This function produces the cursor for the Objective-C class from the cursor for the superclass reference. If the input cursor is a declaration or definition, it returns that declaration or definition unchanged. Otherwise, returns the NULL cursor.

Parameters:

Returns:



2727
# File 'lib/ffi_gen/clang.rb', line 2727

attach_function :get_cursor_referenced, :clang_getCursorReferenced, [Cursor.by_value], Cursor.by_value

.get_cursor_result_type(c) ⇒ Type

Retrieve the result type associated with a given cursor. This only

returns a valid type of the cursor refers to a function or method.

Parameters:

Returns:



2446
# File 'lib/ffi_gen/clang.rb', line 2446

attach_function :get_cursor_result_type, :clang_getCursorResultType, [Cursor.by_value], Type.by_value

.get_cursor_semantic_parent(cursor) ⇒ Cursor

Determine the semantic parent of the given cursor.

The semantic parent of a cursor is the cursor that semantically contains the given p cursor. For many declarations, the lexical and semantic parents are equivalent (the lexical parent is returned by c clang_getCursorLexicalParent()). They diverge when declarations or definitions are provided out-of-line. For example:

code class C

void f();

;

void C::f() { } endcode

In the out-of-line definition of c C::f, the semantic parent is the the class c C, of which this function is a member. The lexical parent is the place where the declaration actually occurs in the source code; in this case, the definition occurs in the translation unit. In general, the lexical parent for a given entity can change without affecting the semantics of the program, and the lexical parent of different declarations of the same entity may be different. Changing the semantic parent of a declaration, on the other hand, can have a major impact on semantics, and redeclarations of a particular entity should all have the same semantic context.

In the example above, both declarations of c C::f have c C as their semantic context, while the lexical context of the first c C::f is c C and the lexical context of the second c C::f is the translation unit.

For global declarations, the semantic parent is the translation unit.

Parameters:

Returns:



2035
# File 'lib/ffi_gen/clang.rb', line 2035

attach_function :get_cursor_semantic_parent, :clang_getCursorSemanticParent, [Cursor.by_value], Cursor.by_value

.get_cursor_spelling(cursor) ⇒ String

Retrieve a name for the entity referenced by this cursor.

Parameters:

Returns:



2699
# File 'lib/ffi_gen/clang.rb', line 2699

attach_function :get_cursor_spelling, :clang_getCursorSpelling, [Cursor.by_value], String.by_value

.get_cursor_type(c) ⇒ Type

Retrieve the type of a CXCursor (if any).

Parameters:

Returns:



2347
# File 'lib/ffi_gen/clang.rb', line 2347

attach_function :get_cursor_type, :clang_getCursorType, [Cursor.by_value], Type.by_value

.get_cursor_usr(cursor) ⇒ String

Retrieve a Unified Symbol Resolution (USR) for the entity referenced by the given cursor.

A Unified Symbol Resolution (USR) is a string that identifies a particular entity (function, class, variable, etc.) within a program. USRs can be compared across translation units to determine, e.g., when references in one translation refer to an entity defined in another translation unit.

Parameters:

Returns:



2635
# File 'lib/ffi_gen/clang.rb', line 2635

attach_function :get_cursor_usr, :clang_getCursorUSR, [Cursor.by_value], String.by_value

.get_cxtu_resource_usage(tu) ⇒ TUResourceUsage

Return the memory usage of a translation unit. This object

should be released with clang_disposeCXTUResourceUsage().

Parameters:

Returns:



1110
# File 'lib/ffi_gen/clang.rb', line 1110

attach_function :get_cxtu_resource_usage, :clang_getCXTUResourceUsage, [TranslationUnitImpl], TUResourceUsage.by_value

.get_cxx_access_specifier(cursor) ⇒ Symbol from _enum_cxx_access_specifier_

Returns the access control level for the C++ base specifier represented by a cursor with kind CXCursor_CXXBaseSpecifier or CXCursor_AccessSpecifier.

Parameters:

Returns:



2519
# File 'lib/ffi_gen/clang.rb', line 2519

attach_function :get_cxx_access_specifier, :clang_getCXXAccessSpecifier, [Cursor.by_value], :cxx_access_specifier

.get_decl_obj_c_type_encoding(c) ⇒ String

Returns the Objective-C type encoding for the specified declaration.

Parameters:

Returns:



2421
# File 'lib/ffi_gen/clang.rb', line 2421

attach_function :get_decl_obj_c_type_encoding, :clang_getDeclObjCTypeEncoding, [Cursor.by_value], String.by_value

.get_definition_spelling_and_extent(cursor, start_buf, end_buf, start_line, start_column, end_line, end_column) ⇒ nil

(Not documented)

Parameters:

  • cursor (Cursor)
  • start_buf (FFI::Pointer(**Char_S))
  • end_buf (FFI::Pointer(**Char_S))
  • start_line (FFI::Pointer(*UInt))
  • start_column (FFI::Pointer(*UInt))
  • end_line (FFI::Pointer(*UInt))
  • end_column (FFI::Pointer(*UInt))

Returns:

  • (nil)


3066
# File 'lib/ffi_gen/clang.rb', line 3066

attach_function :get_definition_spelling_and_extent, :clang_getDefinitionSpellingAndExtent, [Cursor.by_value, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer], :void

.get_diagnostic(unit, index) ⇒ FFI::Pointer(Diagnostic)

Retrieve a diagnostic associated with the given translation unit.

Parameters:

  • unit (TranslationUnitImpl)

    the translation unit to query.

  • index (Integer)

    the zero-based diagnostic number to retrieve.

Returns:

  • (FFI::Pointer(Diagnostic))

    the requested diagnostic. This diagnostic must be freed via a call to c clang_disposeDiagnostic().



439
# File 'lib/ffi_gen/clang.rb', line 439

attach_function :get_diagnostic, :clang_getDiagnostic, [TranslationUnitImpl, :uint], :pointer

.get_diagnostic_category(diagnostic) ⇒ Integer

Retrieve the category number for this diagnostic.

Diagnostics can be categorized into groups along with other, related diagnostics (e.g., diagnostics under the same warning flag). This routine retrieves the category number for the given diagnostic.

Parameters:

  • diagnostic (FFI::Pointer(Diagnostic))

Returns:

  • (Integer)

    The number of the category that contains this diagnostic, or zero if this diagnostic is uncategorized.



586
# File 'lib/ffi_gen/clang.rb', line 586

attach_function :get_diagnostic_category, :clang_getDiagnosticCategory, [:pointer], :uint

.get_diagnostic_category_name(category) ⇒ String

Retrieve the name of a particular diagnostic category.

Parameters:

  • category (Integer)

    A diagnostic category number, as returned by c clang_getDiagnosticCategory().

Returns:

  • (String)

    The name of the given diagnostic category.



595
# File 'lib/ffi_gen/clang.rb', line 595

attach_function :get_diagnostic_category_name, :clang_getDiagnosticCategoryName, [:uint], String.by_value

.get_diagnostic_fix_it(diagnostic, fix_it, replacement_range) ⇒ String

Retrieve the replacement information for a given fix-it.

Fix-its are described in terms of a source range whose contents should be replaced by a string. This approach generalizes over three kinds of operations: removal of source code (the range covers the code to be removed and the replacement string is empty), replacement of source code (the range covers the code to be replaced and the replacement string provides the new code), and insertion (both the start and end of the range point at the insertion location, and the replacement string provides the text to insert).

Parameters:

  • diagnostic (FFI::Pointer(Diagnostic))

    The diagnostic whose fix-its are being queried.

  • fix_it (Integer)

    The zero-based index of the fix-it.

  • replacement_range (FFI::Pointer(*SourceRange))

    The source range whose contents will be replaced with the returned replacement string. Note that source ranges are half-open ranges (a, b), so the source code should be replaced from a and up to (but not including) b.

Returns:

  • (String)

    A string containing text that should be replace the source code indicated by the c ReplacementRange.



650
# File 'lib/ffi_gen/clang.rb', line 650

attach_function :get_diagnostic_fix_it, :clang_getDiagnosticFixIt, [:pointer, :uint, :pointer], String.by_value

.get_diagnostic_location(diagnostic) ⇒ SourceLocation

Retrieve the source location of the given diagnostic.

This location is where Clang would print the caret (‘^’) when displaying the diagnostic on the command line.

Parameters:

  • diagnostic (FFI::Pointer(Diagnostic))

Returns:



553
# File 'lib/ffi_gen/clang.rb', line 553

attach_function :get_diagnostic_location, :clang_getDiagnosticLocation, [:pointer], SourceLocation.by_value

.get_diagnostic_num_fix_its(diagnostic) ⇒ Integer

Determine the number of fix-it hints associated with the given diagnostic.

Parameters:

  • diagnostic (FFI::Pointer(Diagnostic))

Returns:

  • (Integer)


626
# File 'lib/ffi_gen/clang.rb', line 626

attach_function :get_diagnostic_num_fix_its, :clang_getDiagnosticNumFixIts, [:pointer], :uint

.get_diagnostic_num_ranges(diagnostic) ⇒ Integer

Determine the number of source ranges associated with the given diagnostic.

Parameters:

  • diagnostic (FFI::Pointer(Diagnostic))

Returns:

  • (Integer)


604
# File 'lib/ffi_gen/clang.rb', line 604

attach_function :get_diagnostic_num_ranges, :clang_getDiagnosticNumRanges, [:pointer], :uint

.get_diagnostic_option(diag, disable) ⇒ String

Retrieve the name of the command-line option that enabled this diagnostic.

Parameters:

  • diag (FFI::Pointer(Diagnostic))

    The diagnostic to be queried.

  • disable (FFI::Pointer(*String))

    If non-NULL, will be set to the option that disables this diagnostic (if any).

Returns:

  • (String)

    A string that contains the command-line option used to enable this warning, such as “-Wconversion” or “-pedantic”.



573
# File 'lib/ffi_gen/clang.rb', line 573

attach_function :get_diagnostic_option, :clang_getDiagnosticOption, [:pointer, :pointer], String.by_value

.get_diagnostic_range(diagnostic, range) ⇒ SourceRange

Retrieve a source range associated with the diagnostic.

A diagnostic’s source ranges highlight important elements in the source code. On the command line, Clang displays source ranges by underlining them with ‘~’ characters.

Parameters:

  • diagnostic (FFI::Pointer(Diagnostic))

    the diagnostic whose range is being extracted.

  • range (Integer)

    the zero-based index specifying which range to

Returns:



617
# File 'lib/ffi_gen/clang.rb', line 617

attach_function :get_diagnostic_range, :clang_getDiagnosticRange, [:pointer, :uint], SourceRange.by_value

.get_diagnostic_severity(diagnostic) ⇒ Symbol from _enum_diagnostic_severity_

Determine the severity of the given diagnostic.

Parameters:

  • diagnostic (FFI::Pointer(Diagnostic))

Returns:



542
# File 'lib/ffi_gen/clang.rb', line 542

attach_function :get_diagnostic_severity, :clang_getDiagnosticSeverity, [:pointer], :diagnostic_severity

.get_diagnostic_spelling(diagnostic) ⇒ String

Retrieve the text of the given diagnostic.

Parameters:

  • diagnostic (FFI::Pointer(Diagnostic))

Returns:



561
# File 'lib/ffi_gen/clang.rb', line 561

attach_function :get_diagnostic_spelling, :clang_getDiagnosticSpelling, [:pointer], String.by_value

.get_file(tu, file_name) ⇒ FFI::Pointer(File)

Retrieve a file handle within the given translation unit.

Parameters:

Returns:

  • (FFI::Pointer(File))

    the file handle for the named file in the translation unit p tu, or a NULL file handle if the file was not a part of this translation unit.



184
# File 'lib/ffi_gen/clang.rb', line 184

attach_function :get_file, :clang_getFile, [TranslationUnitImpl, :string], :pointer

.get_file_name(s_file) ⇒ String

Retrieve the complete file and path name of the given file.

Parameters:

  • s_file (FFI::Pointer(File))

Returns:



155
# File 'lib/ffi_gen/clang.rb', line 155

attach_function :get_file_name, :clang_getFileName, [:pointer], String.by_value

.get_file_time(s_file) ⇒ Integer

Retrieve the last modification time of the given file.

Parameters:

  • s_file (FFI::Pointer(File))

Returns:

  • (Integer)


163
# File 'lib/ffi_gen/clang.rb', line 163

attach_function :get_file_time, :clang_getFileTime, [:pointer], :long

.get_ib_outlet_collection_type(cursor) ⇒ Type

For cursors representing an iboutletcollection attribute,

this function returns the collection element type.

Parameters:

Returns:



2552
# File 'lib/ffi_gen/clang.rb', line 2552

attach_function :get_ib_outlet_collection_type, :clang_getIBOutletCollectionType, [Cursor.by_value], Type.by_value

.get_included_file(cursor) ⇒ FFI::Pointer(File)

Retrieve the file that is included by the given inclusion directive cursor.

Parameters:

Returns:

  • (FFI::Pointer(File))


2135
# File 'lib/ffi_gen/clang.rb', line 2135

attach_function :get_included_file, :clang_getIncludedFile, [Cursor.by_value], :pointer

.get_inclusions(tu, visitor, client_data) ⇒ nil

Visit the set of preprocessor inclusions in a translation unit.

The visitor function is called with the provided data for every included
file.  This does not include headers included by the PCH file (unless one
is inspecting the inclusions in the PCH file itself).

Parameters:

Returns:

  • (nil)


3622
# File 'lib/ffi_gen/clang.rb', line 3622

attach_function :get_inclusions, :clang_getInclusions, [TranslationUnitImpl, :inclusion_visitor, :pointer], :void

.get_instantiation_location(location, file, line, column, offset) ⇒ nil

Legacy API to retrieve the file, line, column, and offset represented by the given source location.

This interface has been replaced by the newer interface see clang_getExpansionLocation(). See that interface’s documentation for details.

Parameters:

  • location (SourceLocation)
  • file (FFI::Pointer(*File))
  • line (FFI::Pointer(*UInt))
  • column (FFI::Pointer(*UInt))
  • offset (FFI::Pointer(*UInt))

Returns:

  • (nil)


349
# File 'lib/ffi_gen/clang.rb', line 349

attach_function :get_instantiation_location, :clang_getInstantiationLocation, [SourceLocation.by_value, :pointer, :pointer, :pointer, :pointer], :void

.get_location(tu, file, line, column) ⇒ SourceLocation

Retrieves the source location associated with a given file/line/column in a particular translation unit.

Parameters:

Returns:



249
# File 'lib/ffi_gen/clang.rb', line 249

attach_function :get_location, :clang_getLocation, [TranslationUnitImpl, :pointer, :uint, :uint], SourceLocation.by_value

.get_location_for_offset(tu, file, offset) ⇒ SourceLocation

Retrieves the source location associated with a given character offset in a particular translation unit.

Parameters:

Returns:



260
# File 'lib/ffi_gen/clang.rb', line 260

attach_function :get_location_for_offset, :clang_getLocationForOffset, [TranslationUnitImpl, :pointer, :uint], SourceLocation.by_value

.get_null_cursorCursor

Retrieve the NULL cursor, which represents no entity.

Returns:



1749
# File 'lib/ffi_gen/clang.rb', line 1749

attach_function :get_null_cursor, :clang_getNullCursor, [], Cursor.by_value

.get_null_locationSourceLocation

Retrieve a NULL (invalid) source location.

Returns:



225
# File 'lib/ffi_gen/clang.rb', line 225

attach_function :get_null_location, :clang_getNullLocation, [], SourceLocation.by_value

.get_null_rangeSourceRange

Retrieve a NULL (invalid) source range.

Returns:



267
# File 'lib/ffi_gen/clang.rb', line 267

attach_function :get_null_range, :clang_getNullRange, [], SourceRange.by_value

.get_num_completion_chunks(completion_string) ⇒ Integer

Retrieve the number of chunks in the given code-completion string.

Parameters:

  • completion_string (FFI::Pointer(CompletionString))

Returns:

  • (Integer)


3297
# File 'lib/ffi_gen/clang.rb', line 3297

attach_function :get_num_completion_chunks, :clang_getNumCompletionChunks, [:pointer], :uint

.get_num_diagnostics(unit) ⇒ Integer

Determine the number of diagnostics produced for the given translation unit.

Parameters:

Returns:

  • (Integer)


429
# File 'lib/ffi_gen/clang.rb', line 429

attach_function :get_num_diagnostics, :clang_getNumDiagnostics, [TranslationUnitImpl], :uint

.get_num_overloaded_decls(cursor) ⇒ Integer

Determine the number of overloaded declarations referenced by a c CXCursor_OverloadedDeclRef cursor.

Parameters:

  • cursor (Cursor)

    The cursor whose overloaded declarations are being queried.

Returns:

  • (Integer)

    The number of overloaded declarations referenced by c cursor. If it is not a c CXCursor_OverloadedDeclRef cursor, returns 0.



2529
# File 'lib/ffi_gen/clang.rb', line 2529

attach_function :get_num_overloaded_decls, :clang_getNumOverloadedDecls, [Cursor.by_value], :uint

.get_overloaded_decl(cursor, index) ⇒ Cursor

Retrieve a cursor for one of the overloaded declarations referenced by a c CXCursor_OverloadedDeclRef cursor.

Parameters:

  • cursor (Cursor)

    The cursor whose overloaded declarations are being queried.

  • index (Integer)

    The zero-based index into the set of overloaded declarations in the cursor.

Returns:

  • (Cursor)

    A cursor representing the declaration referenced by the given c cursor at the specified c index. If the cursor does not have an associated set of overloaded declarations, or if the index is out of bounds, returns c clang_getNullCursor();



2543
# File 'lib/ffi_gen/clang.rb', line 2543

attach_function :get_overloaded_decl, :clang_getOverloadedDecl, [Cursor.by_value, :uint], Cursor.by_value

.get_overridden_cursors(cursor, overridden, num_overridden) ⇒ nil

Determine the set of methods that are overridden by the given method.

In both Objective-C and C++, a method (aka virtual member function, in C++) can override a virtual method in a base class. For Objective-C, a method is said to override any method in the class’s interface (if we’re coming from an implementation), its protocols, or its categories, that has the same selector and is of the same kind (class or instance). If no such method exists, the search continues to the class’s superclass, its protocols, and its categories, and so on.

For C++, a virtual member function overrides any virtual member function with the same signature that occurs in its base classes. With multiple inheritance, a virtual member function can override several virtual member functions coming from different base classes.

In all cases, this function determines the immediate overridden method, rather than all of the overridden methods. For example, if a method is originally declared in a class A, then overridden in B (which in inherits from A) and also in C (which inherited from B), then the only overridden method returned from this function when invoked on C’s method will be B’s method. The client may then invoke this function again, given the previously-found overridden methods, to map out the complete method-override set.

Parameters:

  • cursor (Cursor)

    A cursor representing an Objective-C or C++ method. This routine will compute the set of methods that this method overrides.

  • overridden (FFI::Pointer(**Cursor))

    A pointer whose pointee will be replaced with a pointer to an array of cursors, representing the set of overridden methods. If there are no overridden methods, the pointee will be set to NULL. The pointee must be freed via a call to c clang_disposeOverriddenCursors().

  • num_overridden (FFI::Pointer(*UInt))

    A pointer to the number of overridden functions, will be set to the number of overridden functions in the array pointed to by p overridden.

Returns:

  • (nil)


2117
# File 'lib/ffi_gen/clang.rb', line 2117

attach_function :get_overridden_cursors, :clang_getOverriddenCursors, [Cursor.by_value, :pointer, :pointer], :void

.get_pointee_type(t) ⇒ Type

For pointer types, returns the type of the pointee.

Parameters:

Returns:



2405
# File 'lib/ffi_gen/clang.rb', line 2405

attach_function :get_pointee_type, :clang_getPointeeType, [Type.by_value], Type.by_value

.get_presumed_location(location, filename, line, column) ⇒ nil

Retrieve the file, line, column, and offset represented by the given source location, as specified in a # line directive.

Example: given the following source code in a file somefile.c

#123 “dummy.c” 1

static int func(void)

return 0;

the location information returned by this function would be

File: dummy.c Line: 124 Column: 12

whereas clang_getExpansionLocation would have returned

File: somefile.c Line: 3 Column: 12

Parameters:

  • location (SourceLocation)

    the location within a source file that will be decomposed into its parts.

  • filename (FFI::Pointer(*String))

    (out) if non-NULL, will be set to the filename of the source location. Note that filenames returned will be for “virtual” files, which don’t necessarily exist on the machine running clang - e.g. when parsing preprocessed output obtained from a different environment. If a non-NULL value is passed in, remember to dispose of the returned value using c clang_disposeString() once you’ve finished with it. For an invalid source location, an empty string is returned.

  • line (FFI::Pointer(*UInt))

    (out) if non-NULL, will be set to the line number of the source location. For an invalid source location, zero is returned.

  • column (FFI::Pointer(*UInt))

    (out) if non-NULL, will be set to the column number of the source location. For an invalid source location, zero is returned.

Returns:

  • (nil)


332
# File 'lib/ffi_gen/clang.rb', line 332

attach_function :get_presumed_location, :clang_getPresumedLocation, [SourceLocation.by_value, :pointer, :pointer, :pointer], :void

.get_rangeSourceRange

Retrieve a source range given the beginning and ending source locations.

Parameters:

Returns:



277
# File 'lib/ffi_gen/clang.rb', line 277

attach_function :get_range, :clang_getRange, [SourceLocation.by_value, SourceLocation.by_value], SourceRange.by_value

.get_range_end(range) ⇒ SourceLocation

Retrieve a source location representing the last character within a source range.

Parameters:

Returns:



388
# File 'lib/ffi_gen/clang.rb', line 388

attach_function :get_range_end, :clang_getRangeEnd, [SourceRange.by_value], SourceLocation.by_value

.get_range_start(range) ⇒ SourceLocation

Retrieve a source location representing the first character within a source range.

Parameters:

Returns:



379
# File 'lib/ffi_gen/clang.rb', line 379

attach_function :get_range_start, :clang_getRangeStart, [SourceRange.by_value], SourceLocation.by_value

.get_remappings(path) ⇒ FFI::Pointer(Remapping)

Retrieve a remapping.

Parameters:

  • path (String)

    the path that contains metadata about remappings.

Returns:

  • (FFI::Pointer(Remapping))

    the requested remapping. This remapping must be freed via a call to c clang_remap_dispose(). Can return NULL if an error occurred.



3631
# File 'lib/ffi_gen/clang.rb', line 3631

attach_function :get_remappings, :clang_getRemappings, [:string], :pointer

.get_result_type(t) ⇒ Type

Retrieve the result type associated with a function type.

Parameters:

Returns:



2437
# File 'lib/ffi_gen/clang.rb', line 2437

attach_function :get_result_type, :clang_getResultType, [Type.by_value], Type.by_value

.get_specialized_cursor_template(c) ⇒ Cursor

Given a cursor that may represent a specialization or instantiation of a template, retrieve the cursor that represents the template that it specializes or from which it was instantiated.

This routine determines the template involved both for explicit specializations of templates and for implicit instantiations of the template, both of which are referred to as “specializations”. For a class template specialization (e.g., c std::vector<bool>), this routine will return either the primary template (c std::vector) or, if the specialization was instantiated from a class template partial specialization, the class template partial specialization. For a class template partial specialization and a function template specialization (including instantiations), this this routine will return the specialized template.

For members of a class template (e.g., member functions, member classes, or static data members), returns the specialized or instantiated member. Although not strictly “templates” in the C++ language, members of class templates have the same notions of specializations and instantiations that templates do, so this routine treats them similarly.

Parameters:

  • c (Cursor)

    A cursor that may be a specialization of a template or a member of a template.

Returns:

  • (Cursor)

    If the given cursor is a specialization or instantiation of a template or a member thereof, the template or member that it specializes or from which it was instantiated. Otherwise, returns a NULL cursor.



2862
# File 'lib/ffi_gen/clang.rb', line 2862

attach_function :get_specialized_cursor_template, :clang_getSpecializedCursorTemplate, [Cursor.by_value], Cursor.by_value

.get_spelling_location(location, file, line, column, offset) ⇒ nil

Retrieve the file, line, column, and offset represented by the given source location.

If the location refers into a macro instantiation, return where the location was originally spelled in the source file.

Parameters:

  • location (SourceLocation)

    the location within a source file that will be decomposed into its parts.

  • file (FFI::Pointer(*File))

    (out) if non-NULL, will be set to the file to which the given source location points.

  • line (FFI::Pointer(*UInt))

    (out) if non-NULL, will be set to the line to which the given source location points.

  • column (FFI::Pointer(*UInt))

    (out) if non-NULL, will be set to the column to which the given source location points.

  • offset (FFI::Pointer(*UInt))

    (out) if non-NULL, will be set to the offset into the buffer to which the given source location points.

Returns:

  • (nil)


370
# File 'lib/ffi_gen/clang.rb', line 370

attach_function :get_spelling_location, :clang_getSpellingLocation, [SourceLocation.by_value, :pointer, :pointer, :pointer, :pointer], :void

.get_template_cursor_kind(c) ⇒ Symbol from _enum_cursor_kind_

Given a cursor that represents a template, determine the cursor kind of the specializations would be generated by instantiating the template.

This routine can be used to determine what flavor of function template, class template, or class template partial specialization is stored in the cursor. For example, it can describe whether a class template cursor is declared with “struct”, “class” or “union”.

Parameters:

  • c (Cursor)

    The cursor to query. This cursor should represent a template declaration.

Returns:

  • (Symbol from _enum_cursor_kind_)

    The cursor kind of the specializations that would be generated by instantiating the template p C. If p C is not a template, returns c CXCursor_NoDeclFound.



2833
# File 'lib/ffi_gen/clang.rb', line 2833

attach_function :get_template_cursor_kind, :clang_getTemplateCursorKind, [Cursor.by_value], :cursor_kind

.get_token_extent(translation_unit_impl, token) ⇒ SourceRange

Retrieve a source range that covers the given token.

Parameters:

Returns:



2988
# File 'lib/ffi_gen/clang.rb', line 2988

attach_function :get_token_extent, :clang_getTokenExtent, [TranslationUnitImpl, Token.by_value], SourceRange.by_value

.get_token_kind(token) ⇒ Symbol from _enum_token_kind_

Determine the kind of the given token.

Parameters:

Returns:



2958
# File 'lib/ffi_gen/clang.rb', line 2958

attach_function :get_token_kind, :clang_getTokenKind, [Token.by_value], :token_kind

.get_token_location(translation_unit_impl, token) ⇒ SourceLocation

Retrieve the source location of the given token.

Parameters:

Returns:



2979
# File 'lib/ffi_gen/clang.rb', line 2979

attach_function :get_token_location, :clang_getTokenLocation, [TranslationUnitImpl, Token.by_value], SourceLocation.by_value

.get_token_spelling(translation_unit_impl, token) ⇒ String

Determine the spelling of the given token.

The spelling of a token is the textual representation of that token, e.g., the text of an identifier or keyword.

Parameters:

Returns:



2970
# File 'lib/ffi_gen/clang.rb', line 2970

attach_function :get_token_spelling, :clang_getTokenSpelling, [TranslationUnitImpl, Token.by_value], String.by_value

.get_translation_unit_cursor(translation_unit_impl) ⇒ Cursor

Retrieve the cursor that represents the given translation unit.

The translation unit cursor can be used to start traversing the various declarations within the given translation unit.

Parameters:

Returns:



1760
# File 'lib/ffi_gen/clang.rb', line 1760

attach_function :get_translation_unit_cursor, :clang_getTranslationUnitCursor, [TranslationUnitImpl], Cursor.by_value

.get_translation_unit_spelling(ct_unit) ⇒ String

Get the original translation unit source file name.

Parameters:

Returns:



658
# File 'lib/ffi_gen/clang.rb', line 658

attach_function :get_translation_unit_spelling, :clang_getTranslationUnitSpelling, [TranslationUnitImpl], String.by_value

.get_tu_resource_usage_name(kind) ⇒ String

Returns the human-readable null-terminated C string that represents

the name of the memory category.  This string should never be freed.

Parameters:

Returns:



1072
# File 'lib/ffi_gen/clang.rb', line 1072

attach_function :get_tu_resource_usage_name, :clang_getTUResourceUsageName, [:tu_resource_usage_kind], :string

.get_type_declaration(t) ⇒ Cursor

Return the cursor for the declaration of the given type.

Parameters:

Returns:



2413
# File 'lib/ffi_gen/clang.rb', line 2413

attach_function :get_type_declaration, :clang_getTypeDeclaration, [Type.by_value], Cursor.by_value

.get_type_kind_spelling(k) ⇒ String

Retrieve the spelling of a given CXTypeKind.

Parameters:

Returns:



2429
# File 'lib/ffi_gen/clang.rb', line 2429

attach_function :get_type_kind_spelling, :clang_getTypeKindSpelling, [:type_kind], String.by_value

.hash_cursor(cursor) ⇒ Integer

Compute a hash value for the given cursor.

Parameters:

Returns:

  • (Integer)


1785
# File 'lib/ffi_gen/clang.rb', line 1785

attach_function :hash_cursor, :clang_hashCursor, [Cursor.by_value], :uint

.is_attribute(cursor_kind) ⇒ Integer

Determine whether the given cursor kind represents an attribute.

Parameters:

Returns:

  • (Integer)


1838
# File 'lib/ffi_gen/clang.rb', line 1838

attach_function :is_attribute, :clang_isAttribute, [:cursor_kind], :uint

.is_const_qualified_type(t) ⇒ Integer

Determine whether a CXType has the “const” qualifier set,

without looking through typedefs that may have added "const" at a different level.

Parameters:

Returns:

  • (Integer)


2379
# File 'lib/ffi_gen/clang.rb', line 2379

attach_function :is_const_qualified_type, :clang_isConstQualifiedType, [Type.by_value], :uint

.is_cursor_definition(cursor) ⇒ Integer

Determine whether the declaration pointed to by this cursor is also a definition of that entity.

Parameters:

Returns:

  • (Integer)


2769
# File 'lib/ffi_gen/clang.rb', line 2769

attach_function :is_cursor_definition, :clang_isCursorDefinition, [Cursor.by_value], :uint

.is_declaration(cursor_kind) ⇒ Integer

Determine whether the given cursor kind represents a declaration.

Parameters:

Returns:

  • (Integer)


1801
# File 'lib/ffi_gen/clang.rb', line 1801

attach_function :is_declaration, :clang_isDeclaration, [:cursor_kind], :uint

.is_expression(cursor_kind) ⇒ Integer

Determine whether the given cursor kind represents an expression.

Parameters:

Returns:

  • (Integer)


1822
# File 'lib/ffi_gen/clang.rb', line 1822

attach_function :is_expression, :clang_isExpression, [:cursor_kind], :uint

.is_file_multiple_include_guarded(tu, file) ⇒ Integer

Determine whether the given header is guarded against multiple inclusions, either with the conventional #ifndef/#define/#endif macro guards or with #pragma once.

Parameters:

Returns:

  • (Integer)


174
# File 'lib/ffi_gen/clang.rb', line 174

attach_function :is_file_multiple_include_guarded, :clang_isFileMultipleIncludeGuarded, [TranslationUnitImpl, :pointer], :uint

.is_invalid(cursor_kind) ⇒ Integer

Determine whether the given cursor kind represents an invalid cursor.

Parameters:

Returns:

  • (Integer)


1847
# File 'lib/ffi_gen/clang.rb', line 1847

attach_function :is_invalid, :clang_isInvalid, [:cursor_kind], :uint

.is_pod_type(t) ⇒ Integer

Return 1 if the CXType is a POD (plain old data) type, and 0

otherwise.

Parameters:

Returns:

  • (Integer)


2455
# File 'lib/ffi_gen/clang.rb', line 2455

attach_function :is_pod_type, :clang_isPODType, [Type.by_value], :uint

.is_preprocessing(cursor_kind) ⇒ Integer

Determine whether the given cursor represents a preprocessing element, such as a preprocessor directive or macro instantiation.

Parameters:

Returns:

  • (Integer)


1865
# File 'lib/ffi_gen/clang.rb', line 1865

attach_function :is_preprocessing, :clang_isPreprocessing, [:cursor_kind], :uint

.is_reference(cursor_kind) ⇒ Integer

Determine whether the given cursor kind represents a simple reference.

Note that other kinds of cursors (such as expressions) can also refer to other cursors. Use clang_getCursorReferenced() to determine whether a particular cursor refers to another entity.

Parameters:

Returns:

  • (Integer)


1814
# File 'lib/ffi_gen/clang.rb', line 1814

attach_function :is_reference, :clang_isReference, [:cursor_kind], :uint

.is_restrict_qualified_type(t) ⇒ Integer

Determine whether a CXType has the “restrict” qualifier set,

without looking through typedefs that may have added "restrict" at a different level.

Parameters:

Returns:

  • (Integer)


2397
# File 'lib/ffi_gen/clang.rb', line 2397

attach_function :is_restrict_qualified_type, :clang_isRestrictQualifiedType, [Type.by_value], :uint

.is_statement(cursor_kind) ⇒ Integer

Determine whether the given cursor kind represents a statement.

Parameters:

Returns:

  • (Integer)


1830
# File 'lib/ffi_gen/clang.rb', line 1830

attach_function :is_statement, :clang_isStatement, [:cursor_kind], :uint

.is_translation_unit(cursor_kind) ⇒ Integer

Determine whether the given cursor kind represents a translation unit.

Parameters:

Returns:

  • (Integer)


1856
# File 'lib/ffi_gen/clang.rb', line 1856

attach_function :is_translation_unit, :clang_isTranslationUnit, [:cursor_kind], :uint

.is_unexposed(cursor_kind) ⇒ Integer

Determine whether the given cursor represents a currently

unexposed piece of the AST (e.g., CXCursor_UnexposedStmt).

Parameters:

Returns:

  • (Integer)


1874
# File 'lib/ffi_gen/clang.rb', line 1874

attach_function :is_unexposed, :clang_isUnexposed, [:cursor_kind], :uint

.is_virtual_base(cursor) ⇒ Integer

Returns 1 if the base class specified by the cursor with kind

CX_CXXBaseSpecifier is virtual.

Parameters:

Returns:

  • (Integer)


2484
# File 'lib/ffi_gen/clang.rb', line 2484

attach_function :is_virtual_base, :clang_isVirtualBase, [Cursor.by_value], :uint

.is_volatile_qualified_type(t) ⇒ Integer

Determine whether a CXType has the “volatile” qualifier set,

without looking through typedefs that may have added "volatile" at a different level.

Parameters:

Returns:

  • (Integer)


2388
# File 'lib/ffi_gen/clang.rb', line 2388

attach_function :is_volatile_qualified_type, :clang_isVolatileQualifiedType, [Type.by_value], :uint

.parse_translation_unit(c_idx, source_filename, command_line_args, num_command_line_args, unsaved_files, num_unsaved_files, options) ⇒ TranslationUnitImpl

Parse the given source file and the translation unit corresponding to that file.

This routine is the main entry point for the Clang C API, providing the ability to parse a source file into a translation unit that can then be queried by other functions in the API. This routine accepts a set of command-line arguments so that the compilation can be configured in the same way that the compiler is configured on the command line.

Parameters:

  • c_idx (FFI::Pointer(Index))

    The index object with which the translation unit will be associated.

  • source_filename (String)

    The name of the source file to load, or NULL if the source file is included in p command_line_args.

  • command_line_args (FFI::Pointer(**Char_S))

    The command-line arguments that would be passed to the c clang executable if it were being invoked out-of-process. These command-line options will be parsed and will affect how the translation unit is parsed. Note that the following options are ignored: ‘-c’, ‘-emit-ast’, ‘-fsyntex-only’ (which is the default), and ‘-o <output file>’.

  • num_command_line_args (Integer)

    The number of command-line arguments in p command_line_args.

  • unsaved_files (UnsavedFile)

    the files that have not yet been saved to disk but may be required for parsing, including the contents of those files. The contents and name of these files (as specified by CXUnsavedFile) are copied when necessary, so the client only needs to guarantee their validity until the call to this function returns.

  • num_unsaved_files (Integer)

    the number of unsaved file entries in p unsaved_files.

  • options (Integer)

    A bitmask of options that affects how the translation unit is managed but not its compilation. This should be a bitwise OR of the CXTranslationUnit_XXX flags.

Returns:

  • (TranslationUnitImpl)

    A new translation unit describing the parsed code and containing any diagnostics produced by the compiler. If there is a failure from which the compiler cannot recover, returns NULL.



842
# File 'lib/ffi_gen/clang.rb', line 842

attach_function :parse_translation_unit, :clang_parseTranslationUnit, [:pointer, :string, :pointer, :int, UnsavedFile, :uint, :uint], TranslationUnitImpl

.range_is_null(range) ⇒ Integer

Returns non-zero if arg range is null.

Parameters:

Returns:

  • (Integer)


294
# File 'lib/ffi_gen/clang.rb', line 294

attach_function :range_is_null, :clang_Range_isNull, [SourceRange.by_value], :int

.remap_dispose(remapping) ⇒ nil

Dispose the remapping.

Parameters:

  • remapping (FFI::Pointer(Remapping))

Returns:

  • (nil)


3659
# File 'lib/ffi_gen/clang.rb', line 3659

attach_function :remap_dispose, :clang_remap_dispose, [:pointer], :void

.remap_get_filenames(remapping, index, original, transformed) ⇒ nil

Get the original and the associated filename from the remapping.

Parameters:

  • remapping (FFI::Pointer(Remapping))
  • index (Integer)
  • original (FFI::Pointer(*String))

    If non-NULL, will be set to the original filename.

  • transformed (FFI::Pointer(*String))

    If non-NULL, will be set to the filename that the original is associated with.

Returns:

  • (nil)


3651
# File 'lib/ffi_gen/clang.rb', line 3651

attach_function :remap_get_filenames, :clang_remap_getFilenames, [:pointer, :uint, :pointer, :pointer], :void

.remap_get_num_files(remapping) ⇒ Integer

Determine the number of remappings.

Parameters:

  • remapping (FFI::Pointer(Remapping))

Returns:

  • (Integer)


3639
# File 'lib/ffi_gen/clang.rb', line 3639

attach_function :remap_get_num_files, :clang_remap_getNumFiles, [:pointer], :uint

.reparse_translation_unit(tu, num_unsaved_files, unsaved_files, options) ⇒ Integer

Reparse the source files that produced this translation unit.

This routine can be used to re-parse the source files that originally created the given translation unit, for example because those source files have changed (either on disk or as passed via p unsaved_files). The source code will be reparsed with the same command-line options as it was originally parsed.

Reparsing a translation unit invalidates all cursors and source locations that refer into that translation unit. This makes reparsing a translation unit semantically equivalent to destroying the translation unit and then creating a new translation unit with the same command-line arguments. However, it may be more efficient to reparse a translation unit using this routine.

Parameters:

  • tu (TranslationUnitImpl)

    The translation unit whose contents will be re-parsed. The translation unit must originally have been built with c clang_createTranslationUnitFromSourceFile().

  • num_unsaved_files (Integer)

    The number of unsaved file entries in p unsaved_files.

  • unsaved_files (UnsavedFile)

    The files that have not yet been saved to disk but may be required for parsing, including the contents of those files. The contents and name of these files (as specified by CXUnsavedFile) are copied when necessary, so the client only needs to guarantee their validity until the call to this function returns.

  • options (Integer)

    A bitset of options composed of the flags in CXReparse_Flags. The function c clang_defaultReparseOptions() produces a default set of options recommended for most uses, based on the translation unit.

Returns:

  • (Integer)

    0 if the sources could be reparsed. A non-zero value will be returned if reparsing was impossible, such that the translation unit is invalid. In such cases, the only valid call for p TU is c clang_disposeTranslationUnit(TU).



1009
# File 'lib/ffi_gen/clang.rb', line 1009

attach_function :reparse_translation_unit, :clang_reparseTranslationUnit, [TranslationUnitImpl, :uint, UnsavedFile, :uint], :int

.save_translation_unit(tu, file_name, options) ⇒ Integer

Saves a translation unit into a serialized representation of that translation unit on disk.

Any translation unit that was parsed without error can be saved into a file. The translation unit can then be deserialized into a new c CXTranslationUnit with c clang_createTranslationUnit() or, if it is an incomplete translation unit that corresponds to a header, used as a precompiled header when parsing other translation units.

Parameters:

  • tu (TranslationUnitImpl)

    The translation unit to save.

  • file_name (String)

    The file to which the translation unit will be saved.

  • options (Integer)

    A bitmask of options that affects how the translation unit is saved. This should be a bitwise OR of the CXSaveTranslationUnit_XXX flags.

Returns:

  • (Integer)

    A value that will match one of the enumerators of the CXSaveError enumeration. Zero (CXSaveError_None) indicates that the translation unit was saved successfully, while a non-zero value indicates that a problem occurred.



931
# File 'lib/ffi_gen/clang.rb', line 931

attach_function :save_translation_unit, :clang_saveTranslationUnit, [TranslationUnitImpl, :string, :uint], :int

.sort_code_completion_results(results, num_results) ⇒ nil

Sort the code-completion results in case-insensitive alphabetical order.

Parameters:

  • results (FFI::Pointer(*CompletionResult))

    The set of results to sort.

  • num_results (Integer)

    The number of results in p Results.

Returns:

  • (nil)


3491
# File 'lib/ffi_gen/clang.rb', line 3491

attach_function :sort_code_completion_results, :clang_sortCodeCompletionResults, [:pointer, :uint], :void

.toggle_crash_recovery(is_enabled) ⇒ nil

Enable/disable crash recovery.

Flag: to indicate if crash recovery is enabled. A non-zero value

enables crash recovery, while 0 disables it.

Parameters:

  • is_enabled (Integer)

Returns:

  • (nil)


3589
# File 'lib/ffi_gen/clang.rb', line 3589

attach_function :toggle_crash_recovery, :clang_toggleCrashRecovery, [:uint], :void

.tokenize(tu, range, tokens, num_tokens) ⇒ nil

Tokenize the source code described by the given range into raw lexical tokens.

Parameters:

  • tu (TranslationUnitImpl)

    the translation unit whose text is being tokenized.

  • range (SourceRange)

    the source range in which text should be tokenized. All of the tokens produced by tokenization will fall within this source range,

  • tokens (FFI::Pointer(**Token))

    this pointer will be set to point to the array of tokens that occur within the given source range. The returned pointer must be freed with clang_disposeTokens() before the translation unit is destroyed.

  • num_tokens (FFI::Pointer(*UInt))

    will be set to the number of tokens in the c *Tokens array.

Returns:

  • (nil)


3004
# File 'lib/ffi_gen/clang.rb', line 3004

attach_function :tokenize, :clang_tokenize, [TranslationUnitImpl, SourceRange.by_value, :pointer, :pointer], :void

.visit_children(parent, visitor, client_data) ⇒ Integer

Visit the children of a particular cursor.

This function visits all the direct children of the given cursor, invoking the given p visitor function with the cursors of each visited child. The traversal may be recursive, if the visitor returns c CXChildVisit_Recurse. The traversal may also be ended prematurely, if the visitor returns c CXChildVisit_Break.

Parameters:

  • parent (Cursor)

    the cursor whose child may be visited. All kinds of cursors can be visited, including invalid cursors (which, by definition, have no children).

  • visitor (Proc(_callback_cursor_visitor_))

    the visitor function that will be invoked for each child of p parent.

  • client_data (FFI::Pointer(ClientData))

    pointer data supplied by the client, which will be passed to the visitor each time it is invoked.

Returns:

  • (Integer)

    a non-zero value if the traversal was terminated prematurely by the visitor returning c CXChildVisit_Break.



2621
# File 'lib/ffi_gen/clang.rb', line 2621

attach_function :visit_children, :clang_visitChildren, [Cursor.by_value, :cursor_visitor, :pointer], :uint