summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-03-11 22:56:10 +0000
committerChris Lattner <sabre@nondot.org>2010-03-11 22:56:10 +0000
commitd3691dd04b6e1902a21605e2b8ac3cbc957ed0d3 (patch)
tree5e12f1a2d81e7ab7d8adfe52997c732345192237
parent768ea2add24daea98730533995ce6b33f317c4f8 (diff)
downloadbcm5719-llvm-d3691dd04b6e1902a21605e2b8ac3cbc957ed0d3.tar.gz
bcm5719-llvm-d3691dd04b6e1902a21605e2b8ac3cbc957ed0d3.zip
enhance MCContext::GetOrCreateTemporarySymbol() to create a new symbol
with an arbitrary unique name. llvm-svn: 98294
-rw-r--r--llvm/lib/MC/MCContext.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index 46eb02f32cc..78d6a77dfb8 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud