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 | be857f49e960ca9be13adc936f201b03e50f925e (patch) | |
| tree | dfe06e92bba3cc3fed7a71670a6902bb359369ce /lib | |
| parent | fd0f12e3443dab14a052aa965ab4fddf3b9a0b80 (diff) | |
| download | external_llvm-be857f49e960ca9be13adc936f201b03e50f925e.zip external_llvm-be857f49e960ca9be13adc936f201b03e50f925e.tar.gz external_llvm-be857f49e960ca9be13adc936f201b03e50f925e.tar.bz2 | |
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')
| -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 46eb02f..78d6a77 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; |
