Module: FFIGen::Clang

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

Defined Under Namespace

Classes: CodeCompleteResults, CompletionResult, CursorAndRangeVisitor, CursorSetImpl, FileUniqueID, IdxAttrInfo, IdxBaseClassInfo, IdxCXXClassDeclInfo, IdxContainerInfo, IdxDeclInfo, IdxEntityInfo, IdxEntityRefInfo, IdxIBOutletCollectionAttrInfo, IdxImportedASTFileInfo, IdxIncludedFileInfo, IdxLoc, IdxObjCCategoryDeclInfo, IdxObjCContainerDeclInfo, IdxObjCInterfaceDeclInfo, IdxObjCPropertyDeclInfo, IdxObjCProtocolRefInfo, IdxObjCProtocolRefListInfo, IndexerCallbacks, PlatformAvailability, SourceLocation, SourceRange, SourceRangeList, TUResourceUsage, TUResourceUsageEntry, Token, TranslationUnitImpl, UnsavedFile, Version

Constant Summary collapse

CINDEX_VERSION_MAJOR =
0
CINDEX_VERSION_MINOR =
27

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

._callback_cursor_visitor_(enumcx_child_visit_result, 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:

Returns:



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

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

._callback_inclusion_visitor_(included_file, 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:

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

Returns:

  • (FFI::Pointer(File))


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

callback :inclusion_visitor, [:pointer, SourceLocation, :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)


129
130
131
132
133
134
# File 'lib/ffi_gen/clang.rb', line 129

enum :availability_kind, [
  :available, 0,
  :deprecated, 1,
  :not_available, 2,
  :not_accessible, 3
]

._enum_calling_conv_Symbol

Describes the calling convention of a function type

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

Options:

:default
:c
:x86_std_call
:x86_fast_call
:x86_this_call
:x86_pascal
:aapcs
:aapcs_vfp
:pnacl_call
:intel_ocl_bicc
:x86_64_win64
:x86_64_sys_v
:invalid
:unexposed

Returns:

  • (Symbol)


2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
# File 'lib/ffi_gen/clang.rb', line 2930

enum :calling_conv, [
  :default, 0,
  :c, 1,
  :x86_std_call, 2,
  :x86_fast_call, 3,
  :x86_this_call, 4,
  :x86_pascal, 5,
  :aapcs, 6,
  :aapcs_vfp, 7,
  :pnacl_call, 8,
  :intel_ocl_bicc, 9,
  :x86_64_win64, 10,
  :x86_64_sys_v, 11,
  :invalid, 100,
  :unexposed, 200
]

._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)


3516
3517
3518
3519
3520
# File 'lib/ffi_gen/clang.rb', line 3516

enum :child_visit_result, [
  :break_, 0,
  :continue, 1,
  :recurse, 2
]

._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.

:include_brief_comments

Whether to include brief documentation within the set of code completions returned.

Returns:

  • (Symbol)


4662
4663
4664
4665
4666
# File 'lib/ffi_gen/clang.rb', line 4662

enum :code_complete_flags, [
  :include_macros, 1,
  :include_code_patterns, 2,
  :include_brief_comments, 4
]

._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)


4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
# File 'lib/ffi_gen/clang.rb', line 4483

enum :completion_chunk_kind, [
  :optional, 0,
  :typed_text, 1,
  :text, 2,
  :placeholder, 3,
  :informative, 4,
  :current_parameter, 5,
  :left_paren, 6,
  :right_paren, 7,
  :left_bracket, 8,
  :right_bracket, 9,
  :left_brace, 10,
  :right_brace, 11,
  :left_angle, 12,
  :right_angle, 13,
  :comma, 14,
  :result_type, 15,
  :colon, 16,
  :semi_colon, 17,
  :equal, 18,
  :horizontal_space, 19,
  :vertical_space, 20
]

._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:

:unexposed

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

:any_type

Completions for any possible type should be included in the results.

:any_value

Completions for any possible value (variables, function calls, etc.) should be included in the results.

:obj_c_object_value

Completions for values that resolve to an Objective-C object should be included in the results.

:obj_c_selector_value

Completions for values that resolve to an Objective-C selector should be included in the results.

:cxx_class_type_value

Completions for values that resolve to a C++ class type should be included in the results.

:dot_member_access

Completions for fields of the member being accessed using the dot operator should be included in the results.

:arrow_member_access

Completions for fields of the member being accessed using the arrow operator should be included in the results.

:obj_c_property_access

Completions for properties of the Objective-C object being accessed using the dot operator should be included in the results.

:enum_tag

Completions for enum tags should be included in the results.

:union_tag

Completions for union tags should be included in the results.

:struct_tag

Completions for struct tags should be included in the results.

:class_tag

Completions for C++ class names should be included in the results.

:namespace

Completions for C++ namespaces and namespace aliases should be included in the results.

:nested_name_specifier

Completions for C++ nested name specifiers should be included in the results.

:obj_c_interface

Completions for Objective-C interfaces (classes) should be included in the results.

:obj_c_protocol

Completions for Objective-C protocols should be included in the results.

:obj_c_category

Completions for Objective-C categories should be included in the results.

:obj_c_instance_message

Completions for Objective-C instance messages should be included in the results.

:obj_c_class_message

Completions for Objective-C class messages should be included in the results.

:obj_c_selector_name

Completions for Objective-C selector names should be included in the results.

:macro_name

Completions for preprocessor macro names should be included in the results.

:natural_language

Natural language completions should be included in the results.

:unknown

The current context is unknown, so set all contexts.

Returns:

  • (Symbol)


4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
# File 'lib/ffi_gen/clang.rb', line 4745

enum :completion_context, [
  :unexposed, 0,
  :any_type, 1,
  :any_value, 2,
  :obj_c_object_value, 4,
  :obj_c_selector_value, 8,
  :cxx_class_type_value, 16,
  :dot_member_access, 32,
  :arrow_member_access, 64,
  :obj_c_property_access, 128,
  :enum_tag, 256,
  :union_tag, 512,
  :struct_tag, 1024,
  :class_tag, 2048,
  :namespace, 4096,
  :nested_name_specifier, 8192,
  :obj_c_interface, 16384,
  :obj_c_protocol, 32768,
  :obj_c_category, 65536,
  :obj_c_instance_message, 131072,
  :obj_c_class_message, 262144,
  :obj_c_selector_name, 524288,
  :macro_name, 1048576,
  :natural_language, 2097152,
  :unknown, 4194303
]

._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

:cxx_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.

:cxx_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.

:cxx_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.

:variable_ref

A reference to a variable that occurs in some non-expression context, e.g., a C++ lambda capture list.

: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, variable, 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 C11 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).

:cxx_static_cast_expr

C++‘s static_cast<> expression.

:cxx_dynamic_cast_expr

C++‘s dynamic_cast<> expression.

:cxx_reinterpret_cast_expr

C++‘s reinterpret_cast<> expression.

:cxx_const_cast_expr

C++‘s const_cast<> expression.

:cxx_functional_cast_expr

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

Example: code

x = int(0.5);

endcode

:cxx_typeid_expr

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

:cxx_bool_literal_expr

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

:cxx_null_ptr_literal_expr

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

:cxx_this_expr

Represents the “this” expression in C++

:cxx_throw_expr

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

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

:cxx_new_expr

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

:cxx_delete_expr

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

:unary_expr

A unary expression.

:obj_c_string_literal

An Objective-C string literal i.e. @“foo”.

:obj_c_encode_expr

An Objective-C @encode expression.

:obj_c_selector_expr

An Objective-C @selector expression.

:obj_c_protocol_expr

An Objective-C @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

:lambda_expr

Represents a C++ lambda expression that produces a local function object.

code void abssort(float *x, unsigned N) {

std::sort(x, x + N,
          ()(float a, float b) {
            return std::abs(a) < std::abs(b);
          });

} endcode

:obj_c_bool_literal_expr

Objective-c Boolean Literal.

:obj_c_self_expr

Represents the “self” expression in an Objective-C method.

: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 statement.

: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.

:gcc_asm_stmt

A GCC inline assembly statement extension.

:obj_c_at_try_stmt

Objective-C’s overall @try-@catch-@finally 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.

:cxx_catch_stmt

C++‘s catch statement.

:cxx_try_stmt

C++‘s try statement.

:cxx_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.

:ms_asm_stmt

A MS inline assembly statement extension.

: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.

:omp_parallel_directive

OpenMP parallel directive.

:omp_simd_directive

OpenMP simd directive.

:omp_for_directive

OpenMP for directive.

:omp_sections_directive

OpenMP sections directive.

:omp_section_directive

OpenMP section directive.

:omp_single_directive

OpenMP single directive.

:omp_parallel_for_directive

OpenMP parallel for directive.

:omp_parallel_sections_directive

OpenMP parallel sections directive.

:omp_task_directive

OpenMP task directive.

:omp_master_directive

OpenMP master directive.

:omp_critical_directive

OpenMP critical directive.

:omp_taskyield_directive

OpenMP taskyield directive.

:omp_barrier_directive

OpenMP barrier directive.

:omp_taskwait_directive

OpenMP taskwait directive.

:omp_flush_directive

OpenMP flush directive.

:seh_leave_stmt

Windows Structured Exception Handling’s leave statement.

: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
:cxx_final_attr
:cxx_override_attr
:annotate_attr
:asm_label_attr
:packed_attr
:pure_attr
:const_attr
:no_duplicate_attr
:cuda_constant_attr
:cuda_device_attr
:cuda_global_attr
:cuda_host_attr
:preprocessing_directive

Preprocessing

:macro_definition
:macro_expansion
:inclusion_directive
:module_import_decl

A module import declaration.

Returns:

  • (Symbol)


2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
# File 'lib/ffi_gen/clang.rb', line 2011

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,
  :cxx_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,
  :cxx_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,
  :cxx_base_specifier, 44,
  :template_ref, 45,
  :namespace_ref, 46,
  :member_ref, 47,
  :label_ref, 48,
  :overloaded_decl_ref, 49,
  :variable_ref, 50,
  :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,
  :cxx_static_cast_expr, 124,
  :cxx_dynamic_cast_expr, 125,
  :cxx_reinterpret_cast_expr, 126,
  :cxx_const_cast_expr, 127,
  :cxx_functional_cast_expr, 128,
  :cxx_typeid_expr, 129,
  :cxx_bool_literal_expr, 130,
  :cxx_null_ptr_literal_expr, 131,
  :cxx_this_expr, 132,
  :cxx_throw_expr, 133,
  :cxx_new_expr, 134,
  :cxx_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,
  :lambda_expr, 144,
  :obj_c_bool_literal_expr, 145,
  :obj_c_self_expr, 146,
  :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,
  :gcc_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,
  :cxx_catch_stmt, 223,
  :cxx_try_stmt, 224,
  :cxx_for_range_stmt, 225,
  :seh_try_stmt, 226,
  :seh_except_stmt, 227,
  :seh_finally_stmt, 228,
  :ms_asm_stmt, 229,
  :null_stmt, 230,
  :decl_stmt, 231,
  :omp_parallel_directive, 232,
  :omp_simd_directive, 233,
  :omp_for_directive, 234,
  :omp_sections_directive, 235,
  :omp_section_directive, 236,
  :omp_single_directive, 237,
  :omp_parallel_for_directive, 238,
  :omp_parallel_sections_directive, 239,
  :omp_task_directive, 240,
  :omp_master_directive, 241,
  :omp_critical_directive, 242,
  :omp_taskyield_directive, 243,
  :omp_barrier_directive, 244,
  :omp_taskwait_directive, 245,
  :omp_flush_directive, 246,
  :seh_leave_stmt, 247,
  :translation_unit, 300,
  :first_attr, 400,
  :unexposed_attr, 400,
  :ib_action_attr, 401,
  :ib_outlet_attr, 402,
  :ib_outlet_collection_attr, 403,
  :cxx_final_attr, 404,
  :cxx_override_attr, 405,
  :annotate_attr, 406,
  :asm_label_attr, 407,
  :packed_attr, 408,
  :pure_attr, 409,
  :const_attr, 410,
  :no_duplicate_attr, 411,
  :cuda_constant_attr, 412,
  :cuda_device_attr, 413,
  :cuda_global_attr, 414,
  :cuda_host_attr, 415,
  :preprocessing_directive, 500,
  :macro_definition, 501,
  :macro_expansion, 502,
  :inclusion_directive, 503,
  :module_import_decl, 600
]

._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:

:invalid_access_specifier
:public
:protected
:private

Returns:

  • (Symbol)


3443
3444
3445
3446
3447
3448
# File 'lib/ffi_gen/clang.rb', line 3443

enum :cxx_access_specifier, [
  :invalid_access_specifier, 0,
  :public, 1,
  :protected, 2,
  :private, 3
]

._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_formatDiagnostic().

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

Options:

: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.

: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.

: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.

: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.

: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.

: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)


824
825
826
827
828
829
830
831
# File 'lib/ffi_gen/clang.rb', line 824

enum :diagnostic_display_options, [
  :source_location, 1,
  :column, 2,
  :source_ranges, 4,
  :option, 8,
  :category_id, 16,
  :category_name, 32
]

._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)


647
648
649
650
651
652
653
# File 'lib/ffi_gen/clang.rb', line 647

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

._enum_error_code_Symbol

(Not documented)

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

Options:

:success

No error.

:failure

A generic error code, no further details are available.

Errors of this kind can get their own specific error codes in future libclang versions.

:crashed

libclang crashed while performing the requested operation.

:invalid_arguments

The function detected that the arguments violate the function contract.

:ast_read_error

An AST deserialization error has occurred.

Returns:

  • (Symbol)


46
47
48
49
50
51
52
# File 'lib/ffi_gen/clang.rb', line 46

enum :error_code, [
  :success, 0,
  :failure, 1,
  :crashed, 2,
  :invalid_arguments, 3,
  :ast_read_error, 4
]

._enum_global_opt_flags_Symbol

(Not documented)

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

Options:

:none

Used to indicate that no special CXIndex options are needed.

:thread_background_priority_for_indexing

Used to indicate that threads that libclang creates for indexing purposes should use background priority.

Affects #clang_indexSourceFile, #clang_indexTranslationUnit, #clang_parseTranslationUnit, #clang_saveTranslationUnit.

:thread_background_priority_for_editing

Used to indicate that threads that libclang creates for editing purposes should use background priority.

Affects #clang_reparseTranslationUnit, #clang_codeCompleteAt, #clang_annotateTokens

Returns:

  • (Symbol)


236
237
238
239
240
# File 'lib/ffi_gen/clang.rb', line 236

enum :global_opt_flags, [
  :none, 0,
  :thread_background_priority_for_indexing, 1,
  :thread_background_priority_for_editing, 2
]

._enum_idx_attr_kind_Symbol

(Not documented)

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

Options:

:unexposed
:ib_action
:ib_outlet
:ib_outlet_collection

Returns:

  • (Symbol)


5325
5326
5327
5328
5329
5330
# File 'lib/ffi_gen/clang.rb', line 5325

enum :idx_attr_kind, [
  :unexposed, 0,
  :ib_action, 1,
  :ib_outlet, 2,
  :ib_outlet_collection, 3
]

._enum_idx_decl_info_flags_Symbol

(Not documented)

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

Options:

:idx_decl_flag_skipped

Returns:

  • (Symbol)


5415
5416
5417
# File 'lib/ffi_gen/clang.rb', line 5415

enum :idx_decl_info_flags, [
  :idx_decl_flag_skipped, 1
]

._enum_idx_entity_cxx_template_kind_Symbol

Extra C++ template information for an entity. This can apply to: CXIdxEntity_Function CXIdxEntity_CXXClass CXIdxEntity_CXXStaticMethod CXIdxEntity_CXXInstanceMethod CXIdxEntity_CXXConstructor CXIdxEntity_CXXConversionFunction CXIdxEntity_CXXTypeAlias

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

Options:

:non_template
:template
:template_partial_specialization
:template_specialization

Returns:

  • (Symbol)


5301
5302
5303
5304
5305
5306
# File 'lib/ffi_gen/clang.rb', line 5301

enum :idx_entity_cxx_template_kind, [
  :non_template, 0,
  :template, 1,
  :template_partial_specialization, 2,
  :template_specialization, 3
]

._enum_idx_entity_kind_Symbol

(Not documented)

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

Options:

:unexposed
:typedef
:function
:variable
:field
:enum_constant
:obj_c_class
:obj_c_protocol
:obj_c_category
:obj_c_instance_method
:obj_c_class_method
:obj_c_property
:obj_c_ivar
:enum
:struct
:union
:cxx_class
:cxx_namespace
:cxx_namespace_alias
:cxx_static_variable
:cxx_static_method
:cxx_instance_method
:cxx_constructor
:cxx_destructor
:cxx_conversion_function
:cxx_type_alias
:cxx_interface

Returns:

  • (Symbol)


5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
# File 'lib/ffi_gen/clang.rb', line 5223

enum :idx_entity_kind, [
  :unexposed, 0,
  :typedef, 1,
  :function, 2,
  :variable, 3,
  :field, 4,
  :enum_constant, 5,
  :obj_c_class, 6,
  :obj_c_protocol, 7,
  :obj_c_category, 8,
  :obj_c_instance_method, 9,
  :obj_c_class_method, 10,
  :obj_c_property, 11,
  :obj_c_ivar, 12,
  :enum, 13,
  :struct, 14,
  :union, 15,
  :cxx_class, 16,
  :cxx_namespace, 17,
  :cxx_namespace_alias, 18,
  :cxx_static_variable, 19,
  :cxx_static_method, 20,
  :cxx_instance_method, 21,
  :cxx_constructor, 22,
  :cxx_destructor, 23,
  :cxx_conversion_function, 24,
  :cxx_type_alias, 25,
  :cxx_interface, 26
]

._enum_idx_entity_language_Symbol

(Not documented)

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

Options:

:lang_none
:lang_c
:lang_obj_c
:lang_cxx

Returns:

  • (Symbol)


5270
5271
5272
5273
5274
5275
# File 'lib/ffi_gen/clang.rb', line 5270

enum :idx_entity_language, [
  :lang_none, 0,
  :lang_c, 1,
  :lang_obj_c, 2,
  :lang_cxx, 3
]

._enum_idx_entity_ref_kind_Symbol

Data for IndexerCallbacks#indexEntityReference.

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

Options:

:direct

The entity is referenced directly in user’s code.

:implicit

An implicit reference, e.g. a reference of an Objective-C method via the dot syntax.

Returns:

  • (Symbol)


5621
5622
5623
5624
# File 'lib/ffi_gen/clang.rb', line 5621

enum :idx_entity_ref_kind, [
  :direct, 1,
  :implicit, 2
]

._enum_idx_obj_c_container_kind_Symbol

(Not documented)

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

Options:

:forward_ref
:interface
:implementation

Returns:

  • (Symbol)


5481
5482
5483
5484
5485
# File 'lib/ffi_gen/clang.rb', line 5481

enum :idx_obj_c_container_kind, [
  :forward_ref, 0,
  :interface, 1,
  :implementation, 2
]

._enum_index_opt_flags_Symbol

(Not documented)

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

Options:

:none

Used to indicate that no special indexing options are needed.

:suppress_redundant_refs

Used to indicate that IndexerCallbacks#indexEntityReference should be invoked for only one reference of an entity per source file that does not also include a declaration/definition of the entity.

:index_function_local_symbols

Function-local symbols should be indexed. If this is not set function-local symbols will be ignored.

:index_implicit_template_instantiations

Implicit function/class template instantiations should be indexed. If this is not set, implicit instantiations will be ignored.

:suppress_warnings

Suppress all compiler warnings when parsing for indexing.

:skip_parsed_bodies_in_session

Skip a function/method body that was already parsed during an indexing session associated with a c CXIndexAction object. Bodies in system headers are always skipped.

Returns:

  • (Symbol)


5842
5843
5844
5845
5846
5847
5848
5849
# File 'lib/ffi_gen/clang.rb', line 5842

enum :index_opt_flags, [
  :none, 0,
  :suppress_redundant_refs, 1,
  :index_function_local_symbols, 2,
  :index_implicit_template_instantiations, 4,
  :suppress_warnings, 8,
  :skip_parsed_bodies_in_session, 16
]

._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)


2486
2487
2488
2489
2490
2491
# File 'lib/ffi_gen/clang.rb', line 2486

enum :language_kind, [
  :invalid, 0,
  :c, 1,
  :obj_c, 2,
  :c_plus_plus, 3
]

._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)


2374
2375
2376
2377
2378
2379
2380
# File 'lib/ffi_gen/clang.rb', line 2374

enum :linkage_kind, [
  :invalid, 0,
  :no_linkage, 1,
  :internal, 2,
  :unique_external, 3,
  :external, 4
]

._enum_load_diag_error_Symbol

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

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

Options:

:none

Indicates that no error occurred.

:unknown

Indicates that an unknown error occurred while attempting to deserialize diagnostics.

:cannot_load

Indicates that the file containing the serialized diagnostics could not be opened.

:invalid_file

Indicates that the serialized diagnostics file is invalid or corrupt.

Returns:

  • (Symbol)


694
695
696
697
698
699
# File 'lib/ffi_gen/clang.rb', line 694

enum :load_diag_error, [
  :none, 0,
  :unknown, 1,
  :cannot_load, 2,
  :invalid_file, 3
]

._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:

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

in x.Foo::y, in the

range.

:range_want_template_args

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

: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); // Objective-C return some_vector(1); // C++ endcode

Returns:

  • (Symbol)


4153
4154
4155
4156
4157
# File 'lib/ffi_gen/clang.rb', line 4153

enum :name_ref_flags, [
  :range_want_qualifier, 1,
  :range_want_template_args, 2,
  :range_want_single_piece, 4
]

._enum_obj_c_decl_qualifier_kind_Symbol

‘Qualifiers’ written next to the return and parameter types in Objective-C method declarations.

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

Options:

:none
:in_
:inout
:out
:bycopy
:byref
:oneway

Returns:

  • (Symbol)


3879
3880
3881
3882
3883
3884
3885
3886
3887
# File 'lib/ffi_gen/clang.rb', line 3879

enum :obj_c_decl_qualifier_kind, [
  :none, 0,
  :in_, 1,
  :inout, 2,
  :out, 4,
  :bycopy, 8,
  :byref, 16,
  :oneway, 32
]

._enum_obj_c_property_attr_kind_Symbol

Property attributes for a c CXCursor_ObjCPropertyDecl.

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

Options:

:noattr
:readonly
:getter
:assign
:readwrite
:retain
:copy
:nonatomic
:setter
:atomic
:weak
:strong
:unsafe_unretained

Returns:

  • (Symbol)


3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
# File 'lib/ffi_gen/clang.rb', line 3828

enum :obj_c_property_attr_kind, [
  :noattr, 0,
  :readonly, 1,
  :getter, 2,
  :assign, 4,
  :readwrite, 8,
  :retain, 16,
  :copy, 32,
  :nonatomic, 64,
  :setter, 128,
  :atomic, 256,
  :weak, 512,
  :strong, 1024,
  :unsafe_unretained, 2048
]

._enum_ref_qualifier_kind_Symbol

(Not documented)

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

Options:

:none

No ref-qualifier was provided.

:l_value

An lvalue ref-qualifier was provided (c &).

:r_value

An rvalue ref-qualifier was provided (c &&).

Returns:

  • (Symbol)


3365
3366
3367
3368
3369
# File 'lib/ffi_gen/clang.rb', line 3365

enum :ref_qualifier_kind, [
  :none, 0,
  :l_value, 1,
  :r_value, 2
]

._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)


1327
1328
1329
# File 'lib/ffi_gen/clang.rb', line 1327

enum :reparse_flags, [
  :reparse_none, 0
]

._enum_result_Symbol

(Not documented)

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

Options:

:success

Function returned successfully.

:invalid

One of the parameters was invalid for the function.

:visit_break

The function was terminated by a callback (e.g. it returned CXVisit_Break)

Returns:

  • (Symbol)


5074
5075
5076
5077
5078
# File 'lib/ffi_gen/clang.rb', line 5074

enum :result, [
  :success, 0,
  :invalid, 1,
  :visit_break, 2
]

._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)


1275
1276
1277
1278
1279
1280
# File 'lib/ffi_gen/clang.rb', line 1275

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)


1230
1231
1232
# File 'lib/ffi_gen/clang.rb', line 1230

enum :save_translation_unit_flags, [
  :save_translation_unit_none, 0
]

._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)


4178
4179
4180
4181
4182
4183
4184
# File 'lib/ffi_gen/clang.rb', line 4178

enum :token_kind, [
  :punctuation, 0,
  :keyword, 1,
  :identifier, 2,
  :literal, 3,
  :comment, 4
]

._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.

:for_serialization

Used to indicate that the translation unit will be serialized with c clang_saveTranslationUnit.

This option is typically used when parsing a header with the intent of producing a precompiled header.

:cxx_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.

:skip_function_bodies

Used to indicate that function/method bodies should be skipped while parsing.

This option can be used to search for declarations/definitions while ignoring the usages.

:include_brief_comments_in_code_completion

Used to indicate that brief documentation comments should be included into the set of code completions returned from this translation unit.

Returns:

  • (Symbol)


1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
# File 'lib/ffi_gen/clang.rb', line 1130

enum :translation_unit_flags, [
  :none, 0,
  :detailed_preprocessing_record, 1,
  :incomplete, 2,
  :precompiled_preamble, 4,
  :cache_completion_results, 8,
  :for_serialization, 16,
  :cxx_chained_pch, 32,
  :skip_function_bodies, 64,
  :include_brief_comments_in_code_completion, 128
]

._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)


1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
# File 'lib/ffi_gen/clang.rb', line 1420

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

Represents 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
:vector
:incomplete_array
:variable_array
:dependent_sized_array
:member_pointer

Returns:

  • (Symbol)


2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
# File 'lib/ffi_gen/clang.rb', line 2842

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,
  :vector, 113,
  :incomplete_array, 114,
  :variable_array, 115,
  :dependent_sized_array, 116,
  :member_pointer, 117
]

._enum_type_layout_error_Symbol

List the possible error codes for c clang_Type_getSizeOf,

\c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and
\c clang_Cursor_getOffsetOf.

A value of this enumeration type can be returned if the target type is not a valid argument to sizeof, alignof or offsetof.

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

Options:

:invalid

Type is of kind CXType_Invalid.

:incomplete

The type is an incomplete Type.

:dependent

The type is a dependent Type.

:not_constant_size

The type is not a constant size type.

:invalid_field_name

The Field name is not valid for this record.

Returns:

  • (Symbol)


3282
3283
3284
3285
3286
3287
3288
# File 'lib/ffi_gen/clang.rb', line 3282

enum :type_layout_error, [
  :invalid, -1,
  :incomplete, -2,
  :dependent, -3,
  :not_constant_size, -4,
  :invalid_field_name, -5
]

._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:

:visit_break
:visit_continue

Returns:

  • (Symbol)


5041
5042
5043
5044
# File 'lib/ffi_gen/clang.rb', line 5041

enum :visitor_result, [
  :visit_break, 0,
  :visit_continue, 1
]

.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 (Token)

    the set of tokens to annotate.

  • num_tokens (Integer)

    the number of tokens in p Tokens.

  • cursors (Cursor)

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

Returns:

  • (nil)


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

attach_function :annotate_tokens, :clang_annotateTokens, [TranslationUnitImpl, Token, :uint, Cursor], :void

.attach_function(name, *_) ⇒ Object



9
10
11
12
13
# File 'lib/ffi_gen/clang.rb', line 9

def self.attach_function(name, *_)
  begin; super; rescue FFI::NotFoundError => e
    (class << self; self; end).class_eval { define_method(name) { |*_| raise e } }
  end
end

.code_complete_at(tu, complete_filename, complete_line, complete_column, unsaved_files, num_unsaved_files, options) ⇒ 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:

  • (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.



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

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

.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 (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



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

attach_function :code_complete_get_container_kind, :clang_codeCompleteGetContainerKind, [CodeCompleteResults, :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



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

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

.code_complete_get_contexts(results) ⇒ Integer

Determines what completions 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.



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

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

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

Retrieve a diagnostic associated with the given code completion.

Parameters:

  • results (CodeCompleteResults)

    the code completion results 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().



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

attach_function :code_complete_get_diagnostic, :clang_codeCompleteGetDiagnostic, [CodeCompleteResults, :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)


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

attach_function :code_complete_get_num_diagnostics, :clang_codeCompleteGetNumDiagnostics, [CodeCompleteResults], :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.



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

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

.construct_usr_obj_c_category(class_name, category_name) ⇒ String

Construct a USR for a specified Objective-C category.

Parameters:

Returns:



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

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:



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

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:



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

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:



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

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:



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

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:



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

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

.create_cx_cursor_setCursorSetImpl

Creates an empty CXCursorSet.

Returns:



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

attach_function :create_cx_cursor_set, :clang_createCXCursorSet, [], CursorSetImpl

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

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:

code

// 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);

endcode

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))


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

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

.create_translation_unit(c_idx, ast_filename) ⇒ TranslationUnitImpl

Same as c clang_createTranslationUnit2, but returns the c CXTranslationUnit instead of an error code. In case of an error this routine returns a c NULL c CXTranslationUnit, without further detailed error codes.

Parameters:

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

Returns:



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

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

.create_translation_unit2(c_idx, ast_filename, out_tu) ⇒ Symbol from _enum_error_code_

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

param(out) out_TU A non-NULL pointer to store the created c CXTranslationUnit.

Parameters:

  • c_idx (FFI::Pointer(Index))
  • ast_filename (String)
  • out_tu (FFI::Pointer(*TranslationUnit))

Returns:

  • (Symbol from _enum_error_code_)

    Zero on success, otherwise returns an error code.



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

attach_function :create_translation_unit2, :clang_createTranslationUnit2, [:pointer, :string, :pointer], :error_code

.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(**CharS))

    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’, ‘-fsyntax-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:



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

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

.cursor_get_argument(c, i) ⇒ Cursor

Retrieve the argument cursor of a function or method.

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

Parameters:

Returns:



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

attach_function :cursor_get_argument, :clang_Cursor_getArgument, [Cursor.by_value, :uint], Cursor.by_value

.cursor_get_brief_comment_text(c) ⇒ String

Given a cursor that represents a documentable entity (e.g., declaration), return the associated paragraph; otherwise return the first paragraph.

Parameters:

Returns:



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

attach_function :cursor_get_brief_comment_text, :clang_Cursor_getBriefCommentText, [Cursor.by_value], String.by_value

.cursor_get_comment_range(c) ⇒ SourceRange

Given a cursor that represents a declaration, return the associated comment’s source range. The range may include multiple consecutive comments with whitespace in between.

Parameters:

Returns:



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

attach_function :cursor_get_comment_range, :clang_Cursor_getCommentRange, [Cursor.by_value], SourceRange.by_value

.cursor_get_module(c) ⇒ FFI::Pointer(Module)

Given a CXCursor_ModuleImportDecl cursor, return the associated module.

Parameters:

Returns:

  • (FFI::Pointer(Module))


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

attach_function :cursor_get_module, :clang_Cursor_getModule, [Cursor.by_value], :pointer

.cursor_get_num_arguments(c) ⇒ Integer

Retrieve the number of non-variadic arguments associated with a given cursor.

The number of arguments can be determined for calls as well as for declarations of functions or methods. For other cursors -1 is returned.

Parameters:

Returns:

  • (Integer)


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

attach_function :cursor_get_num_arguments, :clang_Cursor_getNumArguments, [Cursor.by_value], :int

.cursor_get_obj_c_decl_qualifiers(c) ⇒ Integer

Given a cursor that represents an Objective-C method or parameter declaration, return the associated Objective-C qualifiers for the return type or the parameter respectively. The bits are formed from CXObjCDeclQualifierKind.

Parameters:

Returns:

  • (Integer)


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

attach_function :cursor_get_obj_c_decl_qualifiers, :clang_Cursor_getObjCDeclQualifiers, [Cursor.by_value], :uint

.cursor_get_obj_c_property_attributes(c, reserved) ⇒ Integer

Given a cursor that represents a property declaration, return the associated property attributes. The bits are formed from c CXObjCPropertyAttrKind.

Parameters:

  • c (Cursor)
  • reserved (Integer)

    Reserved for future use, pass 0.

Returns:

  • (Integer)


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

attach_function :cursor_get_obj_c_property_attributes, :clang_Cursor_getObjCPropertyAttributes, [Cursor.by_value, :uint], :uint

.cursor_get_obj_c_selector_index(cursor) ⇒ Integer

If the cursor points to a selector identifier in an Objective-C method or message expression, this returns the selector index.

After getting a cursor with #clang_getCursor, this can be called to determine if the location points to a selector identifier.

Parameters:

Returns:

  • (Integer)

    The selector index if the cursor is an Objective-C method or message expression and the cursor is pointing to a selector identifier, or -1 otherwise.



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

attach_function :cursor_get_obj_c_selector_index, :clang_Cursor_getObjCSelectorIndex, [Cursor.by_value], :int

.cursor_get_raw_comment_text(c) ⇒ String

Given a cursor that represents a declaration, return the associated comment text, including comment markers.

Parameters:

Returns:



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

attach_function :cursor_get_raw_comment_text, :clang_Cursor_getRawCommentText, [Cursor.by_value], String.by_value

.cursor_get_receiver_type(c) ⇒ Type

Given a cursor pointing to an Objective-C message, returns the CXType of the receiver.

Parameters:

Returns:



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

attach_function :cursor_get_receiver_type, :clang_Cursor_getReceiverType, [Cursor.by_value], Type.by_value

.cursor_get_spelling_name_range(cursor, piece_index, options) ⇒ SourceRange

Retrieve a range for a piece that forms the cursors spelling name. Most of the times there is only one range for the complete spelling but for Objective-C methods and Objective-C message expressions, there are multiple pieces for each selector identifier.

Parameters:

  • cursor (Cursor)
  • piece_index (Integer)

    the index of the spelling name piece. If this is greater than the actual number of pieces, it will return a NULL (invalid) range.

  • options (Integer)

    Reserved.

Returns:



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

attach_function :cursor_get_spelling_name_range, :clang_Cursor_getSpellingNameRange, [Cursor.by_value, :uint, :uint], SourceRange.by_value

.cursor_get_translation_unit(cursor) ⇒ TranslationUnitImpl

Returns the translation unit that a cursor originated from.

Parameters:

Returns:



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

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

.cursor_is_bit_field(c) ⇒ Integer

Returns non-zero if the cursor specifies a Record member that is a

bitfield.

Parameters:

Returns:

  • (Integer)


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

attach_function :cursor_is_bit_field, :clang_Cursor_isBitField, [Cursor.by_value], :uint

.cursor_is_dynamic_call(c) ⇒ Integer

Given a cursor pointing to a C++ method call or an Objective-C message, returns non-zero if the method/message is “dynamic”, meaning:

For a C++ method: the call is virtual. For an Objective-C message: the receiver is an object instance, not ‘super’ or a specific class.

If the method/message is “static” or the cursor does not point to a method/message, it will return zero.

Parameters:

Returns:

  • (Integer)


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

attach_function :cursor_is_dynamic_call, :clang_Cursor_isDynamicCall, [Cursor.by_value], :int

.cursor_is_null(cursor) ⇒ Integer

Returns non-zero if p cursor is null.

Parameters:

Returns:

  • (Integer)


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

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

.cursor_is_obj_c_optional(c) ⇒ Integer

Given a cursor that represents an Objective-C method or property declaration, return non-zero if the declaration was affected by “@optional”. Returns zero if the cursor is not such a declaration or it is “@required”.

Parameters:

Returns:

  • (Integer)


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

attach_function :cursor_is_obj_c_optional, :clang_Cursor_isObjCOptional, [Cursor.by_value], :uint

.cursor_is_variadic(c) ⇒ Integer

Returns non-zero if the given cursor is a variadic function or method.

Parameters:

Returns:

  • (Integer)


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

attach_function :cursor_is_variadic, :clang_Cursor_isVariadic, [Cursor.by_value], :uint

.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.



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

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.



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

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

.cx_index_get_global_options(index) ⇒ Integer

Gets the general options associated with a CXIndex.

Parameters:

  • index (FFI::Pointer(Index))

Returns:

  • (Integer)

    A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags that are associated with the given CXIndex object.



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

attach_function :cx_index_get_global_options, :clang_CXIndex_getGlobalOptions, [:pointer], :uint

.cx_index_set_global_options(index, options) ⇒ nil

Sets general options associated with a CXIndex.

For example: code CXIndex idx = …; clang_CXIndex_setGlobalOptions(idx,

clang_CXIndex_getGlobalOptions(idx) |
CXGlobalOpt_ThreadBackgroundPriorityForIndexing);

endcode

Parameters:

  • index (FFI::Pointer(Index))
  • options (Integer)

    A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags.

Returns:

  • (nil)


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

attach_function :cx_index_set_global_options, :clang_CXIndex_setGlobalOptions, [:pointer, :uint], :void

.cxx_method_is_const(c) ⇒ Integer

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

Parameters:

Returns:

  • (Integer)


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

attach_function :cxx_method_is_const, :clang_CXXMethod_isConst, [Cursor.by_value], :uint

.cxx_method_is_pure_virtual(c) ⇒ Integer

Determine if a C++ member function or member function template is pure virtual.

Parameters:

Returns:

  • (Integer)


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

attach_function :cxx_method_is_pure_virtual, :clang_CXXMethod_isPureVirtual, [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)


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

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)


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

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)


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

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_formatDiagnostic().



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

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)


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

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)


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

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)


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

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)


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

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

.dispose_cx_cursor_set(cset) ⇒ nil

Disposes a CXCursorSet and releases its associated memory.

Parameters:

Returns:

  • (nil)


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

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

.dispose_cx_platform_availability(availability) ⇒ nil

Free the memory associated with a c CXPlatformAvailability structure.

Parameters:

Returns:

  • (nil)


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

attach_function :dispose_cx_platform_availability, :clang_disposeCXPlatformAvailability, [PlatformAvailability], :void

.dispose_cxtu_resource_usage(usage) ⇒ nil

(Not documented)

Parameters:

Returns:

  • (nil)


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

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)


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

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

.dispose_diagnostic_set(diags) ⇒ nil

Release a CXDiagnosticSet and all of its contained diagnostics.

Parameters:

  • diags (FFI::Pointer(DiagnosticSet))

Returns:

  • (nil)


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

attach_function :dispose_diagnostic_set, :clang_disposeDiagnosticSet, [: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)


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

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:

Returns:

  • (nil)


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

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

.dispose_source_range_list(ranges) ⇒ nil

Destroy the given c CXSourceRangeList.

Parameters:

Returns:

  • (nil)


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

attach_function :dispose_source_range_list, :clang_disposeSourceRangeList, [SourceRangeList], :void

.dispose_string(string) ⇒ nil

Free the given string.

Parameters:

Returns:

  • (nil)


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

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)


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

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

.dispose_translation_unit(translation_unit_impl) ⇒ nil

Destroy the specified CXTranslationUnit object.

Parameters:

Returns:

  • (nil)


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

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

.enable_stack_tracesnil

(Not documented)

Returns:

  • (nil)


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

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

.equal_cursors(cursor, cursor) ⇒ Integer

Determine whether two cursors are equivalent.

Parameters:

Returns:

  • (Integer)


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

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.



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

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.



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

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.



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

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)


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

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

.find_includes_in_file(tu, file, visitor) ⇒ Symbol from _enum_result_

Find #import/#include directives in a specific file.

Parameters:

  • tu (TranslationUnitImpl)

    translation unit containing the file to query.

  • file (FFI::Pointer(File))

    to search for #import/#include directives.

  • visitor (CursorAndRangeVisitor)

    callback that will receive pairs of CXCursor/CXSourceRange for each directive found.

Returns:

  • (Symbol from _enum_result_)

    one of the CXResult enumerators.



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

attach_function :find_includes_in_file, :clang_findIncludesInFile, [TranslationUnitImpl, :pointer, CursorAndRangeVisitor.by_value], :result

.find_references_in_file(cursor, file, visitor) ⇒ Symbol from _enum_result_

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:

  • (Symbol from _enum_result_)

    one of the CXResult enumerators.



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

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

.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.



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

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

.get_arg_type(t, i) ⇒ Type

Retrieve the type of a parameter of a function type.

If a non-function type is passed in or the function does not have enough parameters, an invalid type is returned.

Parameters:

  • t (Type)
  • i (Integer)

Returns:



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

attach_function :get_arg_type, :clang_getArgType, [Type.by_value, :uint], Type.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:



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

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

.get_array_size(t) ⇒ Integer

Return the array size of a constant array.

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

Parameters:

Returns:

  • (Integer)


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

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:



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

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.



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

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:



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

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

.get_child_diagnostics(d) ⇒ FFI::Pointer(DiagnosticSet)

Retrieve the child diagnostics of a CXDiagnostic.

This CXDiagnosticSet does not need to be released by clang_disposeDiagnosticSet.

Parameters:

  • d (FFI::Pointer(Diagnostic))

Returns:

  • (FFI::Pointer(DiagnosticSet))


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

attach_function :get_child_diagnostics, :clang_getChildDiagnostics, [:pointer], :pointer

.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:



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

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.



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

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:



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

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

.get_completion_brief_comment(completion_string) ⇒ String

Retrieve the brief documentation comment attached to the declaration that corresponds to the given completion string.

Parameters:

  • completion_string (FFI::Pointer(CompletionString))

Returns:



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

attach_function :get_completion_brief_comment, :clang_getCompletionBriefComment, [:pointer], String.by_value

.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.



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

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:



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

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.



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

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.



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

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

.get_completion_parent(completion_string, kind) ⇒ String

Retrieve the parent context of the given completion string.

The parent context of a completion string is the semantic parent of the declaration (if any) that the code completion represents. For example, a code completion for an Objective-C method would have the method’s class or protocol as its context.

Parameters:

  • completion_string (FFI::Pointer(CompletionString))

    The code completion string whose parent is being queried.

  • kind (FFI::Pointer(*CursorKind))

    DEPRECATED: always set to CXCursor_NotImplemented if non-NULL.

Returns:

  • (String)

    The name of the completion parent, e.g., “NSObject” if the completion string represents a method in the NSObject class.



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

attach_function :get_completion_parent, :clang_getCompletionParent, [:pointer, :pointer], String.by_value

.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.



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

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.



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

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, taking the current target platform into account.

Parameters:

  • cursor (Cursor)

    The cursor to query.

Returns:



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

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.



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

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:



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

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:



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

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 within 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:



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

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:



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

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

.get_cursor_kind_spelling(kind) ⇒ String

for debug/testing

Parameters:

Returns:



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

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:



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

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 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:



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

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:



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

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:



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

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

.get_cursor_platform_availability(cursor, always_deprecated, deprecated_message, always_unavailable, unavailable_message, availability, availability_size) ⇒ Integer

Determine the availability of the entity that this cursor refers to on any platforms for which availability information is known.

Parameters:

  • cursor (Cursor)

    The cursor to query.

  • always_deprecated (FFI::Pointer(*Int))

    If non-NULL, will be set to indicate whether the entity is deprecated on all platforms.

  • deprecated_message (String)

    If non-NULL, will be set to the message text provided along with the unconditional deprecation of this entity. The client is responsible for deallocating this string.

  • always_unavailable (FFI::Pointer(*Int))

    If non-NULL, will be set to indicate whether the entity is unavailable on all platforms.

  • unavailable_message (String)

    If non-NULL, will be set to the message text provided along with the unconditional unavailability of this entity. The client is responsible for deallocating this string.

  • availability (PlatformAvailability)

    If non-NULL, an array of CXPlatformAvailability instances that will be populated with platform availability information, up to either the number of platforms for which availability information is available (as returned by this function) or c availability_size, whichever is smaller.

  • availability_size (Integer)

    The number of elements available in the c availability array.

Returns:

  • (Integer)

    The number of platforms (N) for which availability information is available (which is unrelated to c availability_size).

    Note that the client is responsible for calling c clang_disposeCXPlatformAvailability to free each of the platform-availability structures returned. There are c min(N, availability_size) such structures.



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

attach_function :get_cursor_platform_availability, :clang_getCursorPlatformAvailability, [Cursor.by_value, :pointer, String, :pointer, String, PlatformAvailability, :int], :int

.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 retrieve 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.



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

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:



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

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

.get_cursor_result_type(c) ⇒ Type

Retrieve the return type associated with a given cursor.

This only returns a valid type if the cursor refers to a function or method.

Parameters:

Returns:



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

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 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:



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

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:



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

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:



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

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:



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

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:



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

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 referenced object.

If the cursor refers to a C++ declaration, its access control level within its parent scope is returned. Otherwise, if the cursor refers to a base specifier or access specifier, the specifier itself is returned.

Parameters:

Returns:



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

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:



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

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(**CharS))
  • end_buf (FFI::Pointer(**CharS))
  • start_line (FFI::Pointer(*UInt))
  • start_column (FFI::Pointer(*UInt))
  • end_line (FFI::Pointer(*UInt))
  • end_column (FFI::Pointer(*UInt))

Returns:

  • (nil)


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

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().



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

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.



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

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

.get_diagnostic_category_name(category) ⇒ String

Retrieve the name of a particular diagnostic category. This

is now deprecated.  Use clang_getDiagnosticCategoryText()
instead.

Parameters:

  • category (Integer)

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

Returns:

  • (String)

    The name of the given diagnostic category.



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

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

.get_diagnostic_category_text(diagnostic) ⇒ String

Retrieve the diagnostic category text for a given diagnostic.

Parameters:

  • diagnostic (FFI::Pointer(Diagnostic))

Returns:

  • (String)

    The text of the given diagnostic category.



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

attach_function :get_diagnostic_category_text, :clang_getDiagnosticCategoryText, [:pointer], 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 (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.



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

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

.get_diagnostic_in_set(diags, index) ⇒ FFI::Pointer(Diagnostic)

Retrieve a diagnostic associated with the given CXDiagnosticSet.

Parameters:

  • diags (FFI::Pointer(DiagnosticSet))

    the CXDiagnosticSet 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().



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

attach_function :get_diagnostic_in_set, :clang_getDiagnosticInSet, [:pointer, :uint], :pointer

.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:



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

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)


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

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)


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

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 (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”.



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

attach_function :get_diagnostic_option, :clang_getDiagnosticOption, [:pointer, String], 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:



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

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

.get_diagnostic_set_from_tu(unit) ⇒ FFI::Pointer(DiagnosticSet)

Retrieve the complete set of diagnostics associated with a

translation unit.

Parameters:

Returns:

  • (FFI::Pointer(DiagnosticSet))


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

attach_function :get_diagnostic_set_from_tu, :clang_getDiagnosticSetFromTU, [TranslationUnitImpl], :pointer

.get_diagnostic_severity(diagnostic) ⇒ Symbol from _enum_diagnostic_severity_

Determine the severity of the given diagnostic.

Parameters:

  • diagnostic (FFI::Pointer(Diagnostic))

Returns:



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

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:



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

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

.get_element_type(t) ⇒ Type

Return the element type of an array, complex, or vector type.

If a type is passed in that is not an array, complex, or vector type, an invalid type is returned.

Parameters:

Returns:



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

attach_function :get_element_type, :clang_getElementType, [Type.by_value], Type.by_value

.get_enum_constant_decl_unsigned_value(c) ⇒ Integer

Retrieve the integer value of an enum constant declaration as an unsigned

long long.

If the cursor does not reference an enum constant declaration, ULLONG_MAX is returned. Since this is also potentially a valid constant value, the kind of the cursor must be verified before calling this function.

Parameters:

Returns:

  • (Integer)


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

attach_function :get_enum_constant_decl_unsigned_value, :clang_getEnumConstantDeclUnsignedValue, [Cursor.by_value], :ulong_long

.get_enum_constant_decl_value(c) ⇒ Integer

Retrieve the integer value of an enum constant declaration as a signed

long long.

If the cursor does not reference an enum constant declaration, LLONG_MIN is returned. Since this is also potentially a valid constant value, the kind of the cursor must be verified before calling this function.

Parameters:

Returns:

  • (Integer)


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

attach_function :get_enum_constant_decl_value, :clang_getEnumConstantDeclValue, [Cursor.by_value], :long_long

.get_enum_decl_integer_type(c) ⇒ Type

Retrieve the integer type of an enum declaration.

If the cursor does not reference an enum declaration, an invalid type is returned.

Parameters:

Returns:



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

attach_function :get_enum_decl_integer_type, :clang_getEnumDeclIntegerType, [Cursor.by_value], Type.by_value

.get_expansion_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 expansion, retrieves the location of the macro expansion.

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)


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

attach_function :get_expansion_location, :clang_getExpansionLocation, [SourceLocation.by_value, :pointer, :pointer, :pointer, :pointer], :void

.get_field_decl_bit_width(c) ⇒ Integer

Retrieve the bit width of a bit field declaration as an integer.

If a cursor that is not a bit field declaration is passed in, -1 is returned.

Parameters:

Returns:

  • (Integer)


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

attach_function :get_field_decl_bit_width, :clang_getFieldDeclBitWidth, [Cursor.by_value], :int

.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.



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

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

.get_file_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 expansion, return where the macro was expanded or where the macro argument was written, if the location points at a macro argument.

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)


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

attach_function :get_file_location, :clang_getFileLocation, [SourceLocation.by_value, :pointer, :pointer, :pointer, :pointer], :void

.get_file_name(s_file) ⇒ String

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

Parameters:

  • s_file (FFI::Pointer(File))

Returns:



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

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)


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

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

.get_file_unique_id(file, out_id) ⇒ Integer

Retrieve the unique ID for the given c file.

Parameters:

  • file (FFI::Pointer(File))

    the file to get the ID for.

  • out_id (FileUniqueID)

    stores the returned CXFileUniqueID.

Returns:

  • (Integer)

    If there was a failure getting the unique ID, returns non-zero, otherwise returns 0.



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

attach_function :get_file_unique_id, :clang_getFileUniqueID, [:pointer, FileUniqueID], :int

.get_function_type_calling_conv(t) ⇒ Symbol from _enum_calling_conv_

Retrieve the calling convention associated with a function type.

If a non-function type is passed in, CXCallingConv_Invalid is returned.

Parameters:

Returns:



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

attach_function :get_function_type_calling_conv, :clang_getFunctionTypeCallingConv, [Type.by_value], :calling_conv

.get_ib_outlet_collection_type(cursor) ⇒ Type

For cursors representing an iboutletcollection attribute,

this function returns the collection element type.

Parameters:

Returns:



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

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))


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

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)


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

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 #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)


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

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:



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

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:



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

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

.get_module_for_file(translation_unit_impl, file) ⇒ FFI::Pointer(Module)

Given a CXFile header file, return the module that contains it, if one exists.

Parameters:

Returns:

  • (FFI::Pointer(Module))


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

attach_function :get_module_for_file, :clang_getModuleForFile, [TranslationUnitImpl, :pointer], :pointer

.get_null_cursorCursor

Retrieve the NULL cursor, which represents no entity.

Returns:



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

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

.get_null_locationSourceLocation

Retrieve a NULL (invalid) source location.

Returns:



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

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

.get_null_rangeSourceRange

Retrieve a NULL (invalid) source range.

Returns:



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

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

.get_num_arg_types(t) ⇒ Integer

Retrieve the number of non-variadic parameters associated with a function type.

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

Parameters:

Returns:

  • (Integer)


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

attach_function :get_num_arg_types, :clang_getNumArgTypes, [Type.by_value], :int

.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)


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

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)


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

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

.get_num_diagnostics_in_set(diags) ⇒ Integer

Determine the number of diagnostics in a CXDiagnosticSet.

Parameters:

  • diags (FFI::Pointer(DiagnosticSet))

Returns:

  • (Integer)


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

attach_function :get_num_diagnostics_in_set, :clang_getNumDiagnosticsInSet, [:pointer], :uint

.get_num_elements(t) ⇒ Integer

Return the number of elements of an array or vector type.

If a type is passed in that is not an array or vector type, -1 is returned.

Parameters:

Returns:

  • (Integer)


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

attach_function :get_num_elements, :clang_getNumElements, [Type.by_value], :long_long

.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.



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

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();



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

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 base class, its protocols, or its categories’ protocols, 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. A method from an Objective-C implementation is considered to override the same methods as its corresponding method in the interface.

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)


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

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:



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

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

code #123 “dummy.c” 1

static int func(void)

return 0;

endcode

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 (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)


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

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

.get_range(begin_, end_) ⇒ SourceRange

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

Parameters:

Returns:



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

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:



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

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:



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

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.



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

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

.get_remappings_from_file_list(file_paths, num_files) ⇒ FFI::Pointer(Remapping)

Retrieve a remapping.

Parameters:

  • file_paths (FFI::Pointer(**CharS))

    pointer to an array of file paths containing remapping info.

  • num_files (Integer)

    number of file paths.

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.



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

attach_function :get_remappings_from_file_list, :clang_getRemappingsFromFileList, [:pointer, :uint], :pointer

.get_result_type(t) ⇒ Type

Retrieve the return type associated with a function type.

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

Parameters:

Returns:



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

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

.get_skipped_ranges(tu, file) ⇒ SourceRangeList

Retrieve all ranges that were skipped by the preprocessor.

The preprocessor will skip lines when they are surrounded by an if/ifdef/ifndef directive whose condition does not evaluate to true.

Parameters:

Returns:



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

attach_function :get_skipped_ranges, :clang_getSkippedRanges, [TranslationUnitImpl, :pointer], SourceRangeList

.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.



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

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)


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

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.



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

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:



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

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:



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

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:



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

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:



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

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:



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

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:



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

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:



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

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:



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

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:



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

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

.get_type_spelling(ct) ⇒ String

Pretty-print the underlying type using the rules of the language of the translation unit from which it came.

If the type is invalid, an empty string is returned.

Parameters:

Returns:



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

attach_function :get_type_spelling, :clang_getTypeSpelling, [Type.by_value], String.by_value

.get_typedef_decl_underlying_type(c) ⇒ Type

Retrieve the underlying type of a typedef declaration.

If the cursor does not reference a typedef declaration, an invalid type is returned.

Parameters:

Returns:



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

attach_function :get_typedef_decl_underlying_type, :clang_getTypedefDeclUnderlyingType, [Cursor.by_value], Type.by_value

.hash_cursor(cursor) ⇒ Integer

Compute a hash value for the given cursor.

Parameters:

Returns:

  • (Integer)


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

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

.index_action_create(c_idx) ⇒ FFI::Pointer(IndexAction)

An indexing action/session, to be applied to one or multiple translation units.

Parameters:

  • c_idx (FFI::Pointer(Index))

    The index object with which the index action will be associated.

Returns:

  • (FFI::Pointer(IndexAction))


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

attach_function :index_action_create, :clang_IndexAction_create, [:pointer], :pointer

.index_action_dispose(index_action) ⇒ nil

Destroy the given index action.

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

Parameters:

  • index_action (FFI::Pointer(IndexAction))

Returns:

  • (nil)


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

attach_function :index_action_dispose, :clang_IndexAction_dispose, [:pointer], :void

.index_get_client_container(idx_container_info) ⇒ FFI::Pointer(IdxClientContainer)

For retrieving a custom CXIdxClientContainer attached to a container.

Parameters:

Returns:

  • (FFI::Pointer(IdxClientContainer))


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

attach_function :index_get_client_container, :clang_index_getClientContainer, [IdxContainerInfo], :pointer

.index_get_client_entity(idx_entity_info) ⇒ FFI::Pointer(IdxClientEntity)

For retrieving a custom CXIdxClientEntity attached to an entity.

Parameters:

Returns:

  • (FFI::Pointer(IdxClientEntity))


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

attach_function :index_get_client_entity, :clang_index_getClientEntity, [IdxEntityInfo], :pointer

.index_get_cxx_class_decl_info(idx_decl_info) ⇒ IdxCXXClassDeclInfo

(Not documented)

Parameters:

Returns:



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

attach_function :index_get_cxx_class_decl_info, :clang_index_getCXXClassDeclInfo, [IdxDeclInfo], IdxCXXClassDeclInfo

.index_get_ib_outlet_collection_attr_info(idx_attr_info) ⇒ IdxIBOutletCollectionAttrInfo

(Not documented)

Parameters:

Returns:



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

attach_function :index_get_ib_outlet_collection_attr_info, :clang_index_getIBOutletCollectionAttrInfo, [IdxAttrInfo], IdxIBOutletCollectionAttrInfo

.index_get_obj_c_category_decl_info(idx_decl_info) ⇒ IdxObjCCategoryDeclInfo

(Not documented)

Parameters:

Returns:



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

attach_function :index_get_obj_c_category_decl_info, :clang_index_getObjCCategoryDeclInfo, [IdxDeclInfo], IdxObjCCategoryDeclInfo

.index_get_obj_c_container_decl_info(idx_decl_info) ⇒ IdxObjCContainerDeclInfo

(Not documented)

Parameters:

Returns:



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

attach_function :index_get_obj_c_container_decl_info, :clang_index_getObjCContainerDeclInfo, [IdxDeclInfo], IdxObjCContainerDeclInfo

.index_get_obj_c_interface_decl_info(idx_decl_info) ⇒ IdxObjCInterfaceDeclInfo

(Not documented)

Parameters:

Returns:



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

attach_function :index_get_obj_c_interface_decl_info, :clang_index_getObjCInterfaceDeclInfo, [IdxDeclInfo], IdxObjCInterfaceDeclInfo

.index_get_obj_c_property_decl_info(idx_decl_info) ⇒ IdxObjCPropertyDeclInfo

(Not documented)

Parameters:

Returns:



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

attach_function :index_get_obj_c_property_decl_info, :clang_index_getObjCPropertyDeclInfo, [IdxDeclInfo], IdxObjCPropertyDeclInfo

.index_get_obj_c_protocol_ref_list_info(idx_decl_info) ⇒ IdxObjCProtocolRefListInfo

(Not documented)

Parameters:

Returns:



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

attach_function :index_get_obj_c_protocol_ref_list_info, :clang_index_getObjCProtocolRefListInfo, [IdxDeclInfo], IdxObjCProtocolRefListInfo

.index_is_entity_obj_c_container_kind(idx_entity_kind) ⇒ Integer

(Not documented)

Parameters:

Returns:

  • (Integer)


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

attach_function :index_is_entity_obj_c_container_kind, :clang_index_isEntityObjCContainerKind, [:idx_entity_kind], :int

.index_loc_get_cx_source_location(loc) ⇒ SourceLocation

Retrieve the CXSourceLocation represented by the given CXIdxLoc.

Parameters:

Returns:



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

attach_function :index_loc_get_cx_source_location, :clang_indexLoc_getCXSourceLocation, [IdxLoc.by_value], SourceLocation.by_value

.index_loc_get_file_location(loc, index_file, file, line, column, offset) ⇒ nil

Retrieve the CXIdxFile, file, line, column, and offset represented by the given CXIdxLoc.

If the location refers into a macro expansion, retrieves the location of the macro expansion and if it refers into a macro argument retrieves the location of the argument.

Parameters:

  • loc (IdxLoc)
  • index_file (FFI::Pointer(*IdxClientFile))
  • file (FFI::Pointer(*File))
  • line (FFI::Pointer(*UInt))
  • column (FFI::Pointer(*UInt))
  • offset (FFI::Pointer(*UInt))

Returns:

  • (nil)


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

attach_function :index_loc_get_file_location, :clang_indexLoc_getFileLocation, [IdxLoc.by_value, :pointer, :pointer, :pointer, :pointer, :pointer], :void

.index_set_client_container(idx_container_info, idx_client_container) ⇒ nil

For setting a custom CXIdxClientContainer attached to a container.

Parameters:

  • idx_container_info (IdxContainerInfo)
  • idx_client_container (FFI::Pointer(IdxClientContainer))

Returns:

  • (nil)


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

attach_function :index_set_client_container, :clang_index_setClientContainer, [IdxContainerInfo, :pointer], :void

.index_set_client_entity(idx_entity_info, idx_client_entity) ⇒ nil

For setting a custom CXIdxClientEntity attached to an entity.

Parameters:

  • idx_entity_info (IdxEntityInfo)
  • idx_client_entity (FFI::Pointer(IdxClientEntity))

Returns:

  • (nil)


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

attach_function :index_set_client_entity, :clang_index_setClientEntity, [IdxEntityInfo, :pointer], :void

.index_source_file(index_action, client_data, index_callbacks, index_callbacks_size, index_options, source_filename, command_line_args, num_command_line_args, unsaved_files, num_unsaved_files, out_tu, tu_options) ⇒ Integer

Index the given source file and the translation unit corresponding to that file via callbacks implemented through #IndexerCallbacks.

Parameters:

  • index_action (FFI::Pointer(IndexAction))
  • client_data (FFI::Pointer(ClientData))

    pointer data supplied by the client, which will be passed to the invoked callbacks.

  • index_callbacks (IndexerCallbacks)

    Pointer to indexing callbacks that the client implements.

  • index_callbacks_size (Integer)

    Size of #IndexerCallbacks structure that gets passed in index_callbacks.

  • index_options (Integer)

    A bitmask of options that affects how indexing is performed. This should be a bitwise OR of the CXIndexOpt_XXX flags.

    param(out) out_TU pointer to store a c CXTranslationUnit that can be reused after indexing is finished. Set to c NULL if you do not require it.

  • source_filename (String)
  • command_line_args (FFI::Pointer(**CharS))
  • num_command_line_args (Integer)
  • unsaved_files (UnsavedFile)
  • num_unsaved_files (Integer)
  • out_tu (FFI::Pointer(*TranslationUnit))
  • tu_options (Integer)

Returns:

  • (Integer)

    0 on success or if there were errors from which the compiler could recover. If there is a failure from which the there is no recovery, returns a non-zero c CXErrorCode.

    The rest of the parameters are the same as #clang_parseTranslationUnit.



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

attach_function :index_source_file, :clang_indexSourceFile, [:pointer, :pointer, IndexerCallbacks, :uint, :uint, :string, :pointer, :int, UnsavedFile, :uint, :pointer, :uint], :int

.index_translation_unit(index_action, client_data, index_callbacks, index_callbacks_size, index_options, translation_unit_impl) ⇒ Integer

Index the given translation unit via callbacks implemented through #IndexerCallbacks.

The order of callback invocations is not guaranteed to be the same as when indexing a source file. The high level order will be:

-Preprocessor callbacks invocations
-Declaration/reference callbacks invocations
-Diagnostic callback invocations

The parameters are the same as #clang_indexSourceFile.

Parameters:

  • index_action (FFI::Pointer(IndexAction))
  • client_data (FFI::Pointer(ClientData))
  • index_callbacks (IndexerCallbacks)
  • index_callbacks_size (Integer)
  • index_options (Integer)
  • translation_unit_impl (TranslationUnitImpl)

Returns:

  • (Integer)

    If there is a failure from which the there is no recovery, returns non-zero, otherwise returns 0.



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

attach_function :index_translation_unit, :clang_indexTranslationUnit, [:pointer, :pointer, IndexerCallbacks, :uint, :uint, TranslationUnitImpl], :int

.is_attribute(cursor_kind) ⇒ Integer

Determine whether the given cursor kind represents an attribute.

Parameters:

Returns:

  • (Integer)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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

.is_function_type_variadic(t) ⇒ Integer

Return 1 if the CXType is a variadic function type, and 0 otherwise.

Parameters:

Returns:

  • (Integer)


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

attach_function :is_function_type_variadic, :clang_isFunctionTypeVariadic, [Type.by_value], :uint

.is_invalid(cursor_kind) ⇒ Integer

Determine whether the given cursor kind represents an invalid cursor.

Parameters:

Returns:

  • (Integer)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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

.load_diagnostics(file, error, error_string) ⇒ FFI::Pointer(DiagnosticSet)

Deserialize a set of diagnostics from a Clang diagnostics bitcode file.

Parameters:

  • file (String)

    The name of the file to deserialize.

  • error (FFI::Pointer(*LoadDiagError))

    A pointer to a enum value recording if there was a problem deserializing the diagnostics.

  • error_string (String)

    A pointer to a CXString for recording the error string if the file was not successfully loaded.

Returns:

  • (FFI::Pointer(DiagnosticSet))

    A loaded CXDiagnosticSet if successful, and NULL otherwise. These diagnostics should be released using clang_disposeDiagnosticSet().



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

attach_function :load_diagnostics, :clang_loadDiagnostics, [:string, :pointer, String], :pointer

.location_is_from_main_file(location) ⇒ Integer

Returns non-zero if the given source location is in the main file of the corresponding translation unit.

Parameters:

Returns:

  • (Integer)


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

attach_function :location_is_from_main_file, :clang_Location_isFromMainFile, [SourceLocation.by_value], :int

.location_is_in_system_header(location) ⇒ Integer

Returns non-zero if the given source location is in a system header.

Parameters:

Returns:

  • (Integer)


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

attach_function :location_is_in_system_header, :clang_Location_isInSystemHeader, [SourceLocation.by_value], :int

.module_get_ast_file(module_) ⇒ FFI::Pointer(File)

(Not documented)

Parameters:

  • module_ (FFI::Pointer(Module))

    a module object.

Returns:

  • (FFI::Pointer(File))

    the module file where the provided module object came from.



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

attach_function :module_get_ast_file, :clang_Module_getASTFile, [:pointer], :pointer

.module_get_full_name(module_) ⇒ String

(Not documented)

Parameters:

  • module_ (FFI::Pointer(Module))

    a module object.

Returns:

  • (String)

    the full name of the module, e.g. “std.vector”.



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

attach_function :module_get_full_name, :clang_Module_getFullName, [:pointer], String.by_value

.module_get_name(module_) ⇒ String

(Not documented)

Parameters:

  • module_ (FFI::Pointer(Module))

    a module object.

Returns:

  • (String)

    the name of the module, e.g. for the ‘std.vector’ sub-module it will return “vector”.



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

attach_function :module_get_name, :clang_Module_getName, [:pointer], String.by_value

.module_get_num_top_level_headers(translation_unit_impl, module_) ⇒ Integer

(Not documented)

Parameters:

  • translation_unit_impl (TranslationUnitImpl)
  • module_ (FFI::Pointer(Module))

    a module object.

Returns:

  • (Integer)

    the number of top level headers associated with this module.



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

attach_function :module_get_num_top_level_headers, :clang_Module_getNumTopLevelHeaders, [TranslationUnitImpl, :pointer], :uint

.module_get_parent(module_) ⇒ FFI::Pointer(Module)

(Not documented)

Parameters:

  • module_ (FFI::Pointer(Module))

    a module object.

Returns:

  • (FFI::Pointer(Module))

    the parent of a sub-module or NULL if the given module is top-level, e.g. for ‘std.vector’ it will return the ‘std’ module.



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

attach_function :module_get_parent, :clang_Module_getParent, [:pointer], :pointer

.module_get_top_level_header(translation_unit_impl, module_, index) ⇒ FFI::Pointer(File)

(Not documented)

Parameters:

  • translation_unit_impl (TranslationUnitImpl)
  • module_ (FFI::Pointer(Module))

    a module object.

  • index (Integer)

    top level header index (zero-based).

Returns:

  • (FFI::Pointer(File))

    the specified top level header associated with the module.



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

attach_function :module_get_top_level_header, :clang_Module_getTopLevelHeader, [TranslationUnitImpl, :pointer, :uint], :pointer

.module_is_system(module_) ⇒ Integer

(Not documented)

Parameters:

  • module_ (FFI::Pointer(Module))

    a module object.

Returns:

  • (Integer)

    non-zero if the module is a system one.



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

attach_function :module_is_system, :clang_Module_isSystem, [:pointer], :int

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

Same as c clang_parseTranslationUnit2, but returns the c CXTranslationUnit instead of an error code. In case of an error this routine returns a c NULL c CXTranslationUnit, without further detailed error codes.

Parameters:

  • c_idx (FFI::Pointer(Index))
  • source_filename (String)
  • command_line_args (FFI::Pointer(**CharS))
  • num_command_line_args (Integer)
  • unsaved_files (UnsavedFile)
  • num_unsaved_files (Integer)
  • options (Integer)

Returns:



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

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

.parse_translation_unit2(c_idx, source_filename, command_line_args, num_command_line_args, unsaved_files, num_unsaved_files, options, out_tu) ⇒ Symbol from _enum_error_code_

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 c command_line_args.

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

    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’, ‘-fsyntax-only’ (which is the default), and ‘-o <output file>’.

  • num_command_line_args (Integer)

    The number of command-line arguments in c 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.

    param(out) out_TU A non-NULL pointer to store the created c CXTranslationUnit, describing the parsed code and containing any diagnostics produced by the compiler.

  • out_tu (FFI::Pointer(*TranslationUnit))

Returns:

  • (Symbol from _enum_error_code_)

    Zero on success, otherwise returns an error code.



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

attach_function :parse_translation_unit2, :clang_parseTranslationUnit2, [:pointer, :string, :pointer, :int, UnsavedFile, :uint, :uint, :pointer], :error_code

.range_is_null(range) ⇒ Integer

Returns non-zero if p range is null.

Parameters:

Returns:

  • (Integer)


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

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)


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

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 (String)

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

  • transformed (String)

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

Returns:

  • (nil)


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

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

.remap_get_num_files(remapping) ⇒ Integer

Determine the number of remappings.

Parameters:

  • remapping (FFI::Pointer(Remapping))

Returns:

  • (Integer)


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

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 error code will be returned if reparsing was impossible, such that the translation unit is invalid. In such cases, the only valid call for c TU is c clang_disposeTranslationUnit(TU). The error codes returned by this routine are described by the c CXErrorCode enum.



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

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.



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

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 (CompletionResult)

    The set of results to sort.

  • num_results (Integer)

    The number of results in p Results.

Returns:

  • (nil)


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

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

.toggle_crash_recovery(is_enabled) ⇒ nil

Enable/disable crash recovery.

Parameters:

  • is_enabled (Integer)

    Flag to indicate if crash recovery is enabled. A non-zero value enables crash recovery, while 0 disables it.

Returns:

  • (nil)


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

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)


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

attach_function :tokenize, :clang_tokenize, [TranslationUnitImpl, SourceRange.by_value, :pointer, :pointer], :void

.type_get_align_of(t) ⇒ Integer

Return the alignment of a type in bytes as per C++(expr.alignof)

standard.

If the type declaration is invalid, CXTypeLayoutError_Invalid is returned. If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete

is returned.

If the type declaration is a dependent type, CXTypeLayoutError_Dependent is

returned.

If the type declaration is not a constant size type,

CXTypeLayoutError_NotConstantSize is returned.

Parameters:

Returns:

  • (Integer)


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

attach_function :type_get_align_of, :clang_Type_getAlignOf, [Type.by_value], :long_long

.type_get_class_type(t) ⇒ Type

Return the class type of an member pointer type.

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

Parameters:

Returns:



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

attach_function :type_get_class_type, :clang_Type_getClassType, [Type.by_value], Type.by_value

.type_get_cxx_ref_qualifier(t) ⇒ Symbol from _enum_ref_qualifier_kind_

Retrieve the ref-qualifier kind of a function or method.

The ref-qualifier is returned for C++ functions or methods. For other types or non-C++ declarations, CXRefQualifier_None is returned.

Parameters:

Returns:



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

attach_function :type_get_cxx_ref_qualifier, :clang_Type_getCXXRefQualifier, [Type.by_value], :ref_qualifier_kind

.type_get_num_template_arguments(t) ⇒ Integer

Returns the number of template arguments for given class template specialization, or -1 if type c T is not a class template specialization.

Variadic argument packs count as only one argument, and can not be inspected further.

Parameters:

Returns:

  • (Integer)


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

attach_function :type_get_num_template_arguments, :clang_Type_getNumTemplateArguments, [Type.by_value], :int

.type_get_offset_of(t, s) ⇒ Integer

Return the offset of a field named S in a record of type T in bits

as it would be returned by __offsetof__ as per C++11(18.2p4)

If the cursor is not a record field declaration, CXTypeLayoutError_Invalid

is returned.

If the field’s type declaration is an incomplete type,

CXTypeLayoutError_Incomplete is returned.

If the field’s type declaration is a dependent type,

CXTypeLayoutError_Dependent is returned.

If the field’s name S is not found,

CXTypeLayoutError_InvalidFieldName is returned.

Parameters:

Returns:

  • (Integer)


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

attach_function :type_get_offset_of, :clang_Type_getOffsetOf, [Type.by_value, :string], :long_long

.type_get_size_of(t) ⇒ Integer

Return the size of a type in bytes as per C++(expr.sizeof) standard.

If the type declaration is invalid, CXTypeLayoutError_Invalid is returned. If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete

is returned.

If the type declaration is a dependent type, CXTypeLayoutError_Dependent is

returned.

Parameters:

Returns:

  • (Integer)


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

attach_function :type_get_size_of, :clang_Type_getSizeOf, [Type.by_value], :long_long

.type_get_template_argument_as_type(t, i) ⇒ Type

Returns the type template argument of a template class specialization at given index.

This function only returns template type arguments and does not handle template template arguments or variadic packs.

Parameters:

  • t (Type)
  • i (Integer)

Returns:



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

attach_function :type_get_template_argument_as_type, :clang_Type_getTemplateArgumentAsType, [Type.by_value, :uint], Type.by_value

.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.



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

attach_function :visit_children, :clang_visitChildren, [Cursor.by_value, :cursor_visitor, :pointer], :uint

Instance Method Details

#cindex_version_stringize(major, minor) ⇒ Object



19
20
21
# File 'lib/ffi_gen/clang.rb', line 19

def cindex_version_stringize(major, minor)
  cindex_version_stringize(major, minor)
end