aboutsummaryrefslogtreecommitdiff
path: root/lib/compilers/zigcxx.js
diff options
context:
space:
mode:
authorRubén Rincón Blanco <ruben@rinconblanco.es>2021-06-16 13:00:00 +0200
committerGitHub <noreply@github.com>2021-06-16 13:00:00 +0200
commit9e2b24ea409e551447222c1f720e4011b102dd5a (patch)
treec567f9323f2ce9563b48c6388ed350f47d8ec381 /lib/compilers/zigcxx.js
parent91b960f1b3a0fd204ec12275c8dca0d31518d4f6 (diff)
downloadcompiler-explorer-9e2b24ea409e551447222c1f720e4011b102dd5a.tar.gz
compiler-explorer-9e2b24ea409e551447222c1f720e4011b102dd5a.zip
Add Zig c++ (#2716)
As requested by #2707 It still has the same problems found in #2434, which that will get fixed in Zig 0.8.1
Diffstat (limited to 'lib/compilers/zigcxx.js')
-rw-r--r--lib/compilers/zigcxx.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/lib/compilers/zigcxx.js b/lib/compilers/zigcxx.js
new file mode 100644
index 000000000..8fe7a9924
--- /dev/null
+++ b/lib/compilers/zigcxx.js
@@ -0,0 +1,51 @@
+// Copyright (c) 2021, Compiler Explorer Authors
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+
+import { ClangCompiler } from './clang';
+
+export class ZigCXX extends ClangCompiler {
+ static get key() { return 'zigcxx'; }
+
+ preProcess(source, filters) {
+ if (this.compiler.semver !== '0.6.0') {
+ filters.binary = true;
+ }
+
+ return super.preProcess(source, filters);
+ }
+
+ optionsForFilter(filters, outputFilename) {
+ if (this.compiler.semver !== '0.6.0') {
+ // note: zig versions > 0.6 don't emit asm, only binary works - https://github.com/ziglang/zig/issues/8153
+ filters.binary = true;
+ }
+
+ let options = ['c++', '-g', '-o', this.filename(outputFilename)];
+ if (this.compiler.intelAsm && filters.intel && !filters.binary) {
+ options = options.concat(this.compiler.intelAsm.split(' '));
+ }
+ if (!filters.binary) options = options.concat('-S');
+ return options;
+ }
+}