[PATCH] [llgo] irgen: introduce ManglePackagePath function
Peter Collingbourne
peter at pcc.me.uk
Tue Dec 30 16:26:42 PST 2014
REPOSITORY
rL LLVM
http://reviews.llvm.org/D6801
Files:
llgo/trunk/irgen/typemap.go
Index: llgo/trunk/irgen/typemap.go
===================================================================
--- llgo/trunk/irgen/typemap.go
+++ llgo/trunk/irgen/typemap.go
@@ -487,19 +487,19 @@
b.WriteRune('e')
}
-func (ctx *manglerContext) manglePackagePath(pkgpath string, b *bytes.Buffer) {
+func ManglePackagePath(pkgpath string) string {
pkgpath = strings.Replace(pkgpath, "/", "_", -1)
pkgpath = strings.Replace(pkgpath, ".", "_", -1)
- b.WriteString(pkgpath)
+ return pkgpath
}
func (ctx *manglerContext) mangleType(t types.Type, b *bytes.Buffer) {
switch t := t.(type) {
case *types.Basic, *types.Named:
var nb bytes.Buffer
ti := ctx.getNamedTypeInfo(t)
if ti.pkgpath != "" {
- ctx.manglePackagePath(ti.pkgpath, &nb)
+ nb.WriteString(ManglePackagePath(ti.pkgpath))
nb.WriteRune('.')
}
if ti.functionName != "" {
@@ -602,7 +602,7 @@
b.WriteString("__go_tdn_")
ti := ctx.getNamedTypeInfo(t)
if ti.pkgpath != "" {
- ctx.manglePackagePath(ti.pkgpath, b)
+ b.WriteString(ManglePackagePath(ti.pkgpath))
b.WriteRune('.')
}
if ti.functionName != "" {
@@ -674,7 +674,7 @@
}
if pkg != nil {
- ctx.manglePackagePath(pkg.Path(), &b)
+ b.WriteString(ManglePackagePath(pkg.Path()))
b.WriteRune('.')
}
@@ -694,7 +694,7 @@
func (ctx *manglerContext) mangleGlobalName(g *ssa.Global) string {
var b bytes.Buffer
- ctx.manglePackagePath(g.Pkg.Object.Path(), &b)
+ b.WriteString(ManglePackagePath(g.Pkg.Object.Path()))
b.WriteRune('.')
b.WriteString(g.Name())
@@ -814,7 +814,7 @@
ti := tm.mc.getNamedTypeInfo(t)
if ti.pkgpath != "" {
b.WriteByte('\t')
- tm.mc.manglePackagePath(ti.pkgpath, b)
+ b.WriteString(ManglePackagePath(ti.pkgpath))
b.WriteByte('\t')
b.WriteString(ti.pkgname)
b.WriteByte('.')
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6801.17733.patch
Type: text/x-patch
Size: 1799 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141231/abca2dde/attachment.bin>
More information about the llvm-commits
mailing list