aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-05-17 02:54:51 -0700
committerGitHub <noreply@github.com>2023-05-17 02:54:51 -0700
commitfd213accb8b55ba3675fad03fce8fb8742270b6d (patch)
tree4b00fb539b6090f0cc1a67eed3341f229bf36c32 /src/Compilation.zig
parent40e8c2243c139dc499298645a2b387e30ae09cba (diff)
parent233a0d399135cdb581c5c080726c4cacc71695fe (diff)
downloadzig-fd213accb8b55ba3675fad03fce8fb8742270b6d.tar.gz
zig-fd213accb8b55ba3675fad03fce8fb8742270b6d.zip
Merge pull request #14462 from motiejus/infile_stdin
zig cc: support reading from stdin via "-x LANG -"
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 1b6d805bb3..0818eaafdd 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -4597,6 +4597,27 @@ pub const FileExt = enum {
=> false,
};
}
+
+ pub fn canonicalName(ext: FileExt, target: Target) [:0]const u8 {
+ return switch (ext) {
+ .c => ".c",
+ .cpp => ".cpp",
+ .cu => ".cu",
+ .h => ".h",
+ .m => ".m",
+ .mm => ".mm",
+ .ll => ".ll",
+ .bc => ".bc",
+ .assembly => ".s",
+ .assembly_with_cpp => ".S",
+ .shared_library => target.dynamicLibSuffix(),
+ .object => target.ofmt.fileExt(target.cpu.arch),
+ .static_library => target.staticLibSuffix(),
+ .zig => ".zig",
+ .def => ".def",
+ .unknown => "",
+ };
+ }
};
pub fn hasObjectExt(filename: []const u8) bool {