ffi-clang 0.7.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +3 -0
- data/ext/rakefile.rb +4 -0
- data/ext/teapot.rb +4 -3
- data/lib/ffi/clang/clang_version.rb +10 -19
- data/lib/ffi/clang/code_completion.rb +8 -20
- data/lib/ffi/clang/comment.rb +7 -19
- data/lib/ffi/clang/compilation_database.rb +4 -18
- data/lib/ffi/clang/cursor.rb +117 -35
- data/lib/ffi/clang/diagnostic.rb +11 -23
- data/lib/ffi/clang/file.rb +4 -18
- data/lib/ffi/clang/index.rb +19 -23
- data/lib/ffi/clang/lib/clang_version.rb +5 -19
- data/lib/ffi/clang/lib/code_completion.rb +13 -26
- 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 +102 -28
- data/lib/ffi/clang/lib/diagnostic.rb +7 -20
- data/lib/ffi/clang/lib/file.rb +7 -20
- data/lib/ffi/clang/lib/inclusions.rb +5 -19
- data/lib/ffi/clang/lib/index.rb +25 -20
- data/lib/ffi/clang/lib/printing_policy.rb +47 -0
- 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 +4 -20
- data/lib/ffi/clang/lib/token.rb +4 -18
- data/lib/ffi/clang/lib/translation_unit.rb +19 -21
- data/lib/ffi/clang/lib/type.rb +87 -22
- data/lib/ffi/clang/lib.rb +24 -28
- data/lib/ffi/clang/printing_policy.rb +36 -0
- data/lib/ffi/clang/source_location.rb +42 -38
- 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 +52 -25
- 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 +39 -0
- data/readme.md +56 -0
- data.tar.gz.sig +0 -0
- metadata +62 -116
- metadata.gz.sig +0 -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
data/lib/ffi/clang.rb
CHANGED
@@ -1,23 +1,12 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in
|
12
|
-
# all copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2010-2011, by Jari Bakken.
|
5
|
+
# Copyright, 2012, by Hal Brodigan.
|
6
|
+
# Copyright, 2013-2022, by Samuel Williams.
|
7
|
+
# Copyright, 2013, by Garry Marshall.
|
8
|
+
# Copyright, 2013, by Carlos Martín Nieto.
|
9
|
+
# Copyright, 2014, by Masahiro Sano.
|
21
10
|
|
22
11
|
require 'ffi'
|
23
12
|
require 'rbconfig'
|
data/license.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# MIT License
|
2
|
+
|
3
|
+
Copyright, 2010-2012, by Jari Bakken.
|
4
|
+
Copyright, 2012, by Hal Brodigan.
|
5
|
+
Copyright, 2013-2024, by Samuel Williams.
|
6
|
+
Copyright, 2013, by Garry Marshall.
|
7
|
+
Copyright, 2013-2014, by Carlos Martín Nieto.
|
8
|
+
Copyright, 2013, by Dave Wilkinson.
|
9
|
+
Copyright, 2013, by Takeshi Watanabe.
|
10
|
+
Copyright, 2013-2014, by Masahiro Sano.
|
11
|
+
Copyright, 2014, by George Pimm.
|
12
|
+
Copyright, 2014, by Greg Hazel.
|
13
|
+
Copyright, 2014-2015, by Niklas Therning.
|
14
|
+
Copyright, 2016, by Mike Dalessio.
|
15
|
+
Copyright, 2017, by Cameron Dutro.
|
16
|
+
Copyright, 2019, by Hayden Purdy.
|
17
|
+
Copyright, 2019, by Michael Metivier.
|
18
|
+
Copyright, 2019, by Dominic Sisnero.
|
19
|
+
Copyright, 2020, by Zete Lui.
|
20
|
+
Copyright, 2022, by Motonori Iwamuro.
|
21
|
+
Copyright, 2023-2024, by Charlie Savage.
|
22
|
+
|
23
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
24
|
+
of this software and associated documentation files (the "Software"), to deal
|
25
|
+
in the Software without restriction, including without limitation the rights
|
26
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
27
|
+
copies of the Software, and to permit persons to whom the Software is
|
28
|
+
furnished to do so, subject to the following conditions:
|
29
|
+
|
30
|
+
The above copyright notice and this permission notice shall be included in all
|
31
|
+
copies or substantial portions of the Software.
|
32
|
+
|
33
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
34
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
35
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
36
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
37
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
38
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
39
|
+
SOFTWARE.
|
data/readme.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# FFI::Clang
|
2
|
+
|
3
|
+
A light-weight wrapper for Ruby exposing [libclang](http://llvm.org/devmtg/2010-11/Gregor-libclang.pdf). Works for libclang v3.4+.
|
4
|
+
|
5
|
+
[![Development Status](https://github.com/ioquatix/ffi-clang/workflows/Test/badge.svg)](https://github.com/ioquatix/ffi-clang/actions?workflow=Test)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'ffi-clang'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install ffi-clang
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Traverse the AST in the given file:
|
24
|
+
|
25
|
+
index = Index.new
|
26
|
+
translation_unit = index.parse_translation_unit("list.c")
|
27
|
+
cursor = translation_unit.cursor
|
28
|
+
cursor.visit_children do |cursor, parent|
|
29
|
+
puts "#{cursor.kind} #{cursor.spelling.inspect}"
|
30
|
+
|
31
|
+
next :recurse
|
32
|
+
end
|
33
|
+
|
34
|
+
### Library Version
|
35
|
+
|
36
|
+
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:
|
37
|
+
|
38
|
+
LLVM_CONFIG=llvm-config-mp-3.4 rake
|
39
|
+
|
40
|
+
## Contributing
|
41
|
+
|
42
|
+
We welcome contributions to this project.
|
43
|
+
|
44
|
+
1. Fork it.
|
45
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
46
|
+
3. Commit your changes (`git commit -am 'Add some feature'`).
|
47
|
+
4. Push to the branch (`git push origin my-new-feature`).
|
48
|
+
5. Create new Pull Request.
|
49
|
+
|
50
|
+
### Developer Certificate of Origin
|
51
|
+
|
52
|
+
This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
|
53
|
+
|
54
|
+
### Contributor Covenant
|
55
|
+
|
56
|
+
This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
CHANGED
@@ -1,15 +1,61 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi-clang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Jari Bakken
|
8
7
|
- Samuel Williams
|
8
|
+
- Masahiro Sano
|
9
|
+
- Carlos Martín Nieto
|
10
|
+
- Charlie Savage
|
11
|
+
- Jari Bakken
|
12
|
+
- Takeshi Watanabe
|
13
|
+
- Garry Marshall
|
14
|
+
- George Pimm
|
15
|
+
- Zete Lui
|
16
|
+
- Greg Hazel
|
17
|
+
- Michael Metivier
|
18
|
+
- Dave Wilkinson
|
19
|
+
- Hayden Purdy
|
20
|
+
- Mike Dalessio
|
21
|
+
- Motonori Iwamuro
|
22
|
+
- Niklas Therning
|
23
|
+
- Cameron Dutro
|
24
|
+
- Dominic Sisnero
|
25
|
+
- Hal Brodigan
|
9
26
|
autorequire:
|
10
27
|
bindir: bin
|
11
|
-
cert_chain:
|
12
|
-
|
28
|
+
cert_chain:
|
29
|
+
- |
|
30
|
+
-----BEGIN CERTIFICATE-----
|
31
|
+
MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
|
32
|
+
ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
|
33
|
+
CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
|
34
|
+
MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
|
35
|
+
MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
|
36
|
+
bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
|
37
|
+
igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
|
38
|
+
9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
|
39
|
+
sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE
|
40
|
+
e5AUKRwUuvaUaumAKgPH+4E4oiLXI4T1Ff5Q7xxv6yXvHuYtlMHhYfgNn8iiW8WN
|
41
|
+
XibYXPNP7NtieSQqwR/xM6IRSoyXKuS+ZNGDPUUGk8RoiV/xvVN4LrVm9upSc0ss
|
42
|
+
RZ6qwOQmXCo/lLcDUxJAgG95cPw//sI00tZan75VgsGzSWAOdjQpFM0l4dxvKwHn
|
43
|
+
tUeT3ZsAgt0JnGqNm2Bkz81kG4A2hSyFZTFA8vZGhp+hz+8Q573tAR89y9YJBdYM
|
44
|
+
zp0FM4zwMNEUwgfRzv1tEVVUEXmoFCyhzonUUw4nE4CFu/sE3ffhjKcXcY//qiSW
|
45
|
+
xm4erY3XAgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
46
|
+
BBYEFO9t7XWuFf2SKLmuijgqR4sGDlRsMC4GA1UdEQQnMCWBI3NhbXVlbC53aWxs
|
47
|
+
aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWBI3NhbXVlbC53aWxs
|
48
|
+
aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEBCwUAA4IBgQB5sxkE
|
49
|
+
cBsSYwK6fYpM+hA5B5yZY2+L0Z+27jF1pWGgbhPH8/FjjBLVn+VFok3CDpRqwXCl
|
50
|
+
xCO40JEkKdznNy2avOMra6PFiQyOE74kCtv7P+Fdc+FhgqI5lMon6tt9rNeXmnW/
|
51
|
+
c1NaMRdxy999hmRGzUSFjozcCwxpy/LwabxtdXwXgSay4mQ32EDjqR1TixS1+smp
|
52
|
+
8C/NCWgpIfzpHGJsjvmH2wAfKtTTqB9CVKLCWEnCHyCaRVuKkrKjqhYCdmMBqCws
|
53
|
+
JkxfQWC+jBVeG9ZtPhQgZpfhvh+6hMhraUYRQ6XGyvBqEUe+yo6DKIT3MtGE2+CP
|
54
|
+
eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
|
55
|
+
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
56
|
+
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
57
|
+
-----END CERTIFICATE-----
|
58
|
+
date: 2024-04-07 00:00:00.000000000 Z
|
13
59
|
dependencies:
|
14
60
|
- !ruby/object:Gem::Dependency
|
15
61
|
name: ffi
|
@@ -25,66 +71,14 @@ dependencies:
|
|
25
71
|
- - ">="
|
26
72
|
- !ruby/object:Gem::Version
|
27
73
|
version: '0'
|
28
|
-
|
29
|
-
name: bundler
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '1.3'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '1.3'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: rspec
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: 3.4.0
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: 3.4.0
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: rake
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0'
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
|
-
description: Ruby FFI bindings for libclang C interface.
|
74
|
+
description:
|
71
75
|
email:
|
72
76
|
executables: []
|
73
77
|
extensions: []
|
74
78
|
extra_rdoc_files: []
|
75
79
|
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
80
|
- ext/rakefile.rb
|
86
81
|
- ext/teapot.rb
|
87
|
-
- ffi-clang.gemspec
|
88
82
|
- lib/ffi/clang.rb
|
89
83
|
- lib/ffi/clang/clang_version.rb
|
90
84
|
- lib/ffi/clang/code_completion.rb
|
@@ -104,12 +98,14 @@ files:
|
|
104
98
|
- lib/ffi/clang/lib/file.rb
|
105
99
|
- lib/ffi/clang/lib/inclusions.rb
|
106
100
|
- lib/ffi/clang/lib/index.rb
|
101
|
+
- lib/ffi/clang/lib/printing_policy.rb
|
107
102
|
- lib/ffi/clang/lib/source_location.rb
|
108
103
|
- lib/ffi/clang/lib/source_range.rb
|
109
104
|
- lib/ffi/clang/lib/string.rb
|
110
105
|
- lib/ffi/clang/lib/token.rb
|
111
106
|
- lib/ffi/clang/lib/translation_unit.rb
|
112
107
|
- lib/ffi/clang/lib/type.rb
|
108
|
+
- lib/ffi/clang/printing_policy.rb
|
113
109
|
- lib/ffi/clang/source_location.rb
|
114
110
|
- lib/ffi/clang/source_range.rb
|
115
111
|
- lib/ffi/clang/token.rb
|
@@ -117,37 +113,14 @@ files:
|
|
117
113
|
- lib/ffi/clang/type.rb
|
118
114
|
- lib/ffi/clang/unsaved_file.rb
|
119
115
|
- 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: ''
|
116
|
+
- license.md
|
117
|
+
- readme.md
|
118
|
+
homepage: https://github.com/ioquatix/ffi-clang
|
148
119
|
licenses:
|
149
120
|
- MIT
|
150
|
-
metadata:
|
121
|
+
metadata:
|
122
|
+
funding_uri: https://github.com/sponsors/ioquatix/
|
123
|
+
source_code_uri: https://github.com/ioquatix/ffi-clang.git
|
151
124
|
post_install_message:
|
152
125
|
rdoc_options: []
|
153
126
|
require_paths:
|
@@ -156,42 +129,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
129
|
requirements:
|
157
130
|
- - ">="
|
158
131
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
132
|
+
version: '3.1'
|
160
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
134
|
requirements:
|
162
135
|
- - ">="
|
163
136
|
- !ruby/object:Gem::Version
|
164
137
|
version: '0'
|
165
138
|
requirements: []
|
166
|
-
rubygems_version: 3.3
|
139
|
+
rubygems_version: 3.5.3
|
167
140
|
signing_key:
|
168
141
|
specification_version: 4
|
169
142
|
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
|
143
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|
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
|
-
[![Build Status](https://secure.travis-ci.org/ioquatix/ffi-clang.svg)](http://travis-ci.org/ioquatix/ffi-clang)
|
6
|
-
[![Code Climate](https://codeclimate.com/github/ioquatix/ffi-clang.svg)](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
|