aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Module.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-05-25 08:52:20 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-05-25 08:52:20 +0000
commit567bc2cc1ed4d610daceecbb4ff7f92ebde1b530 (patch)
tree9bb8548581567c68cb72a0471c5e13510ae08b66 /lib/VMCore/Module.cpp
parentc8a1fcdb48f18bdb3f16fe594c3a01b0d60cd2d6 (diff)
Convert to SymbolTable's new lookup and iteration interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13751 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Module.cpp')
-rw-r--r--lib/VMCore/Module.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp
index 142f4bbe22..885a604abc 100644
--- a/lib/VMCore/Module.cpp
+++ b/lib/VMCore/Module.cpp
@@ -246,7 +246,7 @@ GlobalVariable *Module::getGlobalVariable(const std::string &Name,
bool Module::addTypeName(const std::string &Name, const Type *Ty) {
SymbolTable &ST = getSymbolTable();
- if (ST.lookup(Type::TypeTy, Name)) return true; // Already in symtab...
+ if (ST.lookupType(Name)) return true; // Already in symtab...
// Not in symbol table? Set the name with the Symtab as an argument so the
// type knows what to update...
@@ -259,7 +259,7 @@ bool Module::addTypeName(const std::string &Name, const Type *Ty) {
/// null if there is none by that name.
const Type *Module::getTypeByName(const std::string &Name) const {
const SymbolTable &ST = getSymbolTable();
- return cast_or_null<Type>(ST.lookup(Type::TypeTy, Name));
+ return cast_or_null<Type>(ST.lookupType(Name));
}
// getTypeName - If there is at least one entry in the symbol table for the
@@ -267,13 +267,12 @@ const Type *Module::getTypeByName(const std::string &Name) const {
//
std::string Module::getTypeName(const Type *Ty) const {
const SymbolTable &ST = getSymbolTable();
- if (ST.find(Type::TypeTy) == ST.end())
- return ""; // No names for types...
- SymbolTable::type_const_iterator TI = ST.type_begin(Type::TypeTy);
- SymbolTable::type_const_iterator TE = ST.type_end(Type::TypeTy);
+ SymbolTable::type_const_iterator TI = ST.type_begin();
+ SymbolTable::type_const_iterator TE = ST.type_end();
+ if ( TI == TE ) return ""; // No names for types
- while (TI != TE && TI->second != (const Value*)Ty)
+ while (TI != TE && TI->second != Ty)
++TI;
if (TI != TE) // Must have found an entry!