aboutsummaryrefslogtreecommitdiff
path: root/lib/compilers/zig.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compilers/zig.js')
-rw-r--r--lib/compilers/zig.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/compilers/zig.js b/lib/compilers/zig.js
index bcc396e41..778011178 100644
--- a/lib/compilers/zig.js
+++ b/lib/compilers/zig.js
@@ -36,7 +36,15 @@ export class ZigCompiler extends BaseCompiler {
super(info, env);
this.compiler.supportsIntel = true;
this.compiler.supportsIrView = true;
- this.compiler.irArg = ['--emit', 'llvm-ir'];
+
+ this.self_hosted_cli = this.compiler.semver === 'trunk' ||
+ (this.compiler.semver && Semver.gt(this.compiler.semver, '0.6.0'));
+
+ if (this.self_hosted_cli) {
+ this.compiler.irArg = ['-femit-llvm-ir'];
+ } else {
+ this.compiler.irArg = ['--emit', 'llvm-ir'];
+ }
}
getSharedLibraryPathsAsArguments() {
@@ -66,13 +74,11 @@ export class ZigCompiler extends BaseCompiler {
optionsForFilter(filters, outputFilename, userOptions) {
let options = [filters.execute ? 'build-exe' : 'build-obj'];
- let self_hosted_cli = this.compiler.semver === 'trunk' ||
- (this.compiler.semver && Semver.gt(this.compiler.semver, '0.6.0'));
const desiredName = path.basename(outputFilename);
// strip '.s' if we aren't executing
const name = filters.execute ? desiredName : desiredName.slice(0, -2);
- if (self_hosted_cli) {
+ if (this.self_hosted_cli) {
// Versions after 0.6.0 use a different command line interface.
const outputDir = path.dirname(outputFilename);
options.push('--cache-dir', outputDir,
@@ -114,7 +120,7 @@ export class ZigCompiler extends BaseCompiler {
}
filterUserOptions(userOptions) {
- const forbiddenOptions = /^(((--(cache-dir|name|output|verbose))|(-mllvm|-fno-emit-bin|-femit-bin)).*)$/;
+ const forbiddenOptions = /^(((--(cache-dir|name|output|verbose))|(-(mllvm|f(no-)?emit-))).*)$/;
return _.filter(userOptions, option => !forbiddenOptions.test(option));
}