sanitize qualified name for nvptx backend

This commit is contained in:
Guillaume Wenzek authored and Andrew Kelley committed 2022-10-15 10:39:19 -07:00
1 parent 92a857b76c
commit aad983cf40
4 files changed
+26 -23

No files matched your search

+9
View File
@@ -720,6 +720,15 @@ pub const Decl = struct {
var buffer = std.ArrayList(u8).init(mod.gpa);
defer buffer.deinit();
try decl.renderFullyQualifiedName(mod, buffer.writer());
// Sanitize the name for nvptx which is more restrictive.
if (mod.comp.bin_file.options.target.cpu.arch.isNvptx()) {
for (buffer.items) |*byte| switch (byte.*) {
'{', '}', '*', '[', ']', '(', ')', ',', ' ', '\'' => byte.* = '_',
else => {},
};
}
return buffer.toOwnedSliceSentinel(0);
}