* Incorporate the contents of SymTabValue into Function and Module
* Module no longer subclasses Value

llvm-svn: 2355
diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp
index 598f9fd..c15a888 100644
--- a/llvm/lib/VMCore/Function.cpp
+++ b/llvm/lib/VMCore/Function.cpp
@@ -45,7 +45,8 @@
 Function::Function(const FunctionType *Ty, bool isInternal,
                    const std::string &name)
   : GlobalValue(PointerType::get(Ty), Value::FunctionVal, isInternal, name),
-    SymTabValue(this), BasicBlocks(this), ArgumentList(this, this) {
+    BasicBlocks(this), ArgumentList(this, this) {
+  ParentSymTab = SymTab = 0;
 }
 
 Function::~Function() {
@@ -59,6 +60,7 @@
   // Delete all of the method arguments and unlink from symbol table...
   ArgumentList.delete_all();
   ArgumentList.setParent(0);
+  delete SymTab;
 }
 
 // Specialize setName to take care of symbol table majik
@@ -75,7 +77,8 @@
   Parent = parent;
 
   // Relink symbol tables together...
-  setParentSymTab(Parent ? Parent->getSymbolTableSure() : 0);
+  ParentSymTab = Parent ? Parent->getSymbolTableSure() : 0;
+  if (SymTab) SymTab->setParentSymTab(ParentSymTab);
 }
 
 const FunctionType *Function::getFunctionType() const {
@@ -86,6 +89,27 @@
   return getFunctionType()->getReturnType();
 }
 
+SymbolTable *Function::getSymbolTableSure() {
+  if (!SymTab) SymTab = new SymbolTable(ParentSymTab);
+  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 Function::hasSymbolTable() const {
+  if (!SymTab) return false;
+
+  for (SymbolTable::const_iterator I = SymTab->begin(); 
+       I != SymTab->end(); ++I) {
+    if (I->second.begin() != I->second.end())
+      return true;                                // Found nonempty type plane!
+  }
+  
+  return false;
+}
+
+
 // dropAllReferences() - This function causes all the subinstructions to "let
 // go" of all references that they are maintaining.  This allows one to
 // 'delete' a whole class at a time, even though there may be circular