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;