Class: FFI::Clang::CompilationDatabase

Inherits:
AutoPointer
  • Object
show all
Defined in:
lib/ffi/clang/compilation_database.rb

Defined Under Namespace

Classes: CompileCommand, CompileCommands, DatabaseLoadError

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dirpath) ⇒ CompilationDatabase

Returns a new instance of CompilationDatabase.



14
15
16
17
18
19
20
21
22
# File 'lib/ffi/clang/compilation_database.rb', line 14

def initialize(dirpath)
	uint_ptr = MemoryPointer.new :uint
	cdb_ptr = Lib.compilation_database_from_directory(dirpath, uint_ptr)
	error_code = Lib::CompilationDatabaseError[uint_ptr.read_uint]
	if error_code != :no_error
		raise DatabaseLoadError, "Cannot load database: #{error_code}"
	end
	super cdb_ptr
end

Class Method Details

.release(pointer) ⇒ Object



24
25
26
# File 'lib/ffi/clang/compilation_database.rb', line 24

def self.release(pointer)
	Lib.compilation_database_dispose(pointer)
end

Instance Method Details

#all_compile_commandsObject



32
33
34
# File 'lib/ffi/clang/compilation_database.rb', line 32

def all_compile_commands
	CompileCommands.new Lib.compilation_database_get_all_compile_commands(self), self
end

#compile_commands(filename) ⇒ Object



28
29
30
# File 'lib/ffi/clang/compilation_database.rb', line 28

def compile_commands(filename)
	CompileCommands.new Lib.compilation_database_get_compile_commands(self, filename), self
end