Get MCSymbol out of the mangling business, and move all the logic

to Mangler.  Now MCSymbol just decides whether to slap quotes around
a symbol when printing it.

This also fixes some weirdness where two MCSymbols could be created
for the same symbol, if one needed to be mangled and got mangled to
the other one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93690 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2010-01-17 19:23:46 +00:00
parent c7aa48da3f
commit acd03ae679
6 changed files with 115 additions and 83 deletions

View File

@ -352,10 +352,9 @@ char CWriter::ID = 0;
static std::string Mangle(const std::string &S) {
std::string Result;
raw_string_ostream OS(Result);
MCSymbol::printMangledName(S, OS, 0);
return OS.str();
SmallString<52> Result;
Mangler::appendMangledName(Result, S, 0);
return std::string(Result.begin(), Result.end());
}
@ -1452,7 +1451,7 @@ std::string CWriter::GetValueName(const Value *Operand) {
if (const GlobalValue *GV = dyn_cast<GlobalValue>(Operand)) {
SmallString<128> Str;
Mang->getNameWithPrefix(Str, GV, false);
return Mangle(Str.str().str());
return Str.str().str();
}
std::string Name = Operand->getName();