Move MCContext and friends to StringRef based APIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77251 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp
index 6c6019c..6c74dcd 100644
--- a/lib/MC/MCContext.cpp
+++ b/lib/MC/MCContext.cpp
@@ -21,7 +21,7 @@
MCContext::~MCContext() {
}
-MCSection *MCContext::GetSection(const char *Name) {
+MCSection *MCContext::GetSection(const StringRef &Name) {
MCSection *&Entry = Sections[Name];
if (!Entry)
@@ -30,7 +30,7 @@
return Entry;
}
-MCSymbol *MCContext::CreateSymbol(const char *Name) {
+MCSymbol *MCContext::CreateSymbol(const StringRef &Name) {
assert(Name[0] != '\0' && "Normal symbols cannot be unnamed!");
// Create and bind the symbol, and ensure that names are unique.
@@ -39,7 +39,7 @@
return Entry = new (*this) MCSymbol(Name, false);
}
-MCSymbol *MCContext::GetOrCreateSymbol(const char *Name) {
+MCSymbol *MCContext::GetOrCreateSymbol(const StringRef &Name) {
MCSymbol *&Entry = Symbols[Name];
if (Entry) return Entry;
@@ -47,9 +47,9 @@
}
-MCSymbol *MCContext::CreateTemporarySymbol(const char *Name) {
+MCSymbol *MCContext::CreateTemporarySymbol(const StringRef &Name) {
// If unnamed, just create a symbol.
- if (Name[0] == '\0')
+ if (Name.empty())
new (*this) MCSymbol("", true);
// Otherwise create as usual.
@@ -58,7 +58,7 @@
return Entry = new (*this) MCSymbol(Name, true);
}
-MCSymbol *MCContext::LookupSymbol(const char *Name) const {
+MCSymbol *MCContext::LookupSymbol(const StringRef &Name) const {
return Symbols.lookup(Name);
}