diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-17 19:32:29 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-17 19:32:29 +0000 |
commit | 306ee8681919451d792fe8f1082af948e8ce2ca9 (patch) | |
tree | 14a845ddec8f635ed099b782efeba746e0a4f928 /lib/Target/CBackend | |
parent | 0b0d0f162422578dd769b3f803962fd6692c5b76 (diff) | |
download | external_llvm-306ee8681919451d792fe8f1082af948e8ce2ca9.zip external_llvm-306ee8681919451d792fe8f1082af948e8ce2ca9.tar.gz external_llvm-306ee8681919451d792fe8f1082af948e8ce2ca9.tar.bz2 |
stop the CBE from using Mangler::appendMangledName, which is a private function, it is mangling types, which don't matter how they are done.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93692 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/CBackend')
-rw-r--r-- | lib/Target/CBackend/CBackend.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 6a7643a..5015d1b 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -351,10 +351,19 @@ namespace { char CWriter::ID = 0; -static std::string Mangle(const std::string &S) { - SmallString<52> Result; - Mangler::appendMangledName(Result, S, 0); - return std::string(Result.begin(), Result.end()); +static std::string MangleType(const std::string &S) { + std::string Result; + + for (unsigned i = 0, e = S.size(); i != e; ++i) + if (isalnum(S[i]) || S[i] == '_') { + Result += S[i]; + } else { + Result += '_'; + Result += 'A'+(S[i]&15); + Result += 'A'+((S[i]>>4)&15); + Result += '_'; + } + return Result; } @@ -2238,7 +2247,7 @@ void CWriter::printModuleTypes(const TypeSymbolTable &TST) { // Print out forward declarations for structure types before anything else! Out << "/* Structure forward decls */\n"; for (; I != End; ++I) { - std::string Name = "struct " + Mangle("l_"+I->first); + std::string Name = "struct " + MangleType("l_"+I->first); Out << Name << ";\n"; TypeNames.insert(std::make_pair(I->second, Name)); } @@ -2249,7 +2258,7 @@ void CWriter::printModuleTypes(const TypeSymbolTable &TST) { // for struct or opaque types. Out << "/* Typedefs */\n"; for (I = TST.begin(); I != End; ++I) { - std::string Name = Mangle("l_"+I->first); + std::string Name = MangleType("l_"+I->first); Out << "typedef "; printType(Out, I->second, false, Name); Out << ";\n"; |