Class: FFI::Clang::CompilationDatabase
- Inherits:
-
AutoPointer
- Object
- AutoPointer
- FFI::Clang::CompilationDatabase
- Defined in:
- lib/ffi/clang/compilation_database.rb
Overview
Represents a compilation database for a project.
Defined Under Namespace
Classes: CompileCommand, CompileCommands, DatabaseLoadError
Class Method Summary collapse
-
.release(pointer) ⇒ Object
Release the compilation database pointer.
Instance Method Summary collapse
-
#all_compile_commands ⇒ Object
Get all compile commands in the database.
-
#compile_commands(filename) ⇒ Object
Get compile commands for a specific file.
-
#initialize(dirpath) ⇒ CompilationDatabase
constructor
Initialize a compilation database from a directory.
Constructor Details
#initialize(dirpath) ⇒ CompilationDatabase
Initialize a compilation database from a directory.
19 20 21 22 23 24 25 26 27 |
# File 'lib/ffi/clang/compilation_database.rb', line 19 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
Release the compilation database pointer.
31 32 33 |
# File 'lib/ffi/clang/compilation_database.rb', line 31 def self.release(pointer) Lib.compilation_database_dispose(pointer) end |
Instance Method Details
#all_compile_commands ⇒ Object
Get all compile commands in the database.
44 45 46 |
# File 'lib/ffi/clang/compilation_database.rb', line 44 def all_compile_commands CompileCommands.new Lib.compilation_database_get_all_compile_commands(self), self end |
#compile_commands(filename) ⇒ Object
Get compile commands for a specific file.
38 39 40 |
# File 'lib/ffi/clang/compilation_database.rb', line 38 def compile_commands(filename) CompileCommands.new Lib.compilation_database_get_compile_commands(self, filename), self end |