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.



28
29
30
31
32
33
34
35
36
# File 'lib/ffi/clang/compilation_database.rb', line 28

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



38
39
40
# File 'lib/ffi/clang/compilation_database.rb', line 38

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

Instance Method Details

#all_compile_commandsObject



46
47
48
# File 'lib/ffi/clang/compilation_database.rb', line 46

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

#compile_commands(filename) ⇒ Object



42
43
44
# File 'lib/ffi/clang/compilation_database.rb', line 42

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