From 6734b57d1bcd743491b627979f7801f94c97a970 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Sun, 4 Feb 2007 00:40:42 +0000 Subject: For PR1163: Make the Module's dependent library use a std::vector instead of SetVector adjust #includes in .cpp files because SetVector.h is no longer included. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33855 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Module.h | 7 +++---- lib/Transforms/Instrumentation/RSProfiling.h | 1 + lib/Transforms/Scalar/InstructionCombining.cpp | 1 + lib/Transforms/Scalar/PredicateSimplifier.cpp | 2 +- lib/Transforms/Utils/LowerInvoke.cpp | 1 + lib/VMCore/Module.cpp | 17 +++++++++++++++++ 6 files changed, 24 insertions(+), 5 deletions(-) diff --git a/include/llvm/Module.h b/include/llvm/Module.h index f5cb9f6a13..7470debcda 100644 --- a/include/llvm/Module.h +++ b/include/llvm/Module.h @@ -16,7 +16,6 @@ #include "llvm/Function.h" #include "llvm/GlobalVariable.h" -#include "llvm/ADT/SetVector.h" #include "llvm/Support/DataTypes.h" namespace llvm { @@ -63,7 +62,7 @@ public: typedef iplist FunctionListType; /// The type for the list of dependent libraries. - typedef SetVector LibraryListType; + typedef std::vector LibraryListType; /// The Global Variable iterator. typedef GlobalListType::iterator global_iterator; @@ -290,9 +289,9 @@ public: /// @brief Returns the number of items in the list of libraries. inline size_t lib_size() const { return LibraryList.size(); } /// @brief Add a library to the list of dependent libraries - inline void addLibrary(const std::string& Lib){ LibraryList.insert(Lib); } + void addLibrary(const std::string& Lib); /// @brief Remove a library from the list of dependent libraries - inline void removeLibrary(const std::string& Lib) { LibraryList.remove(Lib); } + void removeLibrary(const std::string& Lib); /// @brief Get all the libraries inline const LibraryListType& getLibraries() const { return LibraryList; } diff --git a/lib/Transforms/Instrumentation/RSProfiling.h b/lib/Transforms/Instrumentation/RSProfiling.h index e07db00452..747773a87c 100644 --- a/lib/Transforms/Instrumentation/RSProfiling.h +++ b/lib/Transforms/Instrumentation/RSProfiling.h @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// #include "llvm/Transforms/RSProfiling.h" +#include namespace llvm { /// RSProfilers_std - a simple support class for profilers that handles most diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 49a1775047..fe9a003f2f 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -54,6 +54,7 @@ #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" #include +#include using namespace llvm; using namespace llvm::PatternMatch; diff --git a/lib/Transforms/Scalar/PredicateSimplifier.cpp b/lib/Transforms/Scalar/PredicateSimplifier.cpp index aecd6957bd..a11d5bdfcd 100644 --- a/lib/Transforms/Scalar/PredicateSimplifier.cpp +++ b/lib/Transforms/Scalar/PredicateSimplifier.cpp @@ -76,7 +76,7 @@ #include "llvm/Pass.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/SetOperations.h" -#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/SetVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Analysis/Dominators.h" diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp index a027743bda..62eec75160 100644 --- a/lib/Transforms/Utils/LowerInvoke.cpp +++ b/lib/Transforms/Utils/LowerInvoke.cpp @@ -48,6 +48,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/Target/TargetLowering.h" #include +#include using namespace llvm; STATISTIC(NumInvokes, "Number of invokes replaced"); diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp index d8c7356757..efa6e6c7c0 100644 --- a/lib/VMCore/Module.cpp +++ b/lib/VMCore/Module.cpp @@ -360,3 +360,20 @@ void Module::dropAllReferences() { I->dropAllReferences(); } +void Module::addLibrary(const std::string& Lib) { + for (Module::lib_iterator I = lib_begin(), E = lib_end(); I != E; ++I) + if (*I == Lib) + return; + LibraryList.push_back(Lib); +} + +void Module::removeLibrary(const std::string& Lib) { + LibraryListType::iterator I = LibraryList.begin(); + LibraryListType::iterator E = LibraryList.end(); + for (;I != E; ++I) + if (*I == Lib) { + LibraryList.erase(I); + return; + } +} + -- cgit v1.2.3