diff options
author | Marc Tiehuis <marctiehuis@gmail.com> | 2018-09-11 22:05:17 +1200 |
---|---|---|
committer | Marc Tiehuis <marctiehuis@gmail.com> | 2018-09-11 22:11:40 +1200 |
commit | 5329bf7129139c11f80266f40ba182c223a0d235 (patch) | |
tree | 325ed67d6ad35044ed906ff29f797fac266d0818 /lib/compilers/zig.js | |
parent | 6189c000c7bab8ff1f1e31047c3e7e5ef368344d (diff) | |
download | compiler-explorer-5329bf7129139c11f80266f40ba182c223a0d235.tar.gz compiler-explorer-5329bf7129139c11f80266f40ba182c223a0d235.zip |
Filter potentially dangerous zig user options
`--cache-dir` modifies the output cache directory
`--name` modifies the output name
`--output(-h)?` modifiers the output generated path/header
`--verbose-*` emits compiler debug output and is not relevant
`--mllvm` forwards arguments directly to llvm
Diffstat (limited to 'lib/compilers/zig.js')
-rw-r--r-- | lib/compilers/zig.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/compilers/zig.js b/lib/compilers/zig.js index 5133b8eb6..daa2f61d5 100644 --- a/lib/compilers/zig.js +++ b/lib/compilers/zig.js @@ -50,8 +50,8 @@ class ZigCompiler extends BaseCompiler { '--output', this.filename(outputFilename) ]; - let userRequestedEmit = _.any(userOptions, opt => opt.indexOf("--emit") > -1); if (!filters.binary) { + let userRequestedEmit = _.any(userOptions, opt => opt.indexOf("--emit") > -1); if (!userRequestedEmit) { options = options.concat('--emit', 'asm'); } @@ -59,6 +59,11 @@ class ZigCompiler extends BaseCompiler { } return options; } + + filterUserOptions(userOptions) { + const blacklist = /^(((--(cache-dir|name|output|verbose))|(-mllvm)).*)$/; + return _.filter(userOptions, option => !blacklist.test(option)); + } } module.exports = ZigCompiler; |