diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2010-05-27 15:15:58 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2010-05-27 15:15:58 +0000 |
commit | 1e3dec662ea18131c495db50caccc57f77b7a5fe (patch) | |
tree | 9fad9a5d5dd8c4ff54af48edad9c8cc26dd5fda1 /include/llvm/ADT | |
parent | 377552607e51dc1d3e6ff33833f9620bcfe815ac (diff) | |
download | FreeBSD-src-1e3dec662ea18131c495db50caccc57f77b7a5fe.zip FreeBSD-src-1e3dec662ea18131c495db50caccc57f77b7a5fe.tar.gz |
Update LLVM to r104832.
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r-- | include/llvm/ADT/DenseMap.h | 5 | ||||
-rw-r--r-- | include/llvm/ADT/EquivalenceClasses.h | 2 | ||||
-rw-r--r-- | include/llvm/ADT/SparseBitVector.h | 16 | ||||
-rw-r--r-- | include/llvm/ADT/StringRef.h | 4 | ||||
-rw-r--r-- | include/llvm/ADT/Twine.h | 15 | ||||
-rw-r--r-- | include/llvm/ADT/ilist_node.h | 50 |
6 files changed, 76 insertions, 16 deletions
diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h index 393473bd..5c99473 100644 --- a/include/llvm/ADT/DenseMap.h +++ b/include/llvm/ADT/DenseMap.h @@ -79,13 +79,14 @@ public: typedef DenseMapIterator<KeyT, ValueT, KeyInfoT, ValueInfoT, true> const_iterator; inline iterator begin() { - return iterator(Buckets, Buckets+NumBuckets); + // When the map is empty, avoid the overhead of AdvancePastEmptyBuckets(). + return empty() ? end() : iterator(Buckets, Buckets+NumBuckets); } inline iterator end() { return iterator(Buckets+NumBuckets, Buckets+NumBuckets); } inline const_iterator begin() const { - return const_iterator(Buckets, Buckets+NumBuckets); + return empty() ? end() : const_iterator(Buckets, Buckets+NumBuckets); } inline const_iterator end() const { return const_iterator(Buckets+NumBuckets, Buckets+NumBuckets); diff --git a/include/llvm/ADT/EquivalenceClasses.h b/include/llvm/ADT/EquivalenceClasses.h index 5f89823..91a1429 100644 --- a/include/llvm/ADT/EquivalenceClasses.h +++ b/include/llvm/ADT/EquivalenceClasses.h @@ -191,7 +191,7 @@ public: /// insert - Insert a new value into the union/find set, ignoring the request /// if the value already exists. iterator insert(const ElemTy &Data) { - return TheMapping.insert(Data).first; + return TheMapping.insert(ECValue(Data)).first; } /// findLeader - Given a value in the set, return a member iterator for the diff --git a/include/llvm/ADT/SparseBitVector.h b/include/llvm/ADT/SparseBitVector.h index 6c813ec..0862981 100644 --- a/include/llvm/ADT/SparseBitVector.h +++ b/include/llvm/ADT/SparseBitVector.h @@ -889,13 +889,17 @@ operator-(const SparseBitVector<ElementSize> &LHS, // Dump a SparseBitVector to a stream template <unsigned ElementSize> void dump(const SparseBitVector<ElementSize> &LHS, raw_ostream &out) { - out << "[ "; - - typename SparseBitVector<ElementSize>::iterator bi; - for (bi = LHS.begin(); bi != LHS.end(); ++bi) { - out << *bi << " "; + out << "["; + + typename SparseBitVector<ElementSize>::iterator bi = LHS.begin(), + be = LHS.end(); + if (bi != be) { + out << *bi; + for (++bi; bi != be; ++bi) { + out << " " << *bi; + } } - out << " ]\n"; + out << "]\n"; } } // end namespace llvm diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h index ab6358b..33756f6 100644 --- a/include/llvm/ADT/StringRef.h +++ b/include/llvm/ADT/StringRef.h @@ -128,6 +128,10 @@ namespace llvm { /// compare_lower - Compare two strings, ignoring case. int compare_lower(StringRef RHS) const; + /// compare_numeric - Compare two strings, treating sequences of digits as + /// numbers. + int compare_numeric(StringRef RHS) const; + /// \brief Determine the edit distance between this string and another /// string. /// diff --git a/include/llvm/ADT/Twine.h b/include/llvm/ADT/Twine.h index 97e9df4..b519a3e 100644 --- a/include/llvm/ADT/Twine.h +++ b/include/llvm/ADT/Twine.h @@ -99,11 +99,12 @@ namespace llvm { /// A pointer to a StringRef instance. StringRefKind, - /// A pointer to an unsigned int value, to render as an unsigned decimal - /// integer. + /// An unsigned int value reinterpreted as a pointer, to render as an + /// unsigned decimal integer. DecUIKind, - /// A pointer to an int value, to render as a signed decimal integer. + /// An int value reinterpreted as a pointer, to render as a signed + /// decimal integer. DecIKind, /// A pointer to an unsigned long value, to render as an unsigned decimal @@ -259,13 +260,13 @@ namespace llvm { } /// Construct a twine to print \arg Val as an unsigned decimal integer. - explicit Twine(const unsigned int &Val) - : LHS(&Val), LHSKind(DecUIKind), RHSKind(EmptyKind) { + explicit Twine(unsigned Val) + : LHS((void*)(intptr_t)Val), LHSKind(DecUIKind), RHSKind(EmptyKind) { } /// Construct a twine to print \arg Val as a signed decimal integer. - explicit Twine(const int &Val) - : LHS(&Val), LHSKind(DecIKind), RHSKind(EmptyKind) { + explicit Twine(int Val) + : LHS((void*)(intptr_t)Val), LHSKind(DecIKind), RHSKind(EmptyKind) { } /// Construct a twine to print \arg Val as an unsigned decimal integer. diff --git a/include/llvm/ADT/ilist_node.h b/include/llvm/ADT/ilist_node.h index da25f95..f008003 100644 --- a/include/llvm/ADT/ilist_node.h +++ b/include/llvm/ADT/ilist_node.h @@ -49,6 +49,56 @@ class ilist_node : private ilist_half_node<NodeTy> { void setNext(NodeTy *N) { Next = N; } protected: ilist_node() : Next(0) {} + +public: + /// @name Adjacent Node Accessors + /// @{ + + /// \brief Get the previous node, or 0 for the list head. + NodeTy *getPrevNode() { + NodeTy *Prev = this->getPrev(); + + // Check for sentinel. + if (!Prev->getNext()) + return 0; + + return Prev; + } + + /// \brief Get the previous node, or 0 for the list head. + const NodeTy *getPrevNode() const { + const NodeTy *Prev = this->getPrev(); + + // Check for sentinel. + if (!Prev->getNext()) + return 0; + + return Prev; + } + + /// \brief Get the next node, or 0 for the list tail. + NodeTy *getNextNode() { + NodeTy *Next = getNext(); + + // Check for sentinel. + if (!Next->getNext()) + return 0; + + return Next; + } + + /// \brief Get the next node, or 0 for the list tail. + const NodeTy *getNextNode() const { + const NodeTy *Next = getNext(); + + // Check for sentinel. + if (!Next->getNext()) + return 0; + + return Next; + } + + /// @} }; } // End llvm namespace |