change Mangler::makeNameProper to return its result in a SmallVector
instead of returning it in an std::string. Based on this change:
1. Change TargetLoweringObjectFileCOFF::getCOFFSection to take a StringRef
2. Change a bunch of targets to call makeNameProper with a smallstring,
making several of them *much* more efficient.
3. Rewrite Mangler::makeNameProper to not build names and then prepend
prefixes, not use temporary std::strings, and to avoid other crimes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93298 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 96019bf..b1957bb 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1679,13 +1679,14 @@
// functions.
std::string FuncName = Mang->getMangledName(F);
- SmallString<60> Name;
- raw_svector_ostream(Name) << MAI->getPrivateGlobalPrefix() << "BA"
- << FuncName.size() << '_' << FuncName << '_'
- << Mang->makeNameProper(BB->getName())
- << Suffix;
+ SmallString<60> NameResult;
+ raw_svector_ostream(NameResult) << MAI->getPrivateGlobalPrefix() << "BA"
+ << FuncName.size() << '_' << FuncName << '_';
+ Mang->makeNameProper(NameResult, BB->getName());
+ if (Suffix[0])
+ NameResult += Suffix;
- return OutContext.GetOrCreateSymbol(Name.str());
+ return OutContext.GetOrCreateSymbol(NameResult.str());
}
MCSymbol *AsmPrinter::GetMBBSymbol(unsigned MBBID) const {