Fix an infinite loop bug that Vladimir Prus identified.
[oota-llvm.git] / include / llvm / Module.h
index 917fd429d9ab5b2517b559fd3b7a6d8aab12ec79..84aa2a5e39426fb7a70dd9cef0584f4d333674f3 100644 (file)
@@ -21,7 +21,6 @@
 
 #include "llvm/Function.h"
 #include "llvm/GlobalVariable.h"
-#include "llvm/InlineAsm.h"
 #include "llvm/ADT/SetVector.h"
 #include "llvm/Support/DataTypes.h"
 
@@ -46,19 +45,11 @@ template<> struct ilist_traits<GlobalVariable>
   static void destroySentinel(GlobalVariable *GV) { delete GV; }
   static iplist<GlobalVariable> &getList(Module *M);
 };
-template<> struct ilist_traits<InlineAsm>
-: public SymbolTableListTraits<InlineAsm, Module, Module> {
-  // createSentinel is used to create a node that marks the end of the list.
-  static InlineAsm *createSentinel();
-  static void destroySentinel(InlineAsm *GV) { delete GV; }
-  static iplist<InlineAsm> &getList(Module *M);
-};
 
 class Module {
 public:
   typedef iplist<GlobalVariable> GlobalListType;
   typedef iplist<Function> FunctionListType;
-  typedef iplist<InlineAsm> InlineAsmListType;
   typedef SetVector<std::string> LibraryListType;
 
   // Global Variable iterators.
@@ -69,10 +60,6 @@ public:
   typedef FunctionListType::iterator                          iterator;
   typedef FunctionListType::const_iterator              const_iterator;
 
-  // Inline Asm iterators.
-  typedef InlineAsmListType::iterator               inlineasm_iterator;
-  typedef InlineAsmListType::const_iterator   const_inlineasm_iterator;
-  
   // Library list iterators.
   typedef LibraryListType::const_iterator lib_iterator;
 
@@ -82,7 +69,6 @@ public:
 private:
   GlobalListType GlobalList;     // The Global Variables in the module
   FunctionListType FunctionList; // The Functions in the module
-  InlineAsmListType InlineAsmList; // The inline asm objects in the module.
   LibraryListType LibraryList;   // The Libraries needed by the module
   std::string GlobalScopeAsm;    // Inline Asm at global scope.
   SymbolTable *SymTab;           // Symbol Table for the module
@@ -162,6 +148,12 @@ public:
   GlobalVariable *getGlobalVariable(const std::string &Name, const Type *Ty,
                                     bool AllowInternal = false);
 
+  /// 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);
+  
 
   //===--------------------------------------------------------------------===//
   // Methods for easy access to the types in the module.
@@ -193,8 +185,6 @@ public:
         GlobalListType &getGlobalList()             { return GlobalList; }
   const FunctionListType &getFunctionList() const   { return FunctionList; }
         FunctionListType &getFunctionList()         { return FunctionList; }
-  const InlineAsmListType &getInlineAsmList() const { return InlineAsmList; }
-        InlineAsmListType &getInlineAsmList()       { return InlineAsmList; }
 
   /// getSymbolTable() - Get access to the symbol table for the module, where
   /// global variables and functions are identified.
@@ -222,21 +212,6 @@ public:
   size_t                   size() const { return FunctionList.size(); }
   bool                    empty() const { return FunctionList.empty(); }
 
-  // Inline Asm list interface
-  inlineasm_iterator inlineasm_begin() {
-    return InlineAsmList.begin();
-  }
-  const_inlineasm_iterator inlineasm_begin() const {
-    return InlineAsmList.begin();
-  }
-  inlineasm_iterator inlineasm_end() {
-    return InlineAsmList.end();
-  }
-  const_inlineasm_iterator inlineasm_end() const {
-    return InlineAsmList.end();
-  }
-  bool inlineasm_empty() const { return InlineAsmList.empty(); }
-  
   //===--------------------------------------------------------------------===//
   // List of dependent library access functions