From d72590ede6c18cb06141f0f5c640eefa9ffd6701 Mon Sep 17 00:00:00 2001 From: Ilia Filippov Date: Mon, 21 Oct 2013 12:35:53 +0400 Subject: [PATCH] correction errors in generic targets after operators support --- cbackend.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cbackend.cpp b/cbackend.cpp index 7d4b4cfc..814a4016 100644 --- a/cbackend.cpp +++ b/cbackend.cpp @@ -558,8 +558,15 @@ char CWriter::ID = 0; static std::string CBEMangle(const std::string &S) { std::string Result; - for (unsigned i = 0, e = S.size(); i != e; ++i) - if (isalnum(S[i]) || S[i] == '_' || S[i] == '<' || S[i] == '>') { + for (unsigned i = 0, e = S.size(); i != e; ++i) { + if (i+1 != e && ((S[i] == '>' && S[i+1] == '>') || + (S[i] == '<' && S[i+1] == '<'))) { + Result += '_'; + Result += 'A'+(S[i]&15); + Result += 'A'+((S[i]>>4)&15); + Result += '_'; + i++; + } else if (isalnum(S[i]) || S[i] == '_' || S[i] == '<' || S[i] == '>') { Result += S[i]; } else { Result += '_'; @@ -567,6 +574,7 @@ static std::string CBEMangle(const std::string &S) { Result += 'A'+((S[i]>>4)&15); Result += '_'; } + } return Result; }