class FFI::Clang::Diagnostic
Public Class Methods
default_display_opts()
click to toggle source
# File lib/ffi/clang/diagnostic.rb, line 28 def self.default_display_opts Lib.opts_from Lib::DiagnosticDisplayOptions, Lib.default_diagnostic_display_options end
new(translation_unit, pointer)
click to toggle source
Calls superclass method
# File lib/ffi/clang/diagnostic.rb, line 32 def initialize(translation_unit, pointer) super pointer @translation_unit = translation_unit end
release(pointer)
click to toggle source
# File lib/ffi/clang/diagnostic.rb, line 38 def self.release(pointer) Lib.dispose_diagnostic(pointer) end
Public Instance Methods
category()
click to toggle source
# File lib/ffi/clang/diagnostic.rb, line 93 def category Lib.extract_string Lib.get_diagnostic_category_text(self) end
category_id()
click to toggle source
# File lib/ffi/clang/diagnostic.rb, line 97 def category_id Lib.get_diagnostic_category(self) end
children()
click to toggle source
# File lib/ffi/clang/diagnostic.rb, line 75 def children diagnostic_set = Lib.get_child_diagnostics(self) num_diagnostics = Lib.get_num_diagnostics_in_set(diagnostic_set) num_diagnostics.times.map { |i| Diagnostic.new(@translation_unit, Lib.get_diagnostic_in_set(diagnostic_set, i)) } end
disable_option()
click to toggle source
# File lib/ffi/clang/diagnostic.rb, line 87 def disable_option ptr = MemoryPointer.new Lib::CXString Lib.get_diagnostic_option(self, ptr) Lib.extract_string ptr end
enable_option()
click to toggle source
# File lib/ffi/clang/diagnostic.rb, line 83 def enable_option Lib.extract_string Lib.get_diagnostic_option(self, nil) end
fixits()
click to toggle source
# File lib/ffi/clang/diagnostic.rb, line 60 def fixits n = Lib.get_diagnostic_num_fix_its(self) n.times.map { |i| ptr = MemoryPointer.new Lib::CXSourceRange replace_text = Lib.extract_string(Lib.get_diagnostic_fix_it(self, i, ptr)) {text: replace_text, range: SourceRange.new(ptr)} } end
format(opts = {})
click to toggle source
# File lib/ffi/clang/diagnostic.rb, line 42 def format(opts = {}) cxstring = Lib.format_diagnostic(self, display_opts(opts)) Lib.extract_string cxstring end
inspect()
click to toggle source
# File lib/ffi/clang/diagnostic.rb, line 101 def inspect "#{self.location}: #{self.format}" end
location()
click to toggle source
# File lib/ffi/clang/diagnostic.rb, line 55 def location sl = Lib.get_diagnostic_location(self) ExpansionLocation.new sl end
ranges()
click to toggle source
# File lib/ffi/clang/diagnostic.rb, line 69 def ranges n = Lib.get_diagnostic_num_ranges(self) n.times.map {|i| SourceRange.new Lib.get_diagnostic_range(self, i)} end
severity()
click to toggle source
# File lib/ffi/clang/diagnostic.rb, line 47 def severity Lib.get_diagnostic_severity self end
spelling()
click to toggle source
# File lib/ffi/clang/diagnostic.rb, line 51 def spelling Lib.get_string Lib.get_diagnostic_spelling(self) end
Private Instance Methods
display_opts(opts)
click to toggle source
# File lib/ffi/clang/diagnostic.rb, line 107 def display_opts(opts) if opts.empty? Lib.default_diagnostic_display_options else Lib.bitmask_from Lib::DiagnosticDisplayOptions, opts end end