Class: FFI::Clang::Lib::CXIndexOptions

Inherits:
Struct
  • Object
show all
Defined in:
lib/ffi/clang/lib/index.rb

Overview

FFI struct for index creation options (libclang 17.0.0+).

The C struct uses bitfields for ExcludeDeclarationsFromPCH (bit 0), DisplayDiagnostics (bit 1), and StorePreamblesInMemory (bit 2). FFI doesn’t support bitfields, so these are packed into a single field. Use the helper methods to set them.

On Windows, libclang packs the unsigned bitfields into a 4-byte uint with alignment padding, making the struct 32 bytes. On Linux/macOS, they pack into 2 bytes after the uchars (24 bytes total).

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ CXIndexOptions

Create a new CXIndexOptions with size pre-populated.



69
70
71
72
73
# File 'lib/ffi/clang/lib/index.rb', line 69

def initialize(*args)
	super
	self[:size] = self.class.size
	@string_fields = {}
end

Instance Method Details

#display_diagnostics=(value) ⇒ Object

Set whether to display diagnostics.



95
96
97
# File 'lib/ffi/clang/lib/index.rb', line 95

def display_diagnostics=(value)
	set_bitfield(1, value)
end

#exclude_declarations_from_pch=(value) ⇒ Object

Set whether to exclude declarations from PCH.



89
90
91
# File 'lib/ffi/clang/lib/index.rb', line 89

def exclude_declarations_from_pch=(value)
	set_bitfield(0, value)
end

#invocation_emission_path=(value) ⇒ Object

Set the invocation emission path.



113
114
115
# File 'lib/ffi/clang/lib/index.rb', line 113

def invocation_emission_path=(value)
	store_string(:invocation_emission_path, value)
end

#preamble_storage_path=(value) ⇒ Object

Set the preamble storage path.



107
108
109
# File 'lib/ffi/clang/lib/index.rb', line 107

def preamble_storage_path=(value)
	store_string(:preamble_storage_path, value)
end

#store_preambles_in_memory=(value) ⇒ Object

Set whether to store preambles in memory.



101
102
103
# File 'lib/ffi/clang/lib/index.rb', line 101

def store_preambles_in_memory=(value)
	set_bitfield(2, value)
end

#thread_background_priority_for_editing=(value) ⇒ Object

Set the editing background thread priority policy.



83
84
85
# File 'lib/ffi/clang/lib/index.rb', line 83

def thread_background_priority_for_editing=(value)
	self[:thread_background_priority_for_editing] = value
end

#thread_background_priority_for_indexing=(value) ⇒ Object

Set the indexing background thread priority policy.



77
78
79
# File 'lib/ffi/clang/lib/index.rb', line 77

def thread_background_priority_for_indexing=(value)
	self[:thread_background_priority_for_indexing] = value
end