1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

enhance MCContext::GetOrCreateTemporarySymbol() to create a new symbol

with an arbitrary unique name.

llvm-svn: 98294
This commit is contained in:
Chris Lattner 2010-03-11 22:56:10 +00:00
parent debc026df2
commit de47dfab1d

View File

@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/ADT/SmallString.h"
@ -38,6 +39,11 @@ MCSymbol *MCContext::GetOrCreateSymbol(const Twine &Name) {
MCSymbol *MCContext::GetOrCreateTemporarySymbol(StringRef Name) {
// If there is no name, create a new anonymous symbol.
if (Name.empty())
return GetOrCreateTemporarySymbol(Twine(MAI.getPrivateGlobalPrefix()) +
"tmp" + Twine(NextUniqueID++));
// Otherwise create as usual.
MCSymbol *&Entry = Symbols[Name];
if (Entry) return Entry;