aboutsummaryrefslogtreecommitdiff
path: root/lib/compilers/zig.js
diff options
context:
space:
mode:
authorAlexandros Naskos <alex_naskos@hotmail.com>2020-11-13 16:24:13 +0200
committerGitHub <noreply@github.com>2020-11-13 08:24:13 -0600
commit80763a2574e3b39e763410fe3306c49260df8abf (patch)
tree47a02a9c7c36a489113fba39a17af2ac503a56e6 /lib/compilers/zig.js
parent068f62cdd801d21bfd21ddbee5759cef807a77b3 (diff)
downloadcompiler-explorer-80763a2574e3b39e763410fe3306c49260df8abf.tar.gz
compiler-explorer-80763a2574e3b39e763410fe3306c49260df8abf.zip
Fixed zig trunk LLVM IR output (#2327)
* Fixed zig trunk LLVM IR output * Filter all emit compiler options
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));
}