summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Module.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-03-29 04:48:40 +0000
committerChris Lattner <sabre@nondot.org>2002-03-29 04:48:40 +0000
commit13ae72f1750a27ac4d3c0417d65ecd4ac8398c23 (patch)
tree329670c6c12cf561481ef2d7bb1e7d91ac50dc00 /llvm/lib/VMCore/Module.cpp
parentf94811af1370eca437415883ca16eaa3e528a787 (diff)
downloadbcm5719-llvm-13ae72f1750a27ac4d3c0417d65ecd4ac8398c23.tar.gz
bcm5719-llvm-13ae72f1750a27ac4d3c0417d65ecd4ac8398c23.zip
Add new addTypeName method to Module class
llvm-svn: 2037
Diffstat (limited to 'llvm/lib/VMCore/Module.cpp')
-rw-r--r--llvm/lib/VMCore/Module.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Module.cpp b/llvm/lib/VMCore/Module.cpp
index c0767cd7d19..9d131699700 100644
--- a/llvm/lib/VMCore/Module.cpp
+++ b/llvm/lib/VMCore/Module.cpp
@@ -70,6 +70,21 @@ Function *Module::getFunction(const std::string &Name, const FunctionType *Ty) {
return cast_or_null<Function>(SymTab->lookup(PointerType::get(Ty), Name));
}
+// addTypeName - Insert an entry in the symbol table mapping Str to Type. If
+// there is already an entry for this name, true is returned and the symbol
+// table is not modified.
+//
+bool Module::addTypeName(const std::string &Name, const Type *Ty) {
+ SymbolTable *ST = getSymbolTableSure();
+
+ if (ST->lookup(Type::TypeTy, 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...
+ ((Value*)Ty)->setName(Name, ST);
+
+ return false;
+}
// dropAllReferences() - This function causes all the subinstructions to "let
OpenPOWER on IntegriCloud