aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Module.h
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-02-05 20:47:22 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-02-05 20:47:22 +0000
commitef9b9a793949469cdaa4ab6d0173136229dcab7b (patch)
tree137b30d24ba219e5e745a11abb3807a9c4964aaa /include/llvm/Module.h
parent15468bfc22302b4f79300252425d74cd6865f8b1 (diff)
For PR411:
This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33918 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Module.h')
-rw-r--r--include/llvm/Module.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/include/llvm/Module.h b/include/llvm/Module.h
index 7470debcda..6992563abd 100644
--- a/include/llvm/Module.h
+++ b/include/llvm/Module.h
@@ -23,8 +23,6 @@ namespace llvm {
class GlobalVariable;
class GlobalValueRefMap; // Used by ConstantVals.cpp
class FunctionType;
-class SymbolTable;
-class TypeSymbolTable;
template<> struct ilist_traits<Function>
: public SymbolTableListTraits<Function, Module, Module> {
@@ -91,7 +89,7 @@ private:
FunctionListType FunctionList; ///< The Functions in the module
LibraryListType LibraryList; ///< The Libraries needed by the module
std::string GlobalScopeAsm; ///< Inline Asm at global scope.
- SymbolTable *ValSymTab; ///< Symbol table for values
+ ValueSymbolTable *ValSymTab; ///< Symbol table for values
TypeSymbolTable *TypeSymTab; ///< Symbol table for types
std::string ModuleID; ///< Human readable identifier for the module
std::string TargetTriple; ///< Platform target triple Module compiled on
@@ -178,17 +176,19 @@ public:
/// getFunction - Look up the specified function in the module symbol table.
/// If it does not exist, return null.
- Function *getFunction(const std::string &Name, const FunctionType *Ty);
+ Function *getFunction(const std::string &Name) const;
/// getMainFunction - This function looks up main efficiently. This is such a
/// common case, that it is a method in Module. If main cannot be found, a
/// null pointer is returned.
- Function *getMainFunction();
+ Function *getMainFunction() { return getFunction("main"); }
/// getNamedFunction - Return the first function in the module with the
/// specified name, of arbitrary type. This method returns null if a function
/// with the specified name is not found.
- Function *getNamedFunction(const std::string &Name) const;
+ Function *getNamedFunction(const std::string &Name) const {
+ return getFunction(Name);
+ }
/// @}
/// @name Global Variable Accessors
@@ -200,13 +200,15 @@ public:
/// the top-level PointerType, which represents the address of the global.
/// If AllowInternal is set to true, this function will return types that
/// have InternalLinkage. By default, these types are not returned.
- GlobalVariable *getGlobalVariable(const std::string &Name, const Type *Ty,
- bool AllowInternal = false);
+ GlobalVariable *getGlobalVariable(const std::string &Name,
+ bool AllowInternal = false) const;
/// getNamedGlobal - Return the first global variable in the module with the
/// specified name, of arbitrary type. This method returns null if a global
/// with the specified name is not found.
- GlobalVariable *getNamedGlobal(const std::string &Name) const;
+ GlobalVariable *getNamedGlobal(const std::string &Name) const {
+ return getGlobalVariable(Name, true);
+ }
/// @}
/// @name Type Accessors
@@ -238,9 +240,9 @@ public:
/// Get the Module's list of functions.
FunctionListType &getFunctionList() { return FunctionList; }
/// Get the symbol table of global variable and function identifiers
- const SymbolTable &getValueSymbolTable() const { return *ValSymTab; }
+ const ValueSymbolTable &getValueSymbolTable() const { return *ValSymTab; }
/// Get the Module's symbol table of global variable and function identifiers.
- SymbolTable &getValueSymbolTable() { return *ValSymTab; }
+ ValueSymbolTable &getValueSymbolTable() { return *ValSymTab; }
/// Get the symbol table of types
const TypeSymbolTable &getTypeSymbolTable() const { return *TypeSymTab; }
/// Get the Module's symbol table of types