sanitize qualified name for nvptx backend

This commit is contained in:
Guillaume Wenzek
2022-09-16 22:21:14 +02:00
committed by Andrew Kelley
parent 92a857b76c
commit aad983cf40
4 changed files with 26 additions and 23 deletions

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);
}