summaryrefslogtreecommitdiff
path: root/src/trans/mangling.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/trans/mangling.cpp')
-rw-r--r--src/trans/mangling.cpp17
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,