diff options
author | Chris Lattner <sabre@nondot.org> | 2010-03-11 22:56:10 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-03-11 22:56:10 +0000 |
commit | 1a5c28f4715d84d0302581a67e193d7a358bba17 (patch) | |
tree | dfe06e92bba3cc3fed7a71670a6902bb359369ce /lib/MC/MCContext.cpp | |
parent | c18409aed80ba1c6c5998befd3c3c8edc865c423 (diff) |
enhance MCContext::GetOrCreateTemporarySymbol() to create a new symbol
with an arbitrary unique name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98294 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCContext.cpp')
-rw-r--r-- | lib/MC/MCContext.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp index 46eb02f32c..78d6a77dfb 100644 --- a/lib/MC/MCContext.cpp +++ b/lib/MC/MCContext.cpp @@ -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; |