Unreviewed changes
3 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: arm64/instgen/generator.go
Insertions: 16, Deletions: 21.
@@ -260,6 +260,17 @@
return ops
}
+func convertToGoID(v string) string {
+ v = strings.ReplaceAll(v, " :: ", "_")
+ v = strings.ReplaceAll(v, "(", "")
+ v = strings.ReplaceAll(v, ")", "")
+ v = strings.ReplaceAll(v, "[", "")
+ v = strings.ReplaceAll(v, "]", "")
+ v = strings.ReplaceAll(v, "#", "c")
+ v = strings.ReplaceAll(v, "-", "_")
+ return v
+}
+
// formatAndFlush executes the given template and writes it to the given file,
// the go file is formatted using gofmt.
// If outputDir is empty, it does nothing.
@@ -435,15 +446,7 @@
if sym == "" || sym == "nil" {
enc = "enc_NIL"
} else {
- v := sym
- v = strings.ReplaceAll(v, " :: ", "_")
- v = strings.ReplaceAll(v, "(", "")
- v = strings.ReplaceAll(v, ")", "")
- v = strings.ReplaceAll(v, "[", "")
- v = strings.ReplaceAll(v, "]", "")
- v = strings.ReplaceAll(v, "#", "c")
- v = strings.ReplaceAll(v, "-", "_")
- enc = fmt.Sprintf("enc_%s", v)
+ enc = fmt.Sprintf("enc_%s", convertToGoID(sym))
}
}
arg.Elms = append(arg.Elms, elmData{
@@ -494,21 +497,13 @@
var constants []constantData
for _, v := range uniqueEncodedIn {
- v0 := v
- v = strings.ReplaceAll(v, " :: ", "_")
- v = strings.ReplaceAll(v, "(", "")
- v = strings.ReplaceAll(v, ")", "")
- v = strings.ReplaceAll(v, "[", "")
- v = strings.ReplaceAll(v, "]", "")
- v = strings.ReplaceAll(v, "#", "c")
- v = strings.ReplaceAll(v, "-", "_")
- name := fmt.Sprintf("enc_%s", v)
- encodedInMap[v0] = name
+ name := fmt.Sprintf("enc_%s", convertToGoID(v))
+ encodedInMap[v] = name
// Only add to output if used
- if neededEncodedIn[v0] {
+ if neededEncodedIn[v] {
constants = append(constants, constantData{
ConstName: name,
- BinName: v0,
+ BinName: v,
})
}
}
```