aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Module.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-04-28 04:51:51 +0000
committerChris Lattner <sabre@nondot.org>2002-04-28 04:51:51 +0000
commit11aa4770fe38befb3926646cf9ea7ed0ff7e33a8 (patch)
treea14c289b2ba7df80c6d81a34a761472f3e46968d /lib/VMCore/Module.cpp
parent5240dac674f9b7104d799180d48ca85e13d95502 (diff)
downloadexternal_llvm-11aa4770fe38befb3926646cf9ea7ed0ff7e33a8.zip
external_llvm-11aa4770fe38befb3926646cf9ea7ed0ff7e33a8.tar.gz
external_llvm-11aa4770fe38befb3926646cf9ea7ed0ff7e33a8.tar.bz2
* Incorporate the contents of SymTabValue into Function and Module
* Module no longer subclasses Value git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2355 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Module.cpp')
-rw-r--r--lib/VMCore/Module.cpp27
1 files changed, 24 insertions, 3 deletions
diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp
index f3d7cd9..08bc387 100644
--- a/lib/VMCore/Module.cpp
+++ b/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