diff options
author | Chris Lattner <sabre@nondot.org> | 2002-04-28 04:51:51 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-04-28 04:51:51 +0000 |
commit | 2c8ff6345f7e119e5fe80be06d3284501b593a94 (patch) | |
tree | da9adec36dc234970ce2bcfcd622cc6d2289fee9 /llvm/lib/VMCore/Module.cpp | |
parent | f491044d0f28aed7ad8c0f4fbd5c36175eb6d029 (diff) | |
download | bcm5719-llvm-2c8ff6345f7e119e5fe80be06d3284501b593a94.tar.gz bcm5719-llvm-2c8ff6345f7e119e5fe80be06d3284501b593a94.zip |
* Incorporate the contents of SymTabValue into Function and Module
* Module no longer subclasses Value
llvm-svn: 2355
Diffstat (limited to 'llvm/lib/VMCore/Module.cpp')
-rw-r--r-- | llvm/lib/VMCore/Module.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/llvm/lib/VMCore/Module.cpp b/llvm/lib/VMCore/Module.cpp index f3d7cd976f3..08bc38723ce 100644 --- a/llvm/lib/VMCore/Module.cpp +++ b/llvm/lib/VMCore/Module.cpp @@ -28,9 +28,9 @@ struct GlobalValueRefMap : public std::map<GlobalValue*, ConstantPointerRef*>{ }; -Module::Module() - : Value(Type::VoidTy, Value::ModuleVal, ""), SymTabValue(this), - GlobalList(this, this), FunctionList(this, this), GVRefMap(0) { +Module::Module() : GlobalList(this, this), FunctionList(this, this) { + GVRefMap = 0; + SymTab = 0; } Module::~Module() { @@ -39,8 +39,29 @@ Module::~Module() { GlobalList.setParent(0); FunctionList.delete_all(); FunctionList.setParent(0); + delete SymTab; } +SymbolTable *Module::getSymbolTableSure() { + if (!SymTab) SymTab = new SymbolTable(0); + return SymTab; +} + +// hasSymbolTable() - Returns true if there is a symbol table allocated to +// this object AND if there is at least one name in it! +// +bool Module::hasSymbolTable() const { + if (!SymTab) return false; + + for (SymbolTable::const_iterator I = SymTab->begin(), E = SymTab->end(); + I != E; ++I) + if (I->second.begin() != I->second.end()) + return true; // Found nonempty type plane! + + return false; +} + + // getOrInsertFunction - Look up the specified function in the module symbol // table. If it does not exist, add a prototype for the function and return // it. This is nice because it allows most passes to get away with not handling |