diff options
author | Chris Lattner <sabre@nondot.org> | 2002-01-20 22:54:45 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-01-20 22:54:45 +0000 |
commit | 697954c15da58bd8b186dbafdedd8b06db770201 (patch) | |
tree | e119a71f09b5c2513c8c270161ae2a858c6f3b96 /include/llvm | |
parent | 13c4659220bc78a0a3529f4d9e57546e898088e3 (diff) |
Changes to build successfully with GCC 3.02
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1503 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
73 files changed, 454 insertions, 489 deletions
diff --git a/include/llvm/ADT/DepthFirstIterator.h b/include/llvm/ADT/DepthFirstIterator.h index a2d5a9df68..2961497adc 100644 --- a/include/llvm/ADT/DepthFirstIterator.h +++ b/include/llvm/ADT/DepthFirstIterator.h @@ -20,21 +20,21 @@ class df_iterator : public std::forward_iterator<typename GT::NodeType, typedef typename GT::NodeType NodeType; typedef typename GT::ChildIteratorType ChildItTy; - set<NodeType *> Visited; // All of the blocks visited so far... + std::set<NodeType *> Visited; // All of the blocks visited so far... // VisitStack - Used to maintain the ordering. Top = current block // First element is node pointer, second is the 'next child' to visit - stack<pair<NodeType *, ChildItTy> > VisitStack; + std::stack<std::pair<NodeType *, ChildItTy> > VisitStack; const bool Reverse; // Iterate over children before self? private: void reverseEnterNode() { - pair<NodeType *, ChildItTy> &Top = VisitStack.top(); + std::pair<NodeType *, ChildItTy> &Top = VisitStack.top(); NodeType *Node = Top.first; ChildItTy &It = Top.second; for (; It != GT::child_end(Node); ++It) { NodeType *Child = *It; if (!Visited.count(Child)) { Visited.insert(Child); - VisitStack.push(make_pair(Child, GT::child_begin(Child))); + VisitStack.push(std::make_pair(Child, GT::child_begin(Child))); reverseEnterNode(); return; } @@ -43,7 +43,7 @@ private: inline df_iterator(NodeType *Node, bool reverse) : Reverse(reverse) { Visited.insert(Node); - VisitStack.push(make_pair(Node, GT::child_begin(Node))); + VisitStack.push(std::make_pair(Node, GT::child_begin(Node))); if (Reverse) reverseEnterNode(); } inline df_iterator() { /* End is when stack is empty */ } @@ -81,7 +81,7 @@ public: reverseEnterNode(); } else { // Normal Depth First Iterator do { - pair<NodeType *, ChildItTy> &Top = VisitStack.top(); + std::pair<NodeType *, ChildItTy> &Top = VisitStack.top(); NodeType *Node = Top.first; ChildItTy &It = Top.second; @@ -90,7 +90,7 @@ public: if (!Visited.count(Next)) { // Has our next sibling been visited? // No, do it now. Visited.insert(Next); - VisitStack.push(make_pair(Next, GT::child_begin(Next))); + VisitStack.push(std::make_pair(Next, GT::child_begin(Next))); return *this; } } diff --git a/include/llvm/ADT/HashExtras.h b/include/llvm/ADT/HashExtras.h index 6ea831e78f..d7e48a3b62 100644 --- a/include/llvm/ADT/HashExtras.h +++ b/include/llvm/ADT/HashExtras.h @@ -11,7 +11,10 @@ #define LLVM_SUPPORT_HASHEXTRAS_H #include <string> -#include <hash_map> +#include <ext/hash_map> + +// Cannot specialize hash template from outside of the std namespace. +namespace std { template <> struct hash<string> { size_t operator()(string const &str) const { @@ -24,4 +27,6 @@ template <class T> struct hash<T *> { inline size_t operator()(const T *Val) const { return (size_t)Val; } }; +} // End namespace std + #endif diff --git a/include/llvm/ADT/PostOrderIterator.h b/include/llvm/ADT/PostOrderIterator.h index 89a9b4db86..85b3bf649c 100644 --- a/include/llvm/ADT/PostOrderIterator.h +++ b/include/llvm/ADT/PostOrderIterator.h @@ -20,10 +20,10 @@ class po_iterator : public std::forward_iterator<typename GT::NodeType, typedef typename GT::NodeType NodeType; typedef typename GT::ChildIteratorType ChildItTy; - set<NodeType *> Visited; // All of the blocks visited so far... + std::set<NodeType *> Visited; // All of the blocks visited so far... // VisitStack - Used to maintain the ordering. Top = current block // First element is basic block pointer, second is the 'next child' to visit - stack<pair<NodeType *, ChildItTy> > VisitStack; + std::stack<std::pair<NodeType *, ChildItTy> > VisitStack; void traverseChild() { while (VisitStack.top().second != GT::child_end(VisitStack.top().first)) { @@ -122,10 +122,10 @@ ipo_iterator<T> ipo_end(T G){ // } // -typedef reverse_iterator<vector<BasicBlock*>::iterator> rpo_iterator; +typedef std::vector<BasicBlock*>::reverse_iterator rpo_iterator; // TODO: FIXME: ReversePostOrderTraversal is not generic! class ReversePostOrderTraversal { - vector<BasicBlock*> Blocks; // Block list in normal PO order + std::vector<BasicBlock*> Blocks; // Block list in normal PO order inline void Initialize(BasicBlock *BB) { copy(po_begin(BB), po_end(BB), back_inserter(Blocks)); } diff --git a/include/llvm/ADT/STLExtras.h b/include/llvm/ADT/STLExtras.h index 44d789dcf2..0168bf2624 100644 --- a/include/llvm/ADT/STLExtras.h +++ b/include/llvm/ADT/STLExtras.h @@ -36,7 +36,7 @@ // arguments to get a boolean result. // template<class Ty> -struct bitwise_or : public binary_function<Ty, Ty, bool> { +struct bitwise_or : public std::binary_function<Ty, Ty, bool> { bool operator()(const Ty& left, const Ty& right) const { return left | right; } @@ -70,9 +70,9 @@ class mapped_iterator { RootIt current; UnaryFunc Fn; public: - typedef typename iterator_traits<RootIt>::iterator_category + typedef typename std::iterator_traits<RootIt>::iterator_category iterator_category; - typedef typename iterator_traits<RootIt>::difference_type + typedef typename std::iterator_traits<RootIt>::difference_type difference_type; typedef typename UnaryFunc::result_type value_type; typedef typename UnaryFunc::result_type *pointer; @@ -102,6 +102,7 @@ public: _Self& operator-= (difference_type n) { current -= n; return *this; } reference operator[](difference_type n) const { return *(*this + n); } + inline bool operator!=(const _Self &X) const { return !operator==(X); } inline bool operator==(const _Self &X) const { return current == X.current; } inline bool operator< (const _Self &X) const { return current < X.current; } diff --git a/include/llvm/ADT/StringExtras.h b/include/llvm/ADT/StringExtras.h index e67e25ced5..46e2c5aaf0 100644 --- a/include/llvm/ADT/StringExtras.h +++ b/include/llvm/ADT/StringExtras.h @@ -11,7 +11,7 @@ #include <string> #include <stdio.h> -static inline string utostr(uint64_t X, bool isNeg = false) { +static inline std::string utostr(uint64_t X, bool isNeg = false) { char Buffer[40]; char *BufPtr = Buffer+39; @@ -25,10 +25,10 @@ static inline string utostr(uint64_t X, bool isNeg = false) { if (isNeg) *--BufPtr = '-'; // Add negative sign... - return string(BufPtr); + return std::string(BufPtr); } -static inline string itostr(int64_t X) { +static inline std::string itostr(int64_t X) { if (X < 0) return utostr((uint64_t)-X, true); else @@ -36,7 +36,7 @@ static inline string itostr(int64_t X) { } -static inline string utostr(unsigned X, bool isNeg = false) { +static inline std::string utostr(unsigned X, bool isNeg = false) { char Buffer[20]; char *BufPtr = Buffer+19; @@ -50,17 +50,17 @@ static inline string utostr(unsigned X, bool isNeg = false) { if (isNeg) *--BufPtr = '-'; // Add negative sign... - return string(BufPtr); + return std::string(BufPtr); } -static inline string itostr(int X) { +static inline std::string itostr(int X) { if (X < 0) return utostr((unsigned)-X, true); else return utostr((unsigned)X); } -static inline string ftostr(double V) { +static inline std::string ftostr(double V) { char Buffer[200]; snprintf(Buffer, 200, "%e", V); return Buffer; diff --git a/include/llvm/ADT/Tree.h b/include/llvm/ADT/Tree.h index 33b0bb7b03..9e8d5ae7ef 100644 --- a/include/llvm/ADT/Tree.h +++ b/include/llvm/ADT/Tree.h @@ -12,21 +12,21 @@ template<class ConcreteTreeNode, class Payload> class Tree { - vector<ConcreteTreeNode*> Children; // This nodes children, if any - ConcreteTreeNode *Parent; // Parent of this node... - Payload Data; // Data held in this node... + std::vector<ConcreteTreeNode*> Children; // This nodes children, if any + ConcreteTreeNode *Parent; // Parent of this node... + Payload Data; // Data held in this node... protected: - void setChildren(const vector<ConcreteTreeNode*> &children) { + void setChildren(const std::vector<ConcreteTreeNode*> &children) { Children = children; } public: inline Tree(ConcreteTreeNode *parent) : Parent(parent) {} - inline Tree(const vector<ConcreteTreeNode*> &children, ConcreteTreeNode *par) - : Children(children), Parent(par) {} + inline Tree(const std::vector<ConcreteTreeNode*> &children, + ConcreteTreeNode *par) : Children(children), Parent(par) {} - inline Tree(const vector<ConcreteTreeNode*> &children, ConcreteTreeNode *par, - const Payload &data) + inline Tree(const std::vector<ConcreteTreeNode*> &children, + ConcreteTreeNode *par, const Payload &data) : Children(children), Parent(parent), Data(data) {} // Tree dtor - Free all children diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h index 8365a4f397..f5b020269c 100644 --- a/include/llvm/Analysis/CallGraph.h +++ b/include/llvm/Analysis/CallGraph.h @@ -27,12 +27,12 @@ namespace cfg { class CallGraph; class CallGraphNode { Method *Meth; - vector<CallGraphNode*> CalledMethods; + std::vector<CallGraphNode*> CalledMethods; CallGraphNode(const CallGraphNode &); // Do not implement public: - typedef vector<CallGraphNode*>::iterator iterator; - typedef vector<CallGraphNode*>::const_iterator const_iterator; + typedef std::vector<CallGraphNode*>::iterator iterator; + typedef std::vector<CallGraphNode*>::const_iterator const_iterator; // getMethod - Return the method that this call graph node represents... Method *getMethod() const { return Meth; } @@ -65,7 +65,7 @@ private: // Stuff to construct the node, used by CallGraph class CallGraph { Module *Mod; // The module this call graph represents - typedef map<const Method *, CallGraphNode *> MethodMapTy; + typedef std::map<const Method *, CallGraphNode *> MethodMapTy; MethodMapTy MethodMap; // Map from a method to its node CallGraphNode *Root; diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index 6639b64a05..c018eafe2c 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -47,8 +47,9 @@ public: // class DominatorSet : public DominatorBase { public: - typedef set<const BasicBlock*> DomSetType; // Dom set for a bb - typedef map<const BasicBlock *, DomSetType> DomSetMapType; // Map of dom sets + typedef std::set<const BasicBlock*> DomSetType; // Dom set for a bb + // Map of dom sets + typedef std::map<const BasicBlock*, DomSetType> DomSetMapType; private: DomSetMapType Doms; @@ -91,7 +92,7 @@ public: // method. // class ImmediateDominators : public DominatorBase { - map<const BasicBlock*, const BasicBlock*> IDoms; + std::map<const BasicBlock*, const BasicBlock*> IDoms; void calcIDoms(const DominatorSet &DS); public: @@ -104,7 +105,7 @@ public: } // Accessor interface: - typedef map<const BasicBlock*, const BasicBlock*> IDomMapType; + typedef std::map<const BasicBlock*, const BasicBlock*> IDomMapType; typedef IDomMapType::const_iterator const_iterator; inline const_iterator begin() const { return IDoms.begin(); } inline const_iterator end() const { return IDoms.end(); } @@ -114,7 +115,7 @@ public: // node returns null, because it does not have an immediate dominator. // inline const BasicBlock *operator[](const BasicBlock *BB) const { - map<const BasicBlock*, const BasicBlock*>::const_iterator I = + std::map<const BasicBlock*, const BasicBlock*>::const_iterator I = IDoms.find(BB); return I != IDoms.end() ? I->second : 0; } @@ -130,18 +131,18 @@ class DominatorTree : public DominatorBase { public: typedef Node2 Node; private: - map<const BasicBlock*, Node*> Nodes; + std::map<const BasicBlock*, Node*> Nodes; void calculate(const DominatorSet &DS); - typedef map<const BasicBlock*, Node*> NodeMapType; + typedef std::map<const BasicBlock*, Node*> NodeMapType; public: - class Node2 : public vector<Node*> { + class Node2 : public std::vector<Node*> { friend class DominatorTree; const BasicBlock *TheNode; Node2 * const IDom; public: inline const BasicBlock *getNode() const { return TheNode; } inline Node2 *getIDom() const { return IDom; } - inline const vector<Node*> &getChildren() const { return *this; } + inline const std::vector<Node*> &getChildren() const { return *this; } // dominates - Returns true iff this dominates N. Note that this is not a // constant time operation! @@ -181,8 +182,8 @@ public: // class DominanceFrontier : public DominatorBase { public: - typedef set<const BasicBlock*> DomSetType; // Dom set for a bb - typedef map<const BasicBlock *, DomSetType> DomSetMapType; // Map of dom sets + typedef std::set<const BasicBlock*> DomSetType; // Dom set for a bb + typedef std::map<const BasicBlock*, DomSetType> DomSetMapType; // Dom set map private: DomSetMapType Frontiers; const DomSetType &calcDomFrontier(const DominatorTree &DT, diff --git a/include/llvm/Analysis/FindUnsafePointerTypes.h b/include/llvm/Analysis/FindUnsafePointerTypes.h index 3f66f3308b..c52ca2fbbb 100644 --- a/include/llvm/Analysis/FindUnsafePointerTypes.h +++ b/include/llvm/Analysis/FindUnsafePointerTypes.h @@ -24,11 +24,11 @@ class PointerType; struct FindUnsafePointerTypes : public Pass { // UnsafeTypes - Set of types that are not safe to transform. - set<PointerType*> UnsafeTypes; + std::set<PointerType*> UnsafeTypes; public: // Accessor for underlying type set... - inline const set<PointerType*> &getUnsafeTypes() const { + inline const std::set<PointerType*> &getUnsafeTypes() const { return UnsafeTypes; } @@ -41,7 +41,7 @@ public: // printResults - Loop over the results of the analysis, printing out unsafe // types. // - void printResults(const Module *Mod, ostream &o); + void printResults(const Module *Mod, std::ostream &o); }; #endif diff --git a/include/llvm/Analysis/FindUsedTypes.h b/include/llvm/Analysis/FindUsedTypes.h index aa00e5f8a8..956901dfaa 100644 --- a/include/llvm/Analysis/FindUsedTypes.h +++ b/include/llvm/Analysis/FindUsedTypes.h @@ -12,7 +12,7 @@ class SymbolTable; class FindUsedTypes : public Pass { - set<const Type *> UsedTypes; + std::set<const Type *> UsedTypes; bool IncludeSymbolTables; public: @@ -25,13 +25,13 @@ public: // getTypes - After the pass has been run, return the set containing all of // the types used in the module. // - inline const set<const Type *> &getTypes() const { return UsedTypes; } + inline const std::set<const Type *> &getTypes() const { return UsedTypes; } // Print the types found in the module. If the optional Module parameter is // passed in, then the types are printed symboli |