Skip to content

Commit b3cd4fb

Browse files
authored
Merge pull request rust-lang#89 from lumen/llvm8
Add support for LLVM 8
2 parents 513bddb + 719806a commit b3cd4fb

37 files changed

+824
-334
lines changed

.travis.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,18 @@ matrix:
130130
- *BASE_PACKAGES
131131
- llvm-7-dev
132132
rust: nightly-2019-01-15
133+
- env:
134+
- LLVM_VERSION="8.0"
135+
<<: *BASE
136+
addons:
137+
apt:
138+
sources:
139+
- *BASE_SOURCES
140+
- llvm-toolchain-trusty-8
141+
packages:
142+
- *BASE_PACKAGES
143+
- llvm-8-dev
144+
rust: nightly-2019-01-15
133145
- deploy: # Documentation build; Only latest supported LLVM version for now
134146
provider: pages
135147
skip-cleanup: true
@@ -139,10 +151,10 @@ matrix:
139151
on:
140152
branch: master
141153
before_install:
142-
- export PATH=/usr/lib/llvm-7/bin/:$HOME/.local/bin:$PATH
143-
- export LLVM_PATH=/usr/share/llvm-7/cmake/
154+
- export PATH=/usr/lib/llvm-8/bin/:$HOME/.local/bin:$PATH
155+
- export LLVM_PATH=/usr/share/llvm-8/cmake/
144156
script:
145-
- cargo doc --no-default-features --features llvm7-0 --color=always
157+
- cargo doc --no-default-features --features llvm8-0 --color=always
146158
- echo '<meta http-equiv="refresh" content="1; url=inkwell/index.html">' > target/doc/index.html
147159
rust: nightly
148160
name: "GitHub IO Documentation Deployment"
@@ -157,7 +169,8 @@ matrix:
157169
# - llvm-toolchain-trusty-4.0
158170
# - llvm-toolchain-trusty-5.0
159171
# - llvm-toolchain-trusty-6.0
160-
- llvm-toolchain-trusty-7
172+
# - llvm-toolchain-trusty-7
173+
- llvm-toolchain-trusty-8
161174
packages:
162175
- *BASE_PACKAGES
163176
# - llvm-3.6-dev
@@ -167,7 +180,8 @@ matrix:
167180
# - llvm-4.0-dev
168181
# - llvm-5.0-dev
169182
# - llvm-6.0-dev
170-
- llvm-7-dev
183+
# - llvm-7-dev
184+
- llvm-8-dev
171185

172186
env:
173187
global:

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ llvm4-0 = []
2020
llvm5-0 = []
2121
llvm6-0 = []
2222
llvm7-0 = []
23+
llvm8-0 = []
2324

2425
[dependencies]
2526
either = "1.5"
2627
enum-methods = "0.0.8"
2728
inkwell_internal_macros = { path = "./internal_macros", version = "0.1.0" }
2829
libc = "0.2"
29-
llvm-sys = "70.0"
30+
llvm-sys = "80.0"
3031

3132
[badges]
3233
travis-ci = { repository = "TheDan64/inkwell" }

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Inkwell aims to help you pen your own programming languages by safely wrapping l
1515

1616
* Rust 1.31+
1717
* Rust Stable, Beta, or Nightly
18-
* LLVM 3.6, 3.7, 3.8, 3.9, 4.0, 5.0, 6.0, or 7.0
18+
* LLVM 3.6, 3.7, 3.8, 3.9, 4.0, 5.0, 6.0, 7.0, or 8.0
1919

2020
## Usage
2121

@@ -38,6 +38,7 @@ Supported versions:
3838
| 5.0.x | llvm5-0 |
3939
| 6.0.x | llvm6-0 |
4040
| 7.0.x | llvm7-0 |
41+
| 8.0.x | llvm8-0 |
4142

4243
## Documentation
4344

examples/jit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn jit_compile_sum(
4040
unsafe { execution_engine.get_function("sum").ok() }
4141
}
4242

43-
fn main() -> Result<(), Box<Error>> {
43+
fn main() -> Result<(), Box<dyn Error>> {
4444
let context = Context::create();
4545
let module = context.create_module("sum");
4646
let builder = context.create_builder();

examples/kaleidoscope/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl<'a> Lexer<'a> {
155155
Ok(Token::Comment)
156156
},
157157

158-
'.' | '0' ... '9' => {
158+
'.' | '0' ..= '9' => {
159159
// Parse number literal
160160
loop {
161161
let ch = match chars.peek() {
@@ -175,7 +175,7 @@ impl<'a> Lexer<'a> {
175175
Ok(Token::Number(src[start..pos].parse().unwrap()))
176176
},
177177

178-
'a' ... 'z' | 'A' ... 'Z' | '_' => {
178+
'a' ..= 'z' | 'A' ..= 'Z' | '_' => {
179179
// Parse identifier
180180
loop {
181181
let ch = match chars.peek() {

internal_macros/Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@ name = "inkwell_internal_macros"
33
version = "0.1.0"
44
authors = ["Daniel Kolsoi <[email protected]>"]
55
edition = "2018"
6+
build = "build.rs"
67

78
[dependencies]
89
quote = "0.6"
9-
syn = { version = "0.15", features = ["full"] }
10+
syn = { version = "0.15", features = ["full", "fold"] }
11+
proc-macro2 = "0.4"
12+
13+
[build-dependencies]
14+
cargo_toml = "0.6"
1015

1116
[lib]
1217
proc-macro = true

internal_macros/build.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
extern crate cargo_toml;
2+
3+
use cargo_toml::Manifest;
4+
5+
use std::path::Path;
6+
7+
fn main() {
8+
let manifest_path = "../Cargo.toml";
9+
let manifest = Manifest::from_path(Path::new(manifest_path))
10+
.expect("Unable to load Cargo manifest!");
11+
12+
let features = manifest.features
13+
.keys()
14+
.filter(|feature| feature.as_str().starts_with("llvm"))
15+
.cloned()
16+
.collect::<Vec<_>>();
17+
18+
let features_csv = features.as_slice().join(",");
19+
20+
// Exports a comma-separated feature list in the environment during compilation
21+
// Can be fetched with `env!("INKWELL_FEATURES")`
22+
println!("cargo:rustc-env=INKWELL_FEATURES={}", features_csv);
23+
println!("cargo:rerun-if-changed={}", manifest_path);
24+
}

0 commit comments

Comments
 (0)