aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/TypeSymbolTable.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-07-25 06:02:13 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-07-25 06:02:13 +0000
commit92ccf70ad448eb02f9f273d2c70ae4708b3bd0f2 (patch)
tree79e29e5f8e24b6c70ff964e42d9b438c3b11eddf /lib/VMCore/TypeSymbolTable.cpp
parent8b5ee823c2393d15c74e2dda0c46f8a2c6f40dc8 (diff)
downloadexternal_llvm-92ccf70ad448eb02f9f273d2c70ae4708b3bd0f2.zip
external_llvm-92ccf70ad448eb02f9f273d2c70ae4708b3bd0f2.tar.gz
external_llvm-92ccf70ad448eb02f9f273d2c70ae4708b3bd0f2.tar.bz2
Finish migrating VMCore to StringRef/Twine based APIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77051 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/TypeSymbolTable.cpp')
-rw-r--r--lib/VMCore/TypeSymbolTable.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/VMCore/TypeSymbolTable.cpp b/lib/VMCore/TypeSymbolTable.cpp
index 54da809..e9c6255 100644
--- a/lib/VMCore/TypeSymbolTable.cpp
+++ b/lib/VMCore/TypeSymbolTable.cpp
@@ -14,6 +14,7 @@
#include "llvm/TypeSymbolTable.h"
#include "llvm/DerivedTypes.h"
#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Streams.h"
#include "llvm/System/RWMutex.h"
@@ -34,7 +35,7 @@ TypeSymbolTable::~TypeSymbolTable() {
}
}
-std::string TypeSymbolTable::getUniqueName(const std::string &BaseName) const {
+std::string TypeSymbolTable::getUniqueName(const StringRef &BaseName) const {
std::string TryName = BaseName;
sys::SmartScopedReader<true> Reader(*TypeSymbolTableLock);
@@ -43,12 +44,12 @@ std::string TypeSymbolTable::getUniqueName(const std::string &BaseName) const {
// See if the name exists
while (tmap.find(TryName) != End) // Loop until we find a free
- TryName = BaseName + utostr(++LastUnique); // name in the symbol table
+ TryName = BaseName.str() + utostr(++LastUnique); // name in the symbol table
return TryName;
}
// lookup a type by name - returns null on failure
-Type* TypeSymbolTable::lookup(const std::string& Name) const {
+Type* TypeSymbolTable::lookup(const StringRef &Name) const {
sys::SmartScopedReader<true> Reader(*TypeSymbolTableLock);
const_iterator TI = tmap.find(Name);
@@ -90,12 +91,12 @@ Type* TypeSymbolTable::remove(iterator Entry) {
// insert - Insert a type into the symbol table with the specified name...
-void TypeSymbolTable::insert(const std::string& Name, const Type* T) {
+void TypeSymbolTable::insert(const StringRef &Name, const Type* T) {
assert(T && "Can't insert null type into symbol table!");
TypeSymbolTableLock->writer_acquire();
- if (tmap.insert(make_pair(Name, T)).second) {
+ if (tmap.insert(std::make_pair(Name, T)).second) {
// Type inserted fine with no conflict.
#if DEBUG_SYMBOL_TABLE