Module: FFI::Clang::Lib

Extended by:
Library
Defined in:
lib/ffi/clang/lib.rb,
lib/ffi/clang/lib/file.rb,
lib/ffi/clang/lib/type.rb,
lib/ffi/clang/lib/index.rb,
lib/ffi/clang/lib/token.rb,
lib/ffi/clang/lib/cursor.rb,
lib/ffi/clang/lib/string.rb,
lib/ffi/clang/lib/comment.rb,
lib/ffi/clang/lib/diagnostic.rb,
lib/ffi/clang/lib/inclusions.rb,
lib/ffi/clang/lib/source_range.rb,
lib/ffi/clang/lib/clang_version.rb,
lib/ffi/clang/lib/code_completion.rb,
lib/ffi/clang/lib/printing_policy.rb,
lib/ffi/clang/lib/source_location.rb,
lib/ffi/clang/lib/translation_unit.rb,
lib/ffi/clang/lib/compilation_database.rb

Defined Under Namespace

Classes: CXCodeCompleteResults, CXComment, CXCompletionResult, CXCursor, CXCursorAndRangeVisitor, CXFileUniqueID, CXIndexOptions, CXPlatformAvailability, CXSourceLocation, CXSourceRange, CXString, CXTUResourceUsage, CXTUResourceUsageEntry, CXToken, CXType, CXUnsavedFile, CXVersion, TokensPointer

Constant Summary collapse

CUSOR_TRANSLATION_UNIT =

In Clang 15 the enum value changed from 300 to 350!

Clang.clang_version < Gem::Version.new('15.0.0') ? 300 : 350
DiagnosticDisplayOptions =
enum [
	:source_location, 0x01,
	:column, 0x02,
	:source_ranges, 0x04,
	:option, 0x08,
	:category_id, 0x10,
	:category_name , 0x20,
]
CodeCompleteFlags =
enum :code_complete_flags, [
	:include_macros, 0x01,
	:include_code_patterns, 0x02,
	:include_brief_comments, 0x04
]
CompletionContext =
enum :completion_context, [
	:unexposed, 0,
	:any_type, 1 << 0,
	:any_value, 1 << 1,
	:objc_object_value, 1 << 2,
	:objc_selector_value, 1 << 3,
	:cxx_class_type_value, 1 << 4,
	:dot_member_access, 1 << 5,
	:arrow_member_access, 1 << 6,
	:objc_property_access, 1 << 7,
	:enum_tag, 1 << 8,
	:union_tag, 1 << 9,
	:struct_tag, 1 << 10,
	:class_tag, 1 << 11,
	:namespace, 1 << 12,
	:nested_name_specifier, 1 << 13,
	:objc_interface, 1 << 14,
	:objc_protocol, 1 << 15,
	:objc_category, 1 << 16,
	:objc_instance_message, 1 << 17,
	:objc_class_message, 1 << 18,
	:objc_selector_name, 1 << 19,
	:macro_name, 1 << 20,
	:natural_language, 1 << 21,
	:unknown, ((1 << 22) - 1),
]
PrintingPolicyProperty =
enum [:printing_policy_indentation,
:printing_policy_suppress_specifiers,
:printing_policy_suppress_tag_keyword,
:printing_policy_include_tag_definition,
:printing_policy_suppress_scope,
:printing_policy_suppress_unwritten_scope,
:printing_policy_suppress_initializers,
:printing_policy_constant_array_aize_as_written,
:printing_policy_anonymous_tag_locations,
:printing_policy_suppress_strong_lifetime,
:printing_policy_suppress_lifetime_qualifiers,
:printing_policy_suppress_template_args_in_cxx_constructors,
:printing_policy_bool,
:printing_policy_restrict,
:printing_policy_alignof,
:printing_policy_underscore_alignof,
:printing_policy_use_void_for_zero_params,
:printing_policy_terse_output,
:printing_policy_polish_for_declaration,
:printing_policy_half,
:printing_policy_msw_char,
:printing_policy_include_new_lines,
:printing_policy_msvc_formatting,
:printing_policy_constants_as_written,
:printing_policy_suppress_implicit_base,
:printing_policy_fully_qualified_name,
:printing_policy_last_property]
TranslationUnitFlags =
enum [
	:none, 0x0,
	:detailed_preprocessing_record, 0x01,
	:incomplete, 0x02,
	:precompiled_preamble, 0x04,
	:cache_completion_results, 0x08,
	:for_serialization, 0x10,
	:cxx_chained_pch, 0x20,
	:skip_function_bodies, 0x40,
	:include_brief_comments_in_code_completion, 0x80,
	:create_preamble_on_first_parse, 0x100,
	:keep_going, 0x200,
	:single_file_parse, 0x400,
	:limit_skip_function_bodies_to_preamble, 0x800,
	:include_attributed_type, 0x1000,
	:visit_implicit_attributes, 0x2000,
	:ignore_non_errors_from_included_files, 0x4000,
	:retain_excluded_conditional_blocks, 0x8000,
]
SaveTranslationUnitFlags =
enum [
	:save_translation_unit_none, 0x0,
]
SaveError =
enum [
	:none, 0,
	:unknown, 1,
	:translation_errors, 2,
	:invalid_translation_unit, 3
]
ReparseFlags =
enum [
	:none, 0x0,
]
ErrorCodes =
enum [
	:cx_error_success, 0,
	:cx_error_failure, 1,
	:cx_error_crashed, 2,
	:cx_error_invalid_arguments, 3,
	:cx_error_ast_read_error, 4,
]
CompilationDatabaseError =
enum [
	:no_error, 0,
	:can_not_load_database, 1,
]

Class Method Summary collapse

Class Method Details

.bitmask_from(enum, opts) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/ffi/clang/lib.rb', line 70

def self.bitmask_from(enum, opts)
	bitmask = 0

	opts.each do |symbol|
		if int = enum[symbol]
			bitmask |= int
		else
					raise Error, "unknown option: #{symbol}, expected one of #{enum.symbols}"
		end
	end

	bitmask
end

.extract_string(cxstring) ⇒ Object



19
20
21
22
23
24
# File 'lib/ffi/clang/lib/string.rb', line 19

def self.extract_string(cxstring)
	result = get_string(cxstring)
	dispose_string cxstring

	return result
end

.opts_from(enum, bitmask) ⇒ Object



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/ffi/clang/lib.rb', line 84

def self.opts_from(enum, bitmask)
	bit = 1
	result = []
	while bitmask != 0
		if bitmask & 1
			if symbol = enum[bit]
				result << symbol
			else
				raise(Error, "unknown values: #{bit}, expected one of #{enum.symbols}")
			end
		end
		bitmask >>= 1
		bit <<= 1
	end
	result
end