lib/ffi/clang/diagnostic.rb in ffi-clang-0.1.0 vs lib/ffi/clang/diagnostic.rb in ffi-clang-0.1.1
- old
+ new
@@ -1,5 +1,6 @@
+# -*- coding: utf-8 -*-
# Copyright, 2010-2012 by Jari Bakken.
# Copyright, 2013, by Samuel G. D. Williams. <http://www.codeotaku.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -18,25 +19,21 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
require 'ffi/clang/lib/diagnostic'
+require 'ffi/clang/source_range'
module FFI
module Clang
- class SourceRange
- def initialize(range_struct)
- end
- end
-
class Diagnostic < AutoPointer
def initialize(translation_unit, pointer)
super pointer
-
+
@translation_unit = translation_unit
end
-
+
def self.release(pointer)
Lib.dispose_diagnostic(pointer)
end
def format(opts = {})
@@ -50,16 +47,20 @@
def spelling
Lib.get_string Lib.get_diagnostic_spelling(self)
end
+ def location
+ sl = Lib.get_diagnostic_location(self)
+ SourceLocation.new sl
+ end
+
def fixits
raise NotImplementedError
# unsigned clang_getDiagnosticNumFixIts(CXDiagnostic Diag);
# – CXString clang_getDiagnosticFixIt(CXDiagnostic Diag,
# unsigned FixIt,
# CXSourceRange *ReplacementRange);
-
end
def ranges
n = Lib.get_diagnostic_num_ranges(self)