From 1d72a7661611395a1c4fd3a88a2151921180e510 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 14 Mar 2010 08:23:30 +0000 Subject: [PATCH] add a new CreateTempSymbol method, the use case for CreateTempSymbol vs GetOrCreateTemporarySymbol are completely different. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98486 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCContext.h | 4 ++++ lib/MC/MCContext.cpp | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h index b62fefaace6..c233fd2246f 100644 --- a/include/llvm/MC/MCContext.h +++ b/include/llvm/MC/MCContext.h @@ -55,6 +55,10 @@ namespace llvm { /// @name Symbol Managment /// @{ + + /// CreateTempSymbol - Create and return a new assembler temporary symbol + /// with a unique but unspecified name. + MCSymbol *CreateTempSymbol(); /// GetOrCreateSymbol - Lookup the symbol inside with the specified /// @p Name. If it exists, return it. If not, create a forward diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp index 78d6a77dfb8..ae9a30a95f4 100644 --- a/lib/MC/MCContext.cpp +++ b/lib/MC/MCContext.cpp @@ -37,9 +37,15 @@ MCSymbol *MCContext::GetOrCreateSymbol(const Twine &Name) { return GetOrCreateSymbol(NameSV.str()); } +MCSymbol *MCContext::CreateTempSymbol() { + return GetOrCreateTemporarySymbol(Twine(MAI.getPrivateGlobalPrefix()) + + "tmp" + Twine(NextUniqueID++)); +} + MCSymbol *MCContext::GetOrCreateTemporarySymbol(StringRef Name) { // If there is no name, create a new anonymous symbol. + // FIXME: Remove this. This form of the method should always take a name. if (Name.empty()) return GetOrCreateTemporarySymbol(Twine(MAI.getPrivateGlobalPrefix()) + "tmp" + Twine(NextUniqueID++));