ffi-clang 0.7.0 → 0.8.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
- checksums.yaml.gz.sig +4 -0
- data/ext/rakefile.rb +4 -0
- data/ext/teapot.rb +4 -3
- data/lib/ffi/clang/clang_version.rb +9 -19
- data/lib/ffi/clang/code_completion.rb +4 -18
- data/lib/ffi/clang/comment.rb +7 -19
- data/lib/ffi/clang/compilation_database.rb +4 -18
- data/lib/ffi/clang/cursor.rb +70 -25
- data/lib/ffi/clang/diagnostic.rb +8 -21
- data/lib/ffi/clang/file.rb +4 -18
- data/lib/ffi/clang/index.rb +9 -20
- data/lib/ffi/clang/lib/clang_version.rb +5 -19
- data/lib/ffi/clang/lib/code_completion.rb +4 -18
- data/lib/ffi/clang/lib/comment.rb +7 -20
- data/lib/ffi/clang/lib/compilation_database.rb +4 -18
- data/lib/ffi/clang/lib/cursor.rb +34 -23
- data/lib/ffi/clang/lib/diagnostic.rb +7 -20
- data/lib/ffi/clang/lib/file.rb +5 -20
- data/lib/ffi/clang/lib/inclusions.rb +5 -19
- data/lib/ffi/clang/lib/index.rb +6 -20
- data/lib/ffi/clang/lib/source_location.rb +5 -20
- data/lib/ffi/clang/lib/source_range.rb +5 -22
- data/lib/ffi/clang/lib/string.rb +6 -20
- data/lib/ffi/clang/lib/token.rb +4 -18
- data/lib/ffi/clang/lib/translation_unit.rb +6 -20
- data/lib/ffi/clang/lib/type.rb +8 -20
- data/lib/ffi/clang/lib.rb +15 -20
- data/lib/ffi/clang/source_location.rb +7 -20
- data/lib/ffi/clang/source_range.rb +7 -22
- data/lib/ffi/clang/token.rb +4 -18
- data/lib/ffi/clang/translation_unit.rb +10 -20
- data/lib/ffi/clang/type.rb +7 -19
- data/lib/ffi/clang/unsaved_file.rb +6 -20
- data/lib/ffi/clang/version.rb +7 -21
- data/lib/ffi/clang.rb +9 -20
- data/license.md +38 -0
- data/readme.md +46 -0
- data.tar.gz.sig +0 -0
- metadata +71 -73
- metadata.gz.sig +2 -0
- data/.editorconfig +0 -23
- data/.gitignore +0 -19
- data/.rspec +0 -5
- data/.travis.yml +0 -30
- data/Gemfile +0 -12
- data/README.md +0 -74
- data/Rakefile +0 -12
- data/examples/docs.cpp +0 -25
- data/examples/docs.rb +0 -31
- data/ffi-clang.gemspec +0 -25
- data/spec/ffi/clang/code_completion_spec.rb +0 -181
- data/spec/ffi/clang/comment_spec.rb +0 -453
- data/spec/ffi/clang/compilation_database_spec.rb +0 -180
- data/spec/ffi/clang/cursor_spec.rb +0 -741
- data/spec/ffi/clang/diagnostic_spec.rb +0 -89
- data/spec/ffi/clang/file_spec.rb +0 -82
- data/spec/ffi/clang/fixtures/a.c +0 -7
- data/spec/ffi/clang/fixtures/canonical.c +0 -5
- data/spec/ffi/clang/fixtures/class.cpp +0 -8
- data/spec/ffi/clang/fixtures/compile_commands.json +0 -17
- data/spec/ffi/clang/fixtures/completion.cxx +0 -8
- data/spec/ffi/clang/fixtures/docs.c +0 -1
- data/spec/ffi/clang/fixtures/docs.cc +0 -1
- data/spec/ffi/clang/fixtures/docs.h +0 -54
- data/spec/ffi/clang/fixtures/list.c +0 -11
- data/spec/ffi/clang/fixtures/location1.c +0 -7
- data/spec/ffi/clang/fixtures/simple.ast +0 -0
- data/spec/ffi/clang/fixtures/simple.c +0 -3
- data/spec/ffi/clang/fixtures/test.cxx +0 -62
- data/spec/ffi/clang/index_spec.rb +0 -90
- data/spec/ffi/clang/source_location_spec.rb +0 -138
- data/spec/ffi/clang/source_range_spec.rb +0 -74
- data/spec/ffi/clang/token_spec.rb +0 -82
- data/spec/ffi/clang/translation_unit_spec.rb +0 -220
- data/spec/ffi/clang/type_spec.rb +0 -273
- data/spec/ffi/clang/version_spec.rb +0 -28
- data/spec/spec_helper.rb +0 -51
metadata
CHANGED
@@ -1,15 +1,60 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi-clang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Jari Bakken
|
8
7
|
- Samuel Williams
|
8
|
+
- Masahiro Sano
|
9
|
+
- Carlos Martín Nieto
|
10
|
+
- Jari Bakken
|
11
|
+
- Takeshi Watanabe
|
12
|
+
- Garry Marshall
|
13
|
+
- George Pimm
|
14
|
+
- Greg Hazel
|
15
|
+
- Luikore
|
16
|
+
- Michael Metivier
|
17
|
+
- Dave Wilkinson
|
18
|
+
- Hayden Purdy
|
19
|
+
- Mike Dalessio
|
20
|
+
- Motonori Iwamuro
|
21
|
+
- Niklas Therning
|
22
|
+
- Cameron Dutro
|
23
|
+
- Dominic Sisnero
|
24
|
+
- Hal Brodigan
|
9
25
|
autorequire:
|
10
26
|
bindir: bin
|
11
|
-
cert_chain:
|
12
|
-
|
27
|
+
cert_chain:
|
28
|
+
- |
|
29
|
+
-----BEGIN CERTIFICATE-----
|
30
|
+
MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
|
31
|
+
ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
|
32
|
+
CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
|
33
|
+
MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
|
34
|
+
MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
|
35
|
+
bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
|
36
|
+
igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
|
37
|
+
9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
|
38
|
+
sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE
|
39
|
+
e5AUKRwUuvaUaumAKgPH+4E4oiLXI4T1Ff5Q7xxv6yXvHuYtlMHhYfgNn8iiW8WN
|
40
|
+
XibYXPNP7NtieSQqwR/xM6IRSoyXKuS+ZNGDPUUGk8RoiV/xvVN4LrVm9upSc0ss
|
41
|
+
RZ6qwOQmXCo/lLcDUxJAgG95cPw//sI00tZan75VgsGzSWAOdjQpFM0l4dxvKwHn
|
42
|
+
tUeT3ZsAgt0JnGqNm2Bkz81kG4A2hSyFZTFA8vZGhp+hz+8Q573tAR89y9YJBdYM
|
43
|
+
zp0FM4zwMNEUwgfRzv1tEVVUEXmoFCyhzonUUw4nE4CFu/sE3ffhjKcXcY//qiSW
|
44
|
+
xm4erY3XAgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
45
|
+
BBYEFO9t7XWuFf2SKLmuijgqR4sGDlRsMC4GA1UdEQQnMCWBI3NhbXVlbC53aWxs
|
46
|
+
aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWBI3NhbXVlbC53aWxs
|
47
|
+
aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEBCwUAA4IBgQB5sxkE
|
48
|
+
cBsSYwK6fYpM+hA5B5yZY2+L0Z+27jF1pWGgbhPH8/FjjBLVn+VFok3CDpRqwXCl
|
49
|
+
xCO40JEkKdznNy2avOMra6PFiQyOE74kCtv7P+Fdc+FhgqI5lMon6tt9rNeXmnW/
|
50
|
+
c1NaMRdxy999hmRGzUSFjozcCwxpy/LwabxtdXwXgSay4mQ32EDjqR1TixS1+smp
|
51
|
+
8C/NCWgpIfzpHGJsjvmH2wAfKtTTqB9CVKLCWEnCHyCaRVuKkrKjqhYCdmMBqCws
|
52
|
+
JkxfQWC+jBVeG9ZtPhQgZpfhvh+6hMhraUYRQ6XGyvBqEUe+yo6DKIT3MtGE2+CP
|
53
|
+
eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
|
54
|
+
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
55
|
+
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
56
|
+
-----END CERTIFICATE-----
|
57
|
+
date: 2023-05-01 00:00:00.000000000 Z
|
13
58
|
dependencies:
|
14
59
|
- !ruby/object:Gem::Dependency
|
15
60
|
name: ffi
|
@@ -25,6 +70,20 @@ dependencies:
|
|
25
70
|
- - ">="
|
26
71
|
- !ruby/object:Gem::Version
|
27
72
|
version: '0'
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: bake-test
|
75
|
+
requirement: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
type: :development
|
81
|
+
prerelease: false
|
82
|
+
version_requirements: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
28
87
|
- !ruby/object:Gem::Dependency
|
29
88
|
name: bundler
|
30
89
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,24 +126,14 @@ dependencies:
|
|
67
126
|
- - ">="
|
68
127
|
- !ruby/object:Gem::Version
|
69
128
|
version: '0'
|
70
|
-
description:
|
129
|
+
description:
|
71
130
|
email:
|
72
131
|
executables: []
|
73
132
|
extensions: []
|
74
133
|
extra_rdoc_files: []
|
75
134
|
files:
|
76
|
-
- ".editorconfig"
|
77
|
-
- ".gitignore"
|
78
|
-
- ".rspec"
|
79
|
-
- ".travis.yml"
|
80
|
-
- Gemfile
|
81
|
-
- README.md
|
82
|
-
- Rakefile
|
83
|
-
- examples/docs.cpp
|
84
|
-
- examples/docs.rb
|
85
135
|
- ext/rakefile.rb
|
86
136
|
- ext/teapot.rb
|
87
|
-
- ffi-clang.gemspec
|
88
137
|
- lib/ffi/clang.rb
|
89
138
|
- lib/ffi/clang/clang_version.rb
|
90
139
|
- lib/ffi/clang/code_completion.rb
|
@@ -117,37 +166,13 @@ files:
|
|
117
166
|
- lib/ffi/clang/type.rb
|
118
167
|
- lib/ffi/clang/unsaved_file.rb
|
119
168
|
- lib/ffi/clang/version.rb
|
120
|
-
-
|
121
|
-
-
|
122
|
-
|
123
|
-
- spec/ffi/clang/cursor_spec.rb
|
124
|
-
- spec/ffi/clang/diagnostic_spec.rb
|
125
|
-
- spec/ffi/clang/file_spec.rb
|
126
|
-
- spec/ffi/clang/fixtures/a.c
|
127
|
-
- spec/ffi/clang/fixtures/canonical.c
|
128
|
-
- spec/ffi/clang/fixtures/class.cpp
|
129
|
-
- spec/ffi/clang/fixtures/compile_commands.json
|
130
|
-
- spec/ffi/clang/fixtures/completion.cxx
|
131
|
-
- spec/ffi/clang/fixtures/docs.c
|
132
|
-
- spec/ffi/clang/fixtures/docs.cc
|
133
|
-
- spec/ffi/clang/fixtures/docs.h
|
134
|
-
- spec/ffi/clang/fixtures/list.c
|
135
|
-
- spec/ffi/clang/fixtures/location1.c
|
136
|
-
- spec/ffi/clang/fixtures/simple.ast
|
137
|
-
- spec/ffi/clang/fixtures/simple.c
|
138
|
-
- spec/ffi/clang/fixtures/test.cxx
|
139
|
-
- spec/ffi/clang/index_spec.rb
|
140
|
-
- spec/ffi/clang/source_location_spec.rb
|
141
|
-
- spec/ffi/clang/source_range_spec.rb
|
142
|
-
- spec/ffi/clang/token_spec.rb
|
143
|
-
- spec/ffi/clang/translation_unit_spec.rb
|
144
|
-
- spec/ffi/clang/type_spec.rb
|
145
|
-
- spec/ffi/clang/version_spec.rb
|
146
|
-
- spec/spec_helper.rb
|
147
|
-
homepage: ''
|
169
|
+
- license.md
|
170
|
+
- readme.md
|
171
|
+
homepage: https://github.com/ioquatix/ffi-clang
|
148
172
|
licenses:
|
149
173
|
- MIT
|
150
|
-
metadata:
|
174
|
+
metadata:
|
175
|
+
funding_uri: https://github.com/sponsors/ioquatix/
|
151
176
|
post_install_message:
|
152
177
|
rdoc_options: []
|
153
178
|
require_paths:
|
@@ -163,35 +188,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
188
|
- !ruby/object:Gem::Version
|
164
189
|
version: '0'
|
165
190
|
requirements: []
|
166
|
-
rubygems_version: 3.
|
191
|
+
rubygems_version: 3.4.10
|
167
192
|
signing_key:
|
168
193
|
specification_version: 4
|
169
194
|
summary: Ruby FFI bindings for libclang C interface.
|
170
|
-
test_files:
|
171
|
-
- spec/ffi/clang/code_completion_spec.rb
|
172
|
-
- spec/ffi/clang/comment_spec.rb
|
173
|
-
- spec/ffi/clang/compilation_database_spec.rb
|
174
|
-
- spec/ffi/clang/cursor_spec.rb
|
175
|
-
- spec/ffi/clang/diagnostic_spec.rb
|
176
|
-
- spec/ffi/clang/file_spec.rb
|
177
|
-
- spec/ffi/clang/fixtures/a.c
|
178
|
-
- spec/ffi/clang/fixtures/canonical.c
|
179
|
-
- spec/ffi/clang/fixtures/class.cpp
|
180
|
-
- spec/ffi/clang/fixtures/compile_commands.json
|
181
|
-
- spec/ffi/clang/fixtures/completion.cxx
|
182
|
-
- spec/ffi/clang/fixtures/docs.c
|
183
|
-
- spec/ffi/clang/fixtures/docs.cc
|
184
|
-
- spec/ffi/clang/fixtures/docs.h
|
185
|
-
- spec/ffi/clang/fixtures/list.c
|
186
|
-
- spec/ffi/clang/fixtures/location1.c
|
187
|
-
- spec/ffi/clang/fixtures/simple.ast
|
188
|
-
- spec/ffi/clang/fixtures/simple.c
|
189
|
-
- spec/ffi/clang/fixtures/test.cxx
|
190
|
-
- spec/ffi/clang/index_spec.rb
|
191
|
-
- spec/ffi/clang/source_location_spec.rb
|
192
|
-
- spec/ffi/clang/source_range_spec.rb
|
193
|
-
- spec/ffi/clang/token_spec.rb
|
194
|
-
- spec/ffi/clang/translation_unit_spec.rb
|
195
|
-
- spec/ffi/clang/type_spec.rb
|
196
|
-
- spec/ffi/clang/version_spec.rb
|
197
|
-
- spec/spec_helper.rb
|
195
|
+
test_files: []
|
metadata.gz.sig
ADDED
data/.editorconfig
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
root = true
|
2
|
-
|
3
|
-
[*]
|
4
|
-
charset = utf-8
|
5
|
-
end_of_line = lf
|
6
|
-
insert_final_newline = true
|
7
|
-
trim_trailing_whitespace = false
|
8
|
-
indent_style = tab
|
9
|
-
|
10
|
-
[{*.{rb,gemspec},Gemfile,Rakefile}]
|
11
|
-
indent_size = 2
|
12
|
-
|
13
|
-
[*.{c,cc,cpp,cxx,h,hpp,hxx}]
|
14
|
-
indent_size = 4
|
15
|
-
|
16
|
-
[*.json]
|
17
|
-
indent_size = 2
|
18
|
-
|
19
|
-
[*.yml]
|
20
|
-
indent_size = 2
|
21
|
-
|
22
|
-
[*.md]
|
23
|
-
indent_size = 4
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
before_install:
|
4
|
-
- export LD_LIBRARY_PATH=/usr/lib/llvm-${LLVM_VERSION}/lib/
|
5
|
-
- export PATH=/usr/lib/llvm-${LLVM_VERSION}/bin:$PATH
|
6
|
-
matrix:
|
7
|
-
include:
|
8
|
-
- addons: {apt: {sources: [ubuntu-toolchain-r-test, llvm-toolchain-precise-3.6], packages: [libclang-3.6-dev, clang-3.6]}}
|
9
|
-
env: LLVM_VERSION=3.6
|
10
|
-
rvm: "2.4.0"
|
11
|
-
- addons: {apt: {sources: [ubuntu-toolchain-r-test, llvm-toolchain-precise-3.7], packages: [libclang-3.7-dev, clang-3.7]}}
|
12
|
-
env: LLVM_VERSION=3.7
|
13
|
-
rvm: "2.4.0"
|
14
|
-
# The default build:
|
15
|
-
- &libclang-38
|
16
|
-
addons: {apt: {sources: [ubuntu-toolchain-r-test, llvm-toolchain-precise-3.8], packages: [libclang-3.8-dev, clang-3.8]}}
|
17
|
-
env: LLVM_VERSION=3.8
|
18
|
-
rvm: "2.4.0"
|
19
|
-
# A second build with the same configuration but using ruby 2.2.4
|
20
|
-
- <<: *libclang-38
|
21
|
-
rvm: "2.3.3"
|
22
|
-
- addons: {apt: {sources: [ubuntu-toolchain-r-test, llvm-toolchain-precise-3.9], packages: [libclang-3.9-dev, clang-3.9]}}
|
23
|
-
env: LLVM_VERSION=3.9
|
24
|
-
rvm: "2.4.0"
|
25
|
-
- addons: {apt: {sources: [ubuntu-toolchain-r-test, llvm-toolchain-precise-4.0], packages: [libclang-4.0-dev, clang-4.0]}}
|
26
|
-
env: LLVM_VERSION=4.0
|
27
|
-
rvm: "2.4.0"
|
28
|
-
allow_failures:
|
29
|
-
- env: LLVM_VERSION=4.0
|
30
|
-
rvm: "2.4.0"
|
data/Gemfile
DELETED
data/README.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# FFI::Clang
|
2
|
-
|
3
|
-
A light-weight wrapper for Ruby exposing [libclang][1]. Works for libclang v3.4+.
|
4
|
-
|
5
|
-
[](http://travis-ci.org/ioquatix/ffi-clang)
|
6
|
-
[](https://codeclimate.com/github/ioquatix/ffi-clang)
|
7
|
-
|
8
|
-
[1]: http://llvm.org/devmtg/2010-11/Gregor-libclang.pdf
|
9
|
-
|
10
|
-
## Installation
|
11
|
-
|
12
|
-
Add this line to your application's Gemfile:
|
13
|
-
|
14
|
-
gem 'ffi-clang'
|
15
|
-
|
16
|
-
And then execute:
|
17
|
-
|
18
|
-
$ bundle
|
19
|
-
|
20
|
-
Or install it yourself as:
|
21
|
-
|
22
|
-
$ gem install ffi-clang
|
23
|
-
|
24
|
-
## Usage
|
25
|
-
|
26
|
-
Traverse the AST in the given file:
|
27
|
-
|
28
|
-
index = Index.new
|
29
|
-
translation_unit = index.parse_translation_unit("list.c")
|
30
|
-
cursor = translation_unit.cursor
|
31
|
-
cursor.visit_children do |cursor, parent|
|
32
|
-
puts "#{cursor.kind} #{cursor.spelling.inspect}"
|
33
|
-
|
34
|
-
next :recurse
|
35
|
-
end
|
36
|
-
|
37
|
-
### Library Version
|
38
|
-
|
39
|
-
Due to issues figuring out which library to use, we require you to manually specify it. For example, to run the tests, with MacPorts llvm/clang 3.4, use the following:
|
40
|
-
|
41
|
-
LLVM_CONFIG=llvm-config-mp-3.4 rake
|
42
|
-
|
43
|
-
## Contributing
|
44
|
-
|
45
|
-
1. Fork it
|
46
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
47
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
48
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
49
|
-
5. Create new Pull Request
|
50
|
-
|
51
|
-
## License
|
52
|
-
|
53
|
-
Copyright, 2010-2012, by Jari Bakken.
|
54
|
-
Copyright, 2013, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
55
|
-
Copyright, 2013, by Garry C. Marshall. <http://www.meaningfulname.net>
|
56
|
-
Copyright, 2014, by Masahiro Sano.
|
57
|
-
|
58
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
59
|
-
of this software and associated documentation files (the "Software"), to deal
|
60
|
-
in the Software without restriction, including without limitation the rights
|
61
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
62
|
-
copies of the Software, and to permit persons to whom the Software is
|
63
|
-
furnished to do so, subject to the following conditions:
|
64
|
-
|
65
|
-
The above copyright notice and this permission notice shall be included in
|
66
|
-
all copies or substantial portions of the Software.
|
67
|
-
|
68
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
69
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
70
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
71
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
72
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
73
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
74
|
-
THE SOFTWARE.
|
data/Rakefile
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rspec/core/rake_task"
|
3
|
-
|
4
|
-
RSpec::Core::RakeTask.new(:spec) do |task|
|
5
|
-
begin
|
6
|
-
require('simplecov/version')
|
7
|
-
task.rspec_opts = %w{--require simplecov} if ENV['COVERAGE']
|
8
|
-
rescue LoadError
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
task :default => :spec
|
data/examples/docs.cpp
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
|
2
|
-
/** A test class which does nothing.
|
3
|
-
|
4
|
-
This is used by `main`.
|
5
|
-
*/
|
6
|
-
template<typename T>
|
7
|
-
class Test {};
|
8
|
-
|
9
|
-
/// This is a specialization for integers.
|
10
|
-
template<>
|
11
|
-
class Test<int> {
|
12
|
-
public:
|
13
|
-
/// The number of times it has been incremented.
|
14
|
-
int count;
|
15
|
-
|
16
|
-
};
|
17
|
-
|
18
|
-
/// This always fails.
|
19
|
-
/// @param argc The number of items in `argv`. At least 1.
|
20
|
-
/// @param argv The command line arguments, with argv[0] being the command used to execute this program.
|
21
|
-
int main(int argc, char ** argv) {
|
22
|
-
Test<int> test;
|
23
|
-
|
24
|
-
return 1;
|
25
|
-
}
|
data/examples/docs.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'rainbow'
|
4
|
-
require 'ffi/clang'
|
5
|
-
|
6
|
-
index = FFI::Clang::Index.new
|
7
|
-
|
8
|
-
# clang -Xclang -ast-dump -fsyntax-only ./examples/docs.cpp
|
9
|
-
|
10
|
-
def title(declaration)
|
11
|
-
puts ["Symbol:", Rainbow(declaration.spelling).blue.bright, "Type:", Rainbow(declaration.type.spelling).green, declaration.kind.to_s].join(' ')
|
12
|
-
end
|
13
|
-
|
14
|
-
ARGV.each do |path|
|
15
|
-
translation_unit = index.parse_translation_unit(path)
|
16
|
-
|
17
|
-
declarations = translation_unit.cursor.select(&:declaration?)
|
18
|
-
|
19
|
-
declarations.each do |declaration|
|
20
|
-
title declaration
|
21
|
-
|
22
|
-
if location = declaration.location
|
23
|
-
puts "Defined at #{location.file}:#{location.line}"
|
24
|
-
end
|
25
|
-
|
26
|
-
if comment = declaration.comment
|
27
|
-
# puts Rainbow(comment.inspect).gray
|
28
|
-
puts Rainbow(comment.text)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
data/ffi-clang.gemspec
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'ffi/clang/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "ffi-clang"
|
8
|
-
spec.version = FFI::Clang::VERSION
|
9
|
-
spec.authors = ["Jari Bakken", "Samuel Williams"]
|
10
|
-
spec.description = %q{Ruby FFI bindings for libclang C interface.}
|
11
|
-
spec.summary = %q{Ruby FFI bindings for libclang C interface.}
|
12
|
-
spec.homepage = ""
|
13
|
-
spec.license = "MIT"
|
14
|
-
|
15
|
-
spec.files = `git ls-files`.split($/)
|
16
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
-
spec.require_paths = ["lib"]
|
19
|
-
|
20
|
-
spec.add_dependency "ffi"
|
21
|
-
|
22
|
-
spec.add_development_dependency "bundler", ">= 1.3"
|
23
|
-
spec.add_development_dependency "rspec", ">= 3.4.0"
|
24
|
-
spec.add_development_dependency "rake"
|
25
|
-
end
|
@@ -1,181 +0,0 @@
|
|
1
|
-
# Copyright, 2014, by Masahiro Sano.
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
# of this software and associated documentation files (the "Software"), to deal
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
20
|
-
|
21
|
-
describe CodeCompletion do
|
22
|
-
let(:filename) { fixture_path("completion.cxx") }
|
23
|
-
let(:translation_unit) { Index.new.parse_translation_unit(filename) }
|
24
|
-
let(:line) { 7 }
|
25
|
-
let(:column) { 6 }
|
26
|
-
let(:results) { translation_unit.code_complete(filename, line, column) }
|
27
|
-
|
28
|
-
describe "self.default_code_completion_options" do
|
29
|
-
let(:options) { FFI::Clang::CodeCompletion.default_code_completion_options }
|
30
|
-
it "returns a default set of code-completion options" do
|
31
|
-
expect(options).to be_kind_of(Hash)
|
32
|
-
options.keys.each { |key|
|
33
|
-
expect(FFI::Clang::Lib::CodeCompleteFlags.symbols).to include(key)
|
34
|
-
}
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe CodeCompletion::Results do
|
39
|
-
it "can be obtained from a translation unit" do
|
40
|
-
expect(results).to be_kind_of(CodeCompletion::Results)
|
41
|
-
|
42
|
-
# At least 40 results, depends on standard library implementation:
|
43
|
-
expect(results.size).to be >= 40
|
44
|
-
|
45
|
-
expect(results.results).to be_kind_of(Array)
|
46
|
-
expect(results.results.first).to be_kind_of(CodeCompletion::Result)
|
47
|
-
end
|
48
|
-
|
49
|
-
it "calls dispose_code_complete_results on GC" do
|
50
|
-
expect(Lib).to receive(:dispose_code_complete_results).at_least(:once)
|
51
|
-
expect{results.free}.not_to raise_error
|
52
|
-
end
|
53
|
-
|
54
|
-
it "#each" do
|
55
|
-
spy = double(stub: nil)
|
56
|
-
expect(spy).to receive(:stub).exactly(results.size).times
|
57
|
-
results.each { spy.stub }
|
58
|
-
end
|
59
|
-
|
60
|
-
it "#num_diagnostics" do
|
61
|
-
expect(results.num_diagnostics).to eq(2)
|
62
|
-
end
|
63
|
-
|
64
|
-
it "#diagnostic" do
|
65
|
-
expect(results.diagnostic(0)).to be_kind_of(Diagnostic)
|
66
|
-
end
|
67
|
-
|
68
|
-
it "#diagnostics" do
|
69
|
-
expect(results.diagnostics).to be_kind_of(Array)
|
70
|
-
expect(results.diagnostics.first).to be_kind_of(Diagnostic)
|
71
|
-
expect(results.diagnostics.size).to eq(results.num_diagnostics)
|
72
|
-
end
|
73
|
-
|
74
|
-
it "#contexts" do
|
75
|
-
expect(results.contexts).to be_kind_of(Hash)
|
76
|
-
results.contexts.keys.each { |key|
|
77
|
-
expect(FFI::Clang::Lib::CompletionContext.symbols).to include(key)
|
78
|
-
}
|
79
|
-
end
|
80
|
-
|
81
|
-
it "#container_usr" do
|
82
|
-
expect(results.container_usr).to be_kind_of(String)
|
83
|
-
expect(results.container_usr).to match(/std.+vector/)
|
84
|
-
end
|
85
|
-
|
86
|
-
it "#container_kind" do
|
87
|
-
expect(results.container_kind).to be_kind_of(Symbol)
|
88
|
-
expect(results.container_kind).to eq(:cursor_class_decl)
|
89
|
-
end
|
90
|
-
|
91
|
-
it "#incomplete?" do
|
92
|
-
expect(results.incomplete?).to be false
|
93
|
-
end
|
94
|
-
|
95
|
-
it "#objc_selector" do
|
96
|
-
#TODO
|
97
|
-
end
|
98
|
-
|
99
|
-
it "#sort!" do
|
100
|
-
results.sort!
|
101
|
-
|
102
|
-
possibilities = results.first.string.chunks.select{|x| x[:kind] == :typed_text}.collect{|chunk| chunk[:text]}
|
103
|
-
|
104
|
-
# may be sorted with typed_text kind, first result will start with 'a'.. not necessarily
|
105
|
-
expect(possibilities).to be == possibilities.sort
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
describe CodeCompletion::Result do
|
110
|
-
let(:result) { results.results.first }
|
111
|
-
it "#string" do
|
112
|
-
expect(result.string).to be_kind_of(CodeCompletion::String)
|
113
|
-
end
|
114
|
-
|
115
|
-
it "#kind" do
|
116
|
-
expect(result.kind).to be_kind_of(Symbol)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
describe CodeCompletion::String do
|
121
|
-
let(:str) { results.sort!; results.find{|x| x.string.chunk_text(1) == 'assign'}.string }
|
122
|
-
|
123
|
-
it "#num_chunks" do
|
124
|
-
expect(str.num_chunks).to be >= 5
|
125
|
-
end
|
126
|
-
|
127
|
-
it "#chunk_kind" do
|
128
|
-
expect(str.chunk_kind(0)).to eq(:result_type)
|
129
|
-
expect(str.chunk_kind(1)).to eq(:typed_text)
|
130
|
-
end
|
131
|
-
|
132
|
-
it "#chunk_text" do
|
133
|
-
expect(str.chunk_text(0)).to be =~ /void/
|
134
|
-
expect(str.chunk_text(1)).to eq('assign')
|
135
|
-
end
|
136
|
-
|
137
|
-
it "#chunk_completion" do
|
138
|
-
expect(str.chunk_completion(0)).to be_kind_of(CodeCompletion::String)
|
139
|
-
end
|
140
|
-
|
141
|
-
it "#chunks" do
|
142
|
-
expect(str.chunks).to be_kind_of(Array)
|
143
|
-
expect(str.chunks.first).to be_kind_of(Hash)
|
144
|
-
expect(str.chunks.size).to eq(str.num_chunks)
|
145
|
-
end
|
146
|
-
|
147
|
-
it "#priority" do
|
148
|
-
expect(str.priority).to be_kind_of(Integer)
|
149
|
-
end
|
150
|
-
|
151
|
-
it "#availability" do
|
152
|
-
expect(str.availability).to be_kind_of(Symbol)
|
153
|
-
expect(str.availability).to eq(:available)
|
154
|
-
end
|
155
|
-
|
156
|
-
it "#num_annotations" do
|
157
|
-
expect(str.num_annotations).to be_kind_of(Integer)
|
158
|
-
expect(str.num_annotations).to eq(0)
|
159
|
-
end
|
160
|
-
|
161
|
-
it "#annotation" do
|
162
|
-
expect(str.annotation(100)).to be_nil
|
163
|
-
# TODO: need tests for String which has annotation
|
164
|
-
end
|
165
|
-
|
166
|
-
it "#annotations" do
|
167
|
-
expect(str.annotations).to be_kind_of(Array)
|
168
|
-
# TODO: need tests for String which has annotation
|
169
|
-
end
|
170
|
-
|
171
|
-
it "#parent" do
|
172
|
-
expect(str.parent).to be_kind_of(String)
|
173
|
-
expect(str.parent).to be =~ /std.+vector/
|
174
|
-
end
|
175
|
-
|
176
|
-
it "#comment" do
|
177
|
-
expect(str.comment).to be_nil
|
178
|
-
# TODO: need tests for String which has real comment
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|