diff options
author | John Hodge <tpg@ucc.asn.au> | 2019-11-02 11:07:23 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2019-11-02 11:07:23 +0800 |
commit | 1d02810c3cf908bfba7c15ae50eb5314603b9d85 (patch) | |
tree | 79dd5e4ef4c3ff79db0912ba546f08e61a7a8c10 /src/trans/mangling.cpp | |
parent | 7111acba04d72fe4084b1a1f3209ff83efe8614d (diff) | |
parent | 8b53b38f40625ab0510f541d69db3f83332a830a (diff) | |
download | mrust-1d02810c3cf908bfba7c15ae50eb5314603b9d85.tar.gz |
Merge branch 'nightly-1.29' - #95 Working support for rustc 1.29
Diffstat (limited to 'src/trans/mangling.cpp')
-rw-r--r-- | src/trans/mangling.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/trans/mangling.cpp b/src/trans/mangling.cpp index 741d13dd..0b5d61d6 100644 --- a/src/trans/mangling.cpp +++ b/src/trans/mangling.cpp @@ -2,7 +2,7 @@ * MRustC - Rust Compiler * - By John Hodge (Mutabah/thePowersGang) * - * trans/mangling.hpp + * trans/mangling.cpp * - Name mangling support * * @@ -22,18 +22,27 @@ #include <hir/path.hpp> namespace { - ::std::string escape_str(const ::std::string& s) { + ::std::string escape_str(const char* s, size_t len) { ::std::string output; - output.reserve(s.size() + 1); - for(auto v : s) + output.reserve(len + 1); + for(auto vp = s; vp != s + len; vp ++) + { + auto v= *vp; if( v == '#' ) output += "$H"; else if( v == '-' ) output += "_"; else output += v; + } return output; } + ::std::string escape_str(const RcString& s) { + return escape_str(s.c_str(), s.size()); + } + ::std::string escape_str(const ::std::string& s) { + return escape_str(s.c_str(), s.size()); + } ::FmtLambda emit_params(const ::HIR::PathParams& params) { return FMT_CB(ss, |