ffi-clang 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +4 -0
- data/.travis.yml +20 -9
- data/Gemfile +10 -1
- data/README.md +1 -1
- data/Rakefile +9 -9
- data/examples/docs.cpp +25 -0
- data/examples/docs.rb +31 -0
- data/ffi-clang.gemspec +1 -1
- data/lib/ffi/clang.rb +16 -13
- data/lib/ffi/clang/clang_version.rb +29 -0
- data/lib/ffi/clang/code_completion.rb +1 -1
- data/lib/ffi/clang/comment.rb +8 -4
- data/lib/ffi/clang/compilation_database.rb +1 -1
- data/lib/ffi/clang/cursor.rb +42 -15
- data/lib/ffi/clang/diagnostic.rb +6 -2
- data/lib/ffi/clang/file.rb +6 -9
- data/lib/ffi/clang/index.rb +4 -4
- data/lib/ffi/clang/lib.rb +1 -1
- data/lib/ffi/clang/lib/{utils.rb → clang_version.rb} +1 -1
- data/lib/ffi/clang/lib/code_completion.rb +2 -3
- data/lib/ffi/clang/lib/comment.rb +0 -2
- data/lib/ffi/clang/lib/compilation_database.rb +6 -9
- data/lib/ffi/clang/lib/cursor.rb +10 -18
- data/lib/ffi/clang/lib/diagnostic.rb +4 -4
- data/lib/ffi/clang/lib/file.rb +4 -6
- data/lib/ffi/clang/lib/inclusions.rb +2 -2
- data/lib/ffi/clang/lib/index.rb +0 -2
- data/lib/ffi/clang/lib/source_location.rb +6 -8
- data/lib/ffi/clang/lib/source_range.rb +1 -1
- data/lib/ffi/clang/lib/string.rb +0 -2
- data/lib/ffi/clang/lib/translation_unit.rb +2 -2
- data/lib/ffi/clang/lib/type.rb +8 -17
- data/lib/ffi/clang/source_location.rb +2 -2
- data/lib/ffi/clang/source_range.rb +16 -3
- data/lib/ffi/clang/token.rb +4 -4
- data/lib/ffi/clang/translation_unit.rb +5 -5
- data/lib/ffi/clang/type.rb +0 -14
- data/lib/ffi/clang/version.rb +2 -2
- data/spec/{clang → ffi/clang}/code_completion_spec.rb +6 -6
- data/spec/{clang → ffi/clang}/comment_spec.rb +22 -39
- data/spec/{clang → ffi/clang}/compilation_database_spec.rb +8 -10
- data/spec/{clang → ffi/clang}/cursor_spec.rb +89 -97
- data/spec/{clang → ffi/clang}/diagnostic_spec.rb +9 -10
- data/spec/{clang → ffi/clang}/file_spec.rb +3 -5
- data/spec/{fixtures → ffi/clang/fixtures}/a.c +0 -0
- data/spec/{fixtures → ffi/clang/fixtures}/canonical.c +0 -0
- data/spec/ffi/clang/fixtures/class.cpp +8 -0
- data/spec/{fixtures → ffi/clang/fixtures}/compile_commands.json +0 -0
- data/spec/{fixtures → ffi/clang/fixtures}/completion.cxx +0 -0
- data/spec/{fixtures → ffi/clang/fixtures}/docs.c +0 -0
- data/spec/{fixtures → ffi/clang/fixtures}/docs.cc +0 -0
- data/spec/{fixtures → ffi/clang/fixtures}/docs.h +0 -0
- data/spec/{fixtures → ffi/clang/fixtures}/list.c +0 -0
- data/spec/{fixtures → ffi/clang/fixtures}/location1.c +0 -0
- data/spec/ffi/clang/fixtures/simple.ast +0 -0
- data/spec/{fixtures → ffi/clang/fixtures}/simple.c +0 -0
- data/spec/{fixtures → ffi/clang/fixtures}/test.cxx +0 -0
- data/spec/{clang → ffi/clang}/index_spec.rb +17 -14
- data/spec/{clang → ffi/clang}/source_location_spec.rb +12 -14
- data/spec/{clang → ffi/clang}/source_range_spec.rb +12 -14
- data/spec/{clang → ffi/clang}/token_spec.rb +6 -8
- data/spec/{clang → ffi/clang}/translation_unit_spec.rb +28 -30
- data/spec/{clang → ffi/clang}/type_spec.rb +17 -33
- data/spec/ffi/clang/version_spec.rb +28 -0
- data/spec/spec_helper.rb +11 -37
- metadata +61 -55
- data/lib/ffi/clang/utils.rb +0 -89
- data/spec/clang/utils_spec.rb +0 -60
    
        data/lib/ffi/clang/lib.rb
    CHANGED
    
    
| @@ -18,9 +18,8 @@ | |
| 18 18 | 
             
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 19 19 | 
             
            # THE SOFTWARE.
         | 
| 20 20 |  | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
            require 'ffi/clang/lib/diagnostic'
         | 
| 21 | 
            +
            require_relative 'cursor'
         | 
| 22 | 
            +
            require_relative 'diagnostic'
         | 
| 24 23 |  | 
| 25 24 | 
             
            module FFI
         | 
| 26 25 | 
             
            	module Clang
         | 
| @@ -34,9 +34,7 @@ module FFI | |
| 34 34 | 
             
            			attach_function :compilation_database_from_directory, :clang_CompilationDatabase_fromDirectory, [:string, :pointer], :CXCompilationDatabase
         | 
| 35 35 | 
             
            			attach_function :compilation_database_dispose, :clang_CompilationDatabase_dispose, [:CXCompilationDatabase], :uint
         | 
| 36 36 | 
             
            			attach_function :compilation_database_get_compile_commands, :clang_CompilationDatabase_getCompileCommands, [:CXCompilationDatabase, :string], :CXCompileCommands
         | 
| 37 | 
            -
            			 | 
| 38 | 
            -
            				attach_function :compilation_database_get_all_compile_commands, :clang_CompilationDatabase_getAllCompileCommands, [:CXCompilationDatabase], :CXCompileCommands
         | 
| 39 | 
            -
            			end
         | 
| 37 | 
            +
            			attach_function :compilation_database_get_all_compile_commands, :clang_CompilationDatabase_getAllCompileCommands, [:CXCompilationDatabase], :CXCompileCommands
         | 
| 40 38 |  | 
| 41 39 | 
             
            			# CompilationDatabase::CompileCommands
         | 
| 42 40 | 
             
            			attach_function :compile_commands_dispose, :clang_CompileCommands_dispose, [:CXCompileCommands], :void
         | 
| @@ -47,12 +45,11 @@ module FFI | |
| 47 45 | 
             
            			attach_function :compile_command_get_directory, :clang_CompileCommand_getDirectory, [:CXCompileCommand], CXString.by_value
         | 
| 48 46 | 
             
            			attach_function :compile_command_get_num_args, :clang_CompileCommand_getNumArgs, [:CXCompileCommand], :uint
         | 
| 49 47 | 
             
            			attach_function :compile_command_get_arg, :clang_CompileCommand_getArg, [:CXCompileCommand, :uint], CXString.by_value
         | 
| 50 | 
            -
            			 | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
            			end
         | 
| 48 | 
            +
            			
         | 
| 49 | 
            +
            			# Thease functions are not exposed by libclang.so privided by packages.
         | 
| 50 | 
            +
            			# attach_function :compile_command_get_num_mapped_sources, :clang_CompileCommand_getNumMappedSources, [:CXCompileCommand], :uint
         | 
| 51 | 
            +
            			# attach_function :compile_command_get_mapped_source_path, :clang_CompileCommand_getMappedSourcePath, [:CXCompileCommand, :uint], CXString.by_value
         | 
| 52 | 
            +
            			# attach_function :compile_command_get_mapped_source_content, :clang_CompileCommand_getMappedSourceContent, [:CXCompileCommand, :uint], CXString.by_value
         | 
| 56 53 | 
             
            		end
         | 
| 57 54 | 
             
            	end
         | 
| 58 55 | 
             
            end
         | 
    
        data/lib/ffi/clang/lib/cursor.rb
    CHANGED
    
    | @@ -21,11 +21,10 @@ | |
| 21 21 | 
             
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 22 22 | 
             
            # THE SOFTWARE.
         | 
| 23 23 |  | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
            require 'ffi/clang/utils'
         | 
| 24 | 
            +
            require_relative 'translation_unit'
         | 
| 25 | 
            +
            require_relative 'diagnostic'
         | 
| 26 | 
            +
            require_relative 'comment'
         | 
| 27 | 
            +
            require_relative 'type'
         | 
| 29 28 |  | 
| 30 29 | 
             
            module FFI
         | 
| 31 30 | 
             
            	module Clang
         | 
| @@ -259,16 +258,14 @@ module FFI | |
| 259 258 |  | 
| 260 259 | 
             
            			attach_function :is_virtual_base, :clang_isVirtualBase, [CXCursor.by_value], :uint
         | 
| 261 260 | 
             
            			attach_function :is_dynamic_call, :clang_Cursor_isDynamicCall, [CXCursor.by_value], :uint
         | 
| 262 | 
            -
            			 | 
| 263 | 
            -
             | 
| 264 | 
            -
            			end
         | 
| 261 | 
            +
            			attach_function :is_variadic, :clang_Cursor_isVariadic, [CXCursor.by_value], :uint
         | 
| 262 | 
            +
             | 
| 265 263 | 
             
            			attach_function :is_definition, :clang_isCursorDefinition, [CXCursor.by_value], :uint
         | 
| 266 264 | 
             
            			attach_function :cxx_method_is_static, :clang_CXXMethod_isStatic, [CXCursor.by_value], :uint
         | 
| 267 265 | 
             
            			attach_function :cxx_method_is_virtual, :clang_CXXMethod_isVirtual, [CXCursor.by_value], :uint
         | 
| 268 266 |  | 
| 269 | 
            -
            			 | 
| 270 | 
            -
             | 
| 271 | 
            -
            			end
         | 
| 267 | 
            +
            			attach_function :cxx_method_is_pure_virtual, :clang_CXXMethod_isPureVirtual, [CXCursor.by_value], :uint
         | 
| 268 | 
            +
            			
         | 
| 272 269 | 
             
            			attach_function :cxx_get_access_specifier, :clang_getCXXAccessSpecifier, [CXCursor.by_value], :access_specifier
         | 
| 273 270 |  | 
| 274 271 | 
             
            			enum :language_kind, [:invalid, :c, :obj_c, :c_plus_plus]
         | 
| @@ -330,10 +327,8 @@ module FFI | |
| 330 327 | 
             
            			attach_function :get_included_file, :clang_getIncludedFile, [CXCursor.by_value], :CXFile
         | 
| 331 328 | 
             
            			attach_function :get_cursor_hash, :clang_hashCursor, [CXCursor.by_value], :uint
         | 
| 332 329 |  | 
| 333 | 
            -
            			 | 
| 334 | 
            -
             | 
| 335 | 
            -
            				attach_function :get_field_decl_bit_width, :clang_getFieldDeclBitWidth, [CXCursor.by_value], :int
         | 
| 336 | 
            -
            			end
         | 
| 330 | 
            +
            			attach_function :is_bit_field,:clang_Cursor_isBitField, [CXCursor.by_value], :uint
         | 
| 331 | 
            +
            			attach_function :get_field_decl_bit_width, :clang_getFieldDeclBitWidth, [CXCursor.by_value], :int
         | 
| 337 332 |  | 
| 338 333 | 
             
            			attach_function :get_overloaded_decl, :clang_getOverloadedDecl, [CXCursor.by_value, :uint], CXCursor.by_value
         | 
| 339 334 | 
             
            			attach_function :get_num_overloaded_decls, :clang_getNumOverloadedDecls, [CXCursor.by_value], :uint
         | 
| @@ -350,13 +345,10 @@ module FFI | |
| 350 345 | 
             
            			attach_function :dispose_overridden_cursors, :clang_disposeOverriddenCursors, [:pointer], :void
         | 
| 351 346 |  | 
| 352 347 | 
             
            			attach_function :get_typedef_decl_unerlying_type, :clang_getTypedefDeclUnderlyingType, [CXCursor.by_value], CXType.by_value
         | 
| 353 | 
            -
            			attach_function :get_type_declaration, :clang_getTypeDeclaration, [CXType.by_value], CXCursor.by_value
         | 
| 354 348 |  | 
| 355 349 | 
             
            			attach_function :get_enum_type, :clang_getEnumDeclIntegerType, [CXCursor.by_value], CXType.by_value
         | 
| 356 350 |  | 
| 357 351 | 
             
            			attach_function :get_num_args, :clang_Cursor_getNumArguments, [CXCursor.by_value], :int
         | 
| 358 | 
            -
             | 
| 359 | 
            -
            			attach_function :is_variadic, :clang_Cursor_isVariadic, [CXCursor.by_value], :uint
         | 
| 360 352 | 
             
            		end
         | 
| 361 353 | 
             
            	end
         | 
| 362 354 | 
             
            end
         | 
| @@ -19,9 +19,9 @@ | |
| 19 19 | 
             
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 20 20 | 
             
            # THE SOFTWARE.
         | 
| 21 21 |  | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 22 | 
            +
            require_relative 'translation_unit'
         | 
| 23 | 
            +
            require_relative 'source_location'
         | 
| 24 | 
            +
            require_relative 'string'
         | 
| 25 25 |  | 
| 26 26 | 
             
            module FFI
         | 
| 27 27 | 
             
            	module Clang
         | 
| @@ -54,7 +54,7 @@ module FFI | |
| 54 54 | 
             
            			attach_function :dispose_diagnostic, :clang_disposeDiagnostic, [:CXDiagnostic], :void
         | 
| 55 55 |  | 
| 56 56 | 
             
            			# DiagnosticSet (not used yet)
         | 
| 57 | 
            -
            			# attach_function : | 
| 57 | 
            +
            			# attach_function :get_diagnostic_set_from_translation_unit, :clang_getDiagnosticSetFromTU, [:CXTranslationUnit], :CXDiagnosticSet
         | 
| 58 58 | 
             
            			# attach_function :dispose_diagnostic_set, :clang_disposeDiagnosticSet, [:CXDiagnosticSet], :void
         | 
| 59 59 | 
             
            			# attach_function :load_diagnostics, :clang_loadDiagnostics, [:string, :pointer, :pointer], :CXDiagnosticSet
         | 
| 60 60 |  | 
    
        data/lib/ffi/clang/lib/file.rb
    CHANGED
    
    | @@ -20,9 +20,8 @@ | |
| 20 20 | 
             
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 21 21 | 
             
            # THE SOFTWARE.
         | 
| 22 22 |  | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
            require 'ffi/clang/utils'
         | 
| 23 | 
            +
            require_relative 'string'
         | 
| 24 | 
            +
            require_relative 'translation_unit'
         | 
| 26 25 |  | 
| 27 26 | 
             
            module FFI
         | 
| 28 27 | 
             
            	module Clang
         | 
| @@ -49,9 +48,8 @@ module FFI | |
| 49 48 | 
             
            			attach_function :get_file_name, :clang_getFileName, [:CXFile], CXString.by_value
         | 
| 50 49 | 
             
            			attach_function :get_file_time, :clang_getFileTime, [:CXFile], :time_t
         | 
| 51 50 | 
             
            			attach_function :is_file_multiple_include_guarded, :clang_isFileMultipleIncludeGuarded, [:CXTranslationUnit, :CXFile], :int
         | 
| 52 | 
            -
            			 | 
| 53 | 
            -
             | 
| 54 | 
            -
            			end
         | 
| 51 | 
            +
            			
         | 
| 52 | 
            +
            			attach_function :get_file_unique_id, :clang_getFileUniqueID, [:CXFile, :pointer], :int
         | 
| 55 53 | 
             
            		end
         | 
| 56 54 | 
             
            	end
         | 
| 57 55 | 
             
            end
         | 
| @@ -18,8 +18,8 @@ | |
| 18 18 | 
             
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 19 19 | 
             
            # THE SOFTWARE.
         | 
| 20 20 |  | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 21 | 
            +
            require_relative 'file'
         | 
| 22 | 
            +
            require_relative 'source_location'
         | 
| 23 23 |  | 
| 24 24 | 
             
            module FFI
         | 
| 25 25 | 
             
            	module Clang
         | 
    
        data/lib/ffi/clang/lib/index.rb
    CHANGED
    
    
| @@ -20,7 +20,7 @@ | |
| 20 20 | 
             
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 21 21 | 
             
            # THE SOFTWARE.
         | 
| 22 22 |  | 
| 23 | 
            -
             | 
| 23 | 
            +
            require_relative 'file'
         | 
| 24 24 |  | 
| 25 25 | 
             
            module FFI
         | 
| 26 26 | 
             
            	module Clang
         | 
| @@ -39,15 +39,13 @@ module FFI | |
| 39 39 | 
             
            			attach_function :get_location_offset, :clang_getLocationForOffset, [:CXTranslationUnit, :CXFile, :uint], CXSourceLocation.by_value
         | 
| 40 40 | 
             
            			attach_function :get_expansion_location, :clang_getExpansionLocation, [CXSourceLocation.by_value, :pointer, :pointer, :pointer, :pointer], :void
         | 
| 41 41 | 
             
            			attach_function :get_presumed_location, :clang_getPresumedLocation, [CXSourceLocation.by_value, :pointer, :pointer, :pointer], :void
         | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 42 | 
            +
             | 
| 43 | 
            +
            			attach_function :get_file_location, :clang_getFileLocation, [CXSourceLocation.by_value, :pointer, :pointer, :pointer, :pointer], :void
         | 
| 44 | 
            +
             | 
| 45 45 | 
             
            			attach_function :get_spelling_location, :clang_getSpellingLocation, [CXSourceLocation.by_value, :pointer, :pointer, :pointer, :pointer], :void
         | 
| 46 46 |  | 
| 47 | 
            -
            			 | 
| 48 | 
            -
             | 
| 49 | 
            -
            				attach_function :location_is_from_main_file, :clang_Location_isFromMainFile, [CXSourceLocation.by_value], :int
         | 
| 50 | 
            -
            			end
         | 
| 47 | 
            +
            			attach_function :location_in_system_header, :clang_Location_isInSystemHeader, [CXSourceLocation.by_value], :int
         | 
| 48 | 
            +
            			attach_function :location_is_from_main_file, :clang_Location_isFromMainFile, [CXSourceLocation.by_value], :int
         | 
| 51 49 | 
             
            		end
         | 
| 52 50 | 
             
            	end
         | 
| 53 51 | 
             
            end
         | 
    
        data/lib/ffi/clang/lib/string.rb
    CHANGED
    
    
| @@ -20,7 +20,7 @@ | |
| 20 20 | 
             
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 21 21 | 
             
            # THE SOFTWARE.
         | 
| 22 22 |  | 
| 23 | 
            -
             | 
| 23 | 
            +
            require_relative 'index'
         | 
| 24 24 |  | 
| 25 25 | 
             
            module FFI
         | 
| 26 26 | 
             
            	module Clang
         | 
| @@ -47,7 +47,7 @@ module FFI | |
| 47 47 | 
             
            				:none, 0,
         | 
| 48 48 | 
             
            				:unknown, 1,
         | 
| 49 49 | 
             
            				:translation_errors, 2,
         | 
| 50 | 
            -
            				: | 
| 50 | 
            +
            				:invalid_translation_unit, 3
         | 
| 51 51 | 
             
            			]
         | 
| 52 52 |  | 
| 53 53 | 
             
            			ReparseFlags = enum [
         | 
    
        data/lib/ffi/clang/lib/type.rb
    CHANGED
    
    | @@ -112,9 +112,7 @@ module FFI | |
| 112 112 | 
             
            			end
         | 
| 113 113 |  | 
| 114 114 | 
             
            			attach_function :get_type_kind_spelling, :clang_getTypeKindSpelling, [:kind], CXString.by_value
         | 
| 115 | 
            -
            			 | 
| 116 | 
            -
            				attach_function :get_type_spelling, :clang_getTypeSpelling, [CXType.by_value], CXString.by_value
         | 
| 117 | 
            -
            			end
         | 
| 115 | 
            +
            			attach_function :get_type_spelling, :clang_getTypeSpelling, [CXType.by_value], CXString.by_value
         | 
| 118 116 |  | 
| 119 117 | 
             
            			attach_function :is_function_type_variadic, :clang_isFunctionTypeVariadic, [CXType.by_value], :uint
         | 
| 120 118 | 
             
            			attach_function :is_pod_type, :clang_isPODType, [CXType.by_value], :uint
         | 
| @@ -122,9 +120,8 @@ module FFI | |
| 122 120 | 
             
            			attach_function :get_pointee_type, :clang_getPointeeType, [CXType.by_value], CXType.by_value
         | 
| 123 121 | 
             
            			attach_function :get_result_type, :clang_getResultType, [CXType.by_value], CXType.by_value
         | 
| 124 122 | 
             
            			attach_function :get_canonical_type, :clang_getCanonicalType, [CXType.by_value], CXType.by_value
         | 
| 125 | 
            -
            			 | 
| 126 | 
            -
             | 
| 127 | 
            -
            			end
         | 
| 123 | 
            +
            			
         | 
| 124 | 
            +
            			attach_function :type_get_class_type, :clang_Type_getClassType, [CXType.by_value], CXType.by_value
         | 
| 128 125 |  | 
| 129 126 | 
             
            			attach_function :is_const_qualified_type, :clang_isConstQualifiedType, [CXType.by_value], :uint
         | 
| 130 127 | 
             
            			attach_function :is_volatile_qualified_type, :clang_isVolatileQualifiedType, [CXType.by_value], :uint
         | 
| @@ -137,21 +134,15 @@ module FFI | |
| 137 134 | 
             
            			attach_function :get_array_size, :clang_getArraySize, [CXType.by_value], :long_long
         | 
| 138 135 | 
             
            			attach_function :get_array_element_type ,:clang_getArrayElementType, [CXType.by_value], CXType.by_value
         | 
| 139 136 |  | 
| 140 | 
            -
            			 | 
| 141 | 
            -
             | 
| 142 | 
            -
             | 
| 143 | 
            -
            				attach_function :type_get_offset_of, :clang_Type_getOffsetOf, [CXType.by_value, :string], :long_long
         | 
| 144 | 
            -
            			end
         | 
| 137 | 
            +
            			attach_function :type_get_align_of, :clang_Type_getAlignOf, [CXType.by_value], :long_long
         | 
| 138 | 
            +
            			attach_function :type_get_size_of, :clang_Type_getSizeOf, [CXType.by_value], :long_long
         | 
| 139 | 
            +
            			attach_function :type_get_offset_of, :clang_Type_getOffsetOf, [CXType.by_value, :string], :long_long
         | 
| 145 140 |  | 
| 146 | 
            -
            			 | 
| 147 | 
            -
             | 
| 148 | 
            -
            			end
         | 
| 141 | 
            +
            			attach_function :type_get_cxx_ref_qualifier, :clang_Type_getCXXRefQualifier, [CXType.by_value], :ref_qualifier_kind
         | 
| 142 | 
            +
            			
         | 
| 149 143 | 
             
            			attach_function :get_fuction_type_calling_conv, :clang_getFunctionTypeCallingConv, [CXType.by_value], :calling_conv
         | 
| 150 144 |  | 
| 151 145 | 
             
            			attach_function :equal_types, :clang_equalTypes, [CXType.by_value, CXType.by_value], :uint
         | 
| 152 | 
            -
             | 
| 153 | 
            -
            			attach_function :get_array_element_type, :clang_getArrayElementType, [CXType.by_value], CXType.by_value
         | 
| 154 | 
            -
            			attach_function :get_array_size, :clang_getArraySize, [CXType.by_value], :int
         | 
| 155 146 | 
             
            		end
         | 
| 156 147 | 
             
            	end
         | 
| 157 148 | 
             
            end
         | 
| @@ -20,8 +20,8 @@ | |
| 20 20 | 
             
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 21 21 | 
             
            # THE SOFTWARE.
         | 
| 22 22 |  | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 23 | 
            +
            require_relative 'lib/source_location'
         | 
| 24 | 
            +
            require_relative 'lib/file'
         | 
| 25 25 |  | 
| 26 26 | 
             
            module FFI
         | 
| 27 27 | 
             
            	module Clang
         | 
| @@ -22,7 +22,7 @@ | |
| 22 22 | 
             
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 23 23 | 
             
            # THE SOFTWARE.
         | 
| 24 24 |  | 
| 25 | 
            -
             | 
| 25 | 
            +
            require_relative 'lib/source_range'
         | 
| 26 26 |  | 
| 27 27 | 
             
            module FFI
         | 
| 28 28 | 
             
            	module Clang
         | 
| @@ -40,11 +40,24 @@ module FFI | |
| 40 40 | 
             
            			end
         | 
| 41 41 |  | 
| 42 42 | 
             
            			def start
         | 
| 43 | 
            -
            				ExpansionLocation.new(Lib.get_range_start @range)
         | 
| 43 | 
            +
            				@start ||= ExpansionLocation.new(Lib.get_range_start @range)
         | 
| 44 44 | 
             
            			end
         | 
| 45 45 |  | 
| 46 46 | 
             
            			def end
         | 
| 47 | 
            -
            				ExpansionLocation.new(Lib.get_range_end @range)
         | 
| 47 | 
            +
            				@end ||= ExpansionLocation.new(Lib.get_range_end @range)
         | 
| 48 | 
            +
            			end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            			# The size, in bytes, of the source range.
         | 
| 51 | 
            +
            			def bytesize
         | 
| 52 | 
            +
            				self.end.offset - self.start.offset
         | 
| 53 | 
            +
            			end
         | 
| 54 | 
            +
             | 
| 55 | 
            +
            			# Read the part of the source file referred to by this source range.
         | 
| 56 | 
            +
            			def text
         | 
| 57 | 
            +
            				::File.open(self.start.file, "r") do |file|
         | 
| 58 | 
            +
            					file.seek(self.start.offset)
         | 
| 59 | 
            +
            					return file.read(self.bytesize)
         | 
| 60 | 
            +
            				end
         | 
| 48 61 | 
             
            			end
         | 
| 49 62 |  | 
| 50 63 | 
             
            			def null?
         | 
    
        data/lib/ffi/clang/token.rb
    CHANGED
    
    | @@ -18,9 +18,9 @@ | |
| 18 18 | 
             
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 19 19 | 
             
            # THE SOFTWARE.
         | 
| 20 20 |  | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 21 | 
            +
            require_relative 'lib/token'
         | 
| 22 | 
            +
            require_relative 'lib/cursor'
         | 
| 23 | 
            +
            require_relative 'source_location'
         | 
| 24 24 |  | 
| 25 25 | 
             
            module FFI
         | 
| 26 26 | 
             
            	module Clang
         | 
| @@ -46,7 +46,7 @@ module FFI | |
| 46 46 | 
             
            			end
         | 
| 47 47 |  | 
| 48 48 | 
             
            			def self.release(pointer)
         | 
| 49 | 
            -
            				Lib.dispose_tokens(pointer, pointer | 
| 49 | 
            +
            				Lib.dispose_tokens(pointer.translation_unit, pointer, pointer.token_size)
         | 
| 50 50 | 
             
            			end
         | 
| 51 51 |  | 
| 52 52 | 
             
            			def each(&block)
         | 
| @@ -20,11 +20,11 @@ | |
| 20 20 | 
             
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 21 21 | 
             
            # THE SOFTWARE.
         | 
| 22 22 |  | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 23 | 
            +
            require_relative 'lib/translation_unit'
         | 
| 24 | 
            +
            require_relative 'lib/inclusions'
         | 
| 25 | 
            +
            require_relative 'cursor'
         | 
| 26 | 
            +
            require_relative 'file'
         | 
| 27 | 
            +
            require_relative 'token'
         | 
| 28 28 |  | 
| 29 29 | 
             
            module FFI
         | 
| 30 30 | 
             
            	module Clang
         | 
    
        data/lib/ffi/clang/type.rb
    CHANGED
    
    | @@ -19,8 +19,6 @@ | |
| 19 19 | 
             
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 20 20 | 
             
            # THE SOFTWARE.
         | 
| 21 21 |  | 
| 22 | 
            -
            require 'ffi/clang/cursor'
         | 
| 23 | 
            -
             | 
| 24 22 | 
             
            module FFI
         | 
| 25 23 | 
             
            	module Clang
         | 
| 26 24 | 
             
            		class Type
         | 
| @@ -130,18 +128,6 @@ module FFI | |
| 130 128 | 
             
            			def ==(other)
         | 
| 131 129 | 
             
            				Lib.equal_types(@type, other.type) != 0
         | 
| 132 130 | 
             
            			end
         | 
| 133 | 
            -
             | 
| 134 | 
            -
            			def declaration
         | 
| 135 | 
            -
            				Cursor.new Lib.get_type_declaration(@type), @translation_unit
         | 
| 136 | 
            -
            			end
         | 
| 137 | 
            -
             | 
| 138 | 
            -
            			def element_type
         | 
| 139 | 
            -
            				Type.new Lib.get_array_element_type(@type), @translation_unit
         | 
| 140 | 
            -
            			end
         | 
| 141 | 
            -
             | 
| 142 | 
            -
            			def array_size
         | 
| 143 | 
            -
            				Lib.get_array_size(@type)
         | 
| 144 | 
            -
            			end
         | 
| 145 131 | 
             
            		end
         | 
| 146 132 | 
             
            	end
         | 
| 147 133 | 
             
            end
         | 
    
        data/lib/ffi/clang/version.rb
    CHANGED
    
    | @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            # Copyright, 2010-2012 by Jari Bakken.
         | 
| 2 | 
            -
            # Copyright,  | 
| 2 | 
            +
            # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
         | 
| 3 3 | 
             
            # 
         | 
| 4 4 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 5 5 | 
             
            # of this software and associated documentation files (the "Software"), to deal
         | 
| @@ -21,6 +21,6 @@ | |
| 21 21 |  | 
| 22 22 | 
             
            module FFI
         | 
| 23 23 | 
             
            	module Clang
         | 
| 24 | 
            -
            		VERSION = "0. | 
| 24 | 
            +
            		VERSION = "0.5.0"
         | 
| 25 25 | 
             
            	end
         | 
| 26 26 | 
             
            end
         |