[llvm-commits] CVS: llvm/include/llvm/Module.h

Reid Spencer reid at x10sys.com
Fri Sep 10 23:22:24 CDT 2004



Changes in directory llvm/include/llvm:

Module.h updated: 1.49 -> 1.50
---
Log message:

Make the dependent libraries list use a SetVector instead of a regular 
vector so that duplicate libraries never occur within a module. 


---
Diffs of the changes:  (+4 -3)

Index: llvm/include/llvm/Module.h
diff -u llvm/include/llvm/Module.h:1.49 llvm/include/llvm/Module.h:1.50
--- llvm/include/llvm/Module.h:1.49	Tue Aug 24 17:47:39 2004
+++ llvm/include/llvm/Module.h	Fri Sep 10 23:22:14 2004
@@ -21,6 +21,7 @@
 
 #include "llvm/Function.h"
 #include "llvm/GlobalVariable.h"
+#include "llvm/ADT/SetVector.h"
 
 namespace llvm {
 
@@ -47,7 +48,7 @@
 public:
   typedef iplist<GlobalVariable> GlobalListType;
   typedef iplist<Function> FunctionListType;
-  typedef std::vector<std::string> LibraryListType;
+  typedef SetVector<std::string> LibraryListType;
 
   // Global Variable iterators...
   typedef GlobalListType::iterator                             giterator;
@@ -238,10 +239,10 @@
   inline unsigned lib_size() const { return LibraryList.size(); }
 
   /// @brief Add a library to the list of dependent libraries
-  inline void addLibrary(const std::string& Lib){ LibraryList.push_back(Lib); }
+  inline void addLibrary(const std::string& Lib){ LibraryList.insert(Lib); }
 
   /// @brief Remove a library from the list of dependent libraries
-  inline void removeLibrary(const std::string& Lib);
+  inline void removeLibrary(const std::string& Lib) { LibraryList.remove(Lib); }
 
   /// @brief Get all the libraries 
   inline const LibraryListType& getLibraries() const { return LibraryList; }






More information about the llvm-commits mailing list