summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Function.h16
-rw-r--r--lib/VMCore/Function.cpp23
2 files changed, 4 insertions, 35 deletions
diff --git a/include/llvm/Function.h b/include/llvm/Function.h
index bb2c3ca996..34b6c0f252 100644
--- a/include/llvm/Function.h
+++ b/include/llvm/Function.h
@@ -111,22 +111,12 @@ public:
//===--------------------------------------------------------------------===//
// Symbol Table Accessing functions...
- /// hasSymbolTable() - Returns true if there is a symbol table allocated to
- /// this object AND if there is at least one name in it!
- ///
- bool hasSymbolTable() const;
-
- /// getSymbolTable() - CAUTION: The current symbol table may be null if there
- /// are no names (ie, the symbol table is empty)
+ /// getSymbolTable() - Return the symbol table...
///
inline SymbolTable *getSymbolTable() { return SymTab; }
inline const SymbolTable *getSymbolTable() const { return SymTab; }
-
- /// getSymbolTableSure is guaranteed to not return a null pointer, because if
- /// the function does not already have a symtab, one is created. Use this if
- /// you intend to put something into the symbol table for the function.
- ///
- SymbolTable *getSymbolTableSure(); // Implemented in Value.cpp
+ SymbolTable *getSymbolTableSure() { return SymTab; }
+ bool hasSymbolTable() const { return true; }
//===--------------------------------------------------------------------===//
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index 5edd9ae2a6..9b837dcaa1 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -84,7 +84,7 @@ Function::Function(const FunctionType *Ty, bool isInternal,
BasicBlocks.setParent(this);
ArgumentList.setItemParent(this);
ArgumentList.setParent(this);
- SymTab = 0;
+ SymTab = new SymbolTable();
// Create the arguments vector, all arguments start out unnamed.
for (unsigned i = 0, e = Ty->getNumParams(); i != e; ++i) {
@@ -137,27 +137,6 @@ const Type *Function::getReturnType() const {
return getFunctionType()->getReturnType();
}
-SymbolTable *Function::getSymbolTableSure() {
- if (!SymTab) SymTab = new SymbolTable();
- 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