aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
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 {