Index: llvm/trunk/include/llvm/ADT/DAGDeltaAlgorithm.h =================================================================== --- llvm/trunk/include/llvm/ADT/DAGDeltaAlgorithm.h +++ llvm/trunk/include/llvm/ADT/DAGDeltaAlgorithm.h @@ -10,6 +10,7 @@ #define LLVM_ADT_DAGDELTAALGORITHM_H #include +#include #include namespace llvm { @@ -37,6 +38,7 @@ /// should satisfy. class DAGDeltaAlgorithm { virtual void anchor(); + public: typedef unsigned change_ty; typedef std::pair edge_ty; @@ -46,7 +48,7 @@ typedef std::vector changesetlist_ty; public: - virtual ~DAGDeltaAlgorithm() {} + virtual ~DAGDeltaAlgorithm() = default; /// Run - Minimize the DAG formed by the \p Changes vertices and the /// \p Dependencies edges by executing \see ExecuteOneTest() on subsets of @@ -74,4 +76,4 @@ } // end namespace llvm -#endif +#endif // LLVM_ADT_DAGDELTAALGORITHM_H Index: llvm/trunk/include/llvm/ADT/DepthFirstIterator.h =================================================================== --- llvm/trunk/include/llvm/ADT/DepthFirstIterator.h +++ llvm/trunk/include/llvm/ADT/DepthFirstIterator.h @@ -34,10 +34,13 @@ #define LLVM_ADT_DEPTHFIRSTITERATOR_H #include "llvm/ADT/GraphTraits.h" +#include "llvm/ADT/None.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/iterator_range.h" +#include #include +#include #include namespace llvm { @@ -55,6 +58,7 @@ public: df_iterator_storage(SetType &VSet) : Visited(VSet) {} df_iterator_storage(const df_iterator_storage &S) : Visited(S.Visited) {} + SetType &Visited; }; @@ -63,8 +67,8 @@ // node have been processed. It is intended to distinguish of back and // cross edges in the spanning tree but is not used in the common case. template -struct df_iterator_default_set : public llvm::SmallPtrSet { - typedef llvm::SmallPtrSet BaseSet; +struct df_iterator_default_set : public SmallPtrSet { + typedef SmallPtrSet BaseSet; typedef typename BaseSet::iterator iterator; std::pair insert(NodeRef N) { return BaseSet::insert(N) ; } template @@ -99,9 +103,7 @@ this->Visited.insert(Node); VisitStack.push_back(StackElement(Node, None)); } - inline df_iterator() { - // End is when stack is empty - } + inline df_iterator() = default; // End is when stack is empty inline df_iterator(NodeRef Node, SetType &S) : df_iterator_storage(S) { if (this->Visited.insert(Node).second) @@ -298,6 +300,6 @@ return make_range(idf_ext_begin(G, S), idf_ext_end(G, S)); } -} // End llvm namespace +} // end namespace llvm -#endif +#endif // LLVM_ADT_DEPTHFIRSTITERATOR_H Index: llvm/trunk/include/llvm/ADT/EquivalenceClasses.h =================================================================== --- llvm/trunk/include/llvm/ADT/EquivalenceClasses.h +++ llvm/trunk/include/llvm/ADT/EquivalenceClasses.h @@ -15,9 +15,10 @@ #ifndef LLVM_ADT_EQUIVALENCECLASSES_H #define LLVM_ADT_EQUIVALENCECLASSES_H -#include "llvm/Support/DataTypes.h" #include #include +#include +#include #include namespace llvm { @@ -70,6 +71,7 @@ friend class EquivalenceClasses; mutable const ECValue *Leader, *Next; ElemTy Data; + // ECValue ctor - Start out with EndOfList pointing to this node, Next is // Null, isLeader = true. ECValue(const ElemTy &Elt) @@ -81,6 +83,7 @@ // Path compression. return Leader = Leader->getLeader(); } + const ECValue *getEndOfList() const { assert(isLeader() && "Cannot get the end of a list for a non-leader!"); return Leader; @@ -90,6 +93,7 @@ assert(getNext() == nullptr && "Already has a next pointer!"); Next = (const ECValue*)((intptr_t)NewNext | (intptr_t)isLeader()); } + public: ECValue(const ECValue &RHS) : Leader(this), Next((ECValue*)(intptr_t)1), Data(RHS.Data) { @@ -115,7 +119,7 @@ std::set TheMapping; public: - EquivalenceClasses() {} + EquivalenceClasses() = default; EquivalenceClasses(const EquivalenceClasses &RHS) { operator=(RHS); } @@ -187,7 +191,6 @@ return NC; } - //===--------------------------------------------------------------------===// // Mutation methods @@ -210,7 +213,6 @@ return findLeader(TheMapping.find(V)); } - /// union - Merge the two equivalence sets for the specified values, inserting /// them if they do not already exist in the equivalence set. member_iterator unionSets(const ElemTy &V1, const ElemTy &V2) { @@ -243,12 +245,13 @@ const ElemTy, ptrdiff_t> super; const ECValue *Node; friend class EquivalenceClasses; + public: typedef size_t size_type; typedef typename super::pointer pointer; typedef typename super::reference reference; - explicit member_iterator() {} + explicit member_iterator() = default; explicit member_iterator(const ECValue *N) : Node(N) {} reference operator*() const { @@ -278,6 +281,6 @@ }; }; -} // End llvm namespace +} // end namespace llvm -#endif +#endif // LLVM_ADT_EQUIVALENCECLASSES_H Index: llvm/trunk/include/llvm/ADT/FoldingSet.h =================================================================== --- llvm/trunk/include/llvm/ADT/FoldingSet.h +++ llvm/trunk/include/llvm/ADT/FoldingSet.h @@ -19,8 +19,13 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/iterator.h" #include "llvm/Support/Allocator.h" +#include +#include +#include +#include namespace llvm { + /// This folding set used for two purposes: /// 1. Given information about a node we want to create, look up the unique /// instance of the node in the set. If the node already exists, return @@ -184,6 +189,7 @@ /// EltCount-th node won't cause a rebucket operation. reserve is permitted /// to allocate more space than requested by EltCount. void reserve(unsigned EltCount); + /// capacity - Returns the number of nodes permitted in the folding set /// before a rebucket operation is performed. unsigned capacity() { @@ -200,14 +206,17 @@ /// NewBucketCount must be a power of two, and must be greater than the old /// bucket count. void GrowBucketCount(unsigned NewBucketCount); + protected: /// GetNodeProfile - Instantiations of the FoldingSet template implement /// this function to gather data bits for the given node. virtual void GetNodeProfile(Node *N, FoldingSetNodeID &ID) const = 0; + /// NodeEquals - Instantiations of the FoldingSet template implement /// this function to compare the given node with the given ID. virtual bool NodeEquals(Node *N, const FoldingSetNodeID &ID, unsigned IDHash, FoldingSetNodeID &TempID) const=0; + /// ComputeNodeHash - Instantiations of the FoldingSet template implement /// this function to compute a hash value for the given node. virtual unsigned ComputeNodeHash(Node *N, FoldingSetNodeID &TempID) const = 0; @@ -215,8 +224,6 @@ //===----------------------------------------------------------------------===// -template struct FoldingSetTrait; - /// DefaultFoldingSetTrait - This class provides default implementations /// for FoldingSetTrait implementations. /// @@ -252,8 +259,6 @@ template struct FoldingSetTrait : public DefaultFoldingSetTrait {}; -template struct ContextualFoldingSetTrait; - /// DefaultContextualFoldingSetTrait - Like DefaultFoldingSetTrait, but /// for ContextualFoldingSets. template @@ -261,6 +266,7 @@ static void Profile(T &X, FoldingSetNodeID &ID, Ctx Context) { X.Profile(ID, Context); } + static inline bool Equals(T &X, const FoldingSetNodeID &ID, unsigned IDHash, FoldingSetNodeID &TempID, Ctx Context); static inline unsigned ComputeHash(T &X, FoldingSetNodeID &TempID, @@ -279,11 +285,11 @@ /// is often much larger than necessary, and the possibility of heap /// allocation means it requires a non-trivial destructor call. class FoldingSetNodeIDRef { - const unsigned *Data; - size_t Size; + const unsigned *Data = nullptr; + size_t Size = 0; public: - FoldingSetNodeIDRef() : Data(nullptr), Size(0) {} + FoldingSetNodeIDRef() = default; FoldingSetNodeIDRef(const unsigned *D, size_t S) : Data(D), Size(S) {} /// ComputeHash - Compute a strong hash value for this FoldingSetNodeIDRef, @@ -313,7 +319,7 @@ SmallVector Bits; public: - FoldingSetNodeID() {} + FoldingSetNodeID() = default; FoldingSetNodeID(FoldingSetNodeIDRef Ref) : Bits(Ref.getData(), Ref.getData() + Ref.getSize()) {} @@ -418,6 +424,7 @@ T *TN = static_cast(N); FoldingSetTrait::Profile(*TN, ID); } + /// NodeEquals - Instantiations may optionally provide a way to compare a /// node with a specified ID. bool NodeEquals(Node *N, const FoldingSetNodeID &ID, unsigned IDHash, @@ -425,6 +432,7 @@ T *TN = static_cast(N); return FoldingSetTrait::Equals(*TN, ID, IDHash, TempID); } + /// ComputeNodeHash - Instantiations may optionally provide a way to compute a /// hash value directly from a node. unsigned ComputeNodeHash(Node *N, FoldingSetNodeID &TempID) const override { @@ -483,7 +491,7 @@ /// /// T must be a subclass of FoldingSetNode and implement a Profile /// function with signature -/// void Profile(llvm::FoldingSetNodeID &, Ctx); +/// void Profile(FoldingSetNodeID &, Ctx); template class ContextualFoldingSet final : public FoldingSetImpl { // Unfortunately, this can't derive from FoldingSet because the @@ -501,12 +509,14 @@ T *TN = static_cast(N); ContextualFoldingSetTrait::Profile(*TN, ID, Context); } + bool NodeEquals(FoldingSetImpl::Node *N, const FoldingSetNodeID &ID, unsigned IDHash, FoldingSetNodeID &TempID) const override { T *TN = static_cast(N); return ContextualFoldingSetTrait::Equals(*TN, ID, IDHash, TempID, Context); } + unsigned ComputeNodeHash(FoldingSetImpl::Node *N, FoldingSetNodeID &TempID) const override { T *TN = static_cast(N); @@ -558,7 +568,7 @@ /// to provide the interface of FoldingSet but with deterministic iteration /// order based on the insertion order. T must be a subclass of FoldingSetNode /// and implement a Profile function. -template > +template > class FoldingSetVector { FoldingSet Set; VectorT Vector; @@ -623,7 +633,9 @@ class FoldingSetIteratorImpl { protected: FoldingSetNode *NodePtr; + FoldingSetIteratorImpl(void **Bucket); + void advance(); public: @@ -754,11 +766,12 @@ template struct FoldingSetTrait> { static inline void Profile(const std::pair &P, - llvm::FoldingSetNodeID &ID) { + FoldingSetNodeID &ID) { ID.Add(P.first); ID.Add(P.second); } }; -} // End of namespace llvm. -#endif +} // end namespace llvm + +#endif // LLVM_ADT_FOLDINGSET_H Index: llvm/trunk/include/llvm/ADT/ImmutableSet.h =================================================================== --- llvm/trunk/include/llvm/ADT/ImmutableSet.h +++ llvm/trunk/include/llvm/ADT/ImmutableSet.h @@ -16,12 +16,16 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/FoldingSet.h" +#include "llvm/ADT/iterator.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/Support/Allocator.h" -#include "llvm/Support/DataTypes.h" #include "llvm/Support/ErrorHandling.h" #include #include #include +#include +#include +#include namespace llvm { @@ -329,11 +333,13 @@ public: void retain() { ++refCount; } + void release() { assert(refCount > 0); if (--refCount == 0) destroy(); } + void destroy() { if (left) left->release(); @@ -375,7 +381,7 @@ std::vector freeNodes; bool ownsAllocator() const { - return Allocator & 0x1 ? false : true; + return (Allocator & 0x1) == 0; } BumpPtrAllocator& getAllocator() const { @@ -414,7 +420,6 @@ TreeTy* getEmptyTree() const { return nullptr; } protected: - //===--------------------------------------------------===// // A bunch of quick helper functions used for reasoning // about the properties of trees and their children. @@ -649,13 +654,14 @@ : public std::iterator> { SmallVector stack; + public: enum VisitFlag { VisitedNone=0x0, VisitedLeft=0x1, VisitedRight=0x3, Flags=0x3 }; typedef ImutAVLTree TreeTy; - ImutAVLTreeGenericIterator() {} + ImutAVLTreeGenericIterator() = default; ImutAVLTreeGenericIterator(const TreeTy *Root) { if (Root) stack.push_back(reinterpret_cast(Root)); } @@ -671,7 +677,6 @@ return stack.back() & Flags; } - bool atEnd() const { return stack.empty(); } bool atBeginning() const { @@ -881,7 +886,6 @@ } }; - /// Generic profile trait for pointer types. We treat pointers as /// references to unique objects. template @@ -901,7 +905,6 @@ // for element profiling. //===----------------------------------------------------------------------===// - /// ImutContainerInfo - Generic definition of comparison operations for /// elements of immutable containers that defaults to using /// std::equal_to<> and std::less<> to perform comparison of elements. @@ -954,7 +957,7 @@ // Immutable Set //===----------------------------------------------------------------------===// -template > +template > class ImmutableSet { public: typedef typename ValInfo::value_type value_type; @@ -972,9 +975,11 @@ explicit ImmutableSet(TreeTy* R) : Root(R) { if (Root) { Root->retain(); } } + ImmutableSet(const ImmutableSet &X) : Root(X.Root) { if (Root) { Root->retain(); } } + ImmutableSet &operator=(const ImmutableSet &X) { if (Root != X.Root) { if (X.Root) { X.Root->retain(); } @@ -983,6 +988,7 @@ } return *this; } + ~ImmutableSet() { if (Root) { Root->release(); } } @@ -998,6 +1004,9 @@ Factory(BumpPtrAllocator& Alloc, bool canonicalize = true) : F(Alloc), Canonicalize(canonicalize) {} + Factory(const Factory& RHS) = delete; + void operator=(const Factory& RHS) = delete; + /// getEmptySet - Returns an immutable set that contains no elements. ImmutableSet getEmptySet() { return ImmutableSet(F.getEmptyTree()); @@ -1032,10 +1041,6 @@ typename TreeTy::Factory *getTreeFactory() const { return const_cast(&F); } - - private: - Factory(const Factory& RHS) = delete; - void operator=(const Factory& RHS) = delete; }; friend class Factory; @@ -1104,7 +1109,7 @@ }; // NOTE: This may some day replace the current ImmutableSet. -template > +template > class ImmutableSetRef { public: typedef typename ValInfo::value_type value_type; @@ -1126,11 +1131,13 @@ Factory(F) { if (Root) { Root->retain(); } } + ImmutableSetRef(const ImmutableSetRef &X) : Root(X.Root), Factory(X.Factory) { if (Root) { Root->retain(); } } + ImmutableSetRef &operator=(const ImmutableSetRef &X) { if (Root != X.Root) { if (X.Root) { X.Root->retain(); } @@ -1215,4 +1222,4 @@ } // end namespace llvm -#endif +#endif // LLVM_ADT_IMMUTABLESET_H Index: llvm/trunk/include/llvm/ADT/IntervalMap.h =================================================================== --- llvm/trunk/include/llvm/ADT/IntervalMap.h +++ llvm/trunk/include/llvm/ADT/IntervalMap.h @@ -104,11 +104,14 @@ #include "llvm/Support/AlignOf.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/RecyclingAllocator.h" +#include +#include #include +#include +#include namespace llvm { - //===----------------------------------------------------------------------===// //--- Key traits ---// //===----------------------------------------------------------------------===// @@ -131,7 +134,6 @@ template struct IntervalMapInfo { - /// startLess - Return true if x is not in [a;b]. /// This is x < a both for closed intervals and for [a;b) half-open intervals. static inline bool startLess(const T &x, const T &a) { @@ -155,12 +157,10 @@ static inline bool nonEmpty(const T &a, const T &b) { return a <= b; } - }; template struct IntervalMapHalfOpenInfo { - /// startLess - Return true if x is not in [a;b). static inline bool startLess(const T &x, const T &a) { return x < a; @@ -180,20 +180,14 @@ static inline bool nonEmpty(const T &a, const T &b) { return a < b; } - }; /// IntervalMapImpl - Namespace used for IntervalMap implementation details. /// It should be considered private to the implementation. namespace IntervalMapImpl { -// Forward declarations. -template class LeafNode; -template class BranchNode; - typedef std::pair IdxPair; - //===----------------------------------------------------------------------===// //--- IntervalMapImpl::NodeBase ---// //===----------------------------------------------------------------------===// @@ -417,7 +411,6 @@ const unsigned *CurSize, unsigned NewSize[], unsigned Position, bool Grow); - //===----------------------------------------------------------------------===// //--- IntervalMapImpl::NodeSizer ---// //===----------------------------------------------------------------------===// @@ -470,10 +463,8 @@ /// different kinds of maps. typedef RecyclingAllocator Allocator; - }; - //===----------------------------------------------------------------------===// //--- IntervalMapImpl::NodeRef ---// //===----------------------------------------------------------------------===// @@ -505,7 +496,7 @@ public: /// NodeRef - Create a null ref. - NodeRef() {} + NodeRef() = default; /// operator bool - Detect a null ref. explicit operator bool() const { return pip.getOpaqueValue(); } @@ -685,7 +676,6 @@ return Size + 1; } - //===----------------------------------------------------------------------===// //--- IntervalMapImpl::BranchNode ---// //===----------------------------------------------------------------------===// @@ -930,8 +920,7 @@ } }; -} // namespace IntervalMapImpl - +} // end namespace IntervalMapImpl //===----------------------------------------------------------------------===// //--- IntervalMap ----// @@ -939,7 +928,7 @@ template ::LeafSize, - typename Traits = IntervalMapInfo > + typename Traits = IntervalMapInfo> class IntervalMap { typedef IntervalMapImpl::NodeSizer Sizer; typedef IntervalMapImpl::LeafNode Leaf; @@ -1006,6 +995,7 @@ assert(!branched() && "Cannot acces leaf data in branched root"); return dataAs(); } + RootBranchData &rootBranchData() const { assert(branched() && "Cannot access branch data in non-branched root"); return dataAs(); @@ -1014,6 +1004,7 @@ assert(branched() && "Cannot access branch data in non-branched root"); return dataAs(); } + const RootBranch &rootBranch() const { return rootBranchData().node; } RootBranch &rootBranch() { return rootBranchData().node; } KeyT rootBranchStart() const { return rootBranchData().start; } @@ -1160,7 +1151,6 @@ return NR.get().safeLookup(x, NotFound); } - // branchRoot - Switch from a leaf root to a branched root. // Return the new (root offset, node offset) corresponding to Position. template @@ -1295,6 +1285,7 @@ template class IntervalMap::const_iterator : public std::iterator { + protected: friend class IntervalMap; @@ -1447,7 +1438,6 @@ path.leafOffset() = map->rootLeaf().findFrom(path.leafOffset(), map->rootSize, x); } - }; /// pathFillFind - Complete path by searching for x. @@ -1534,7 +1524,7 @@ public: /// iterator - Create null iterator. - iterator() {} + iterator() = default; /// setStart - Move the start of the current interval. /// This may cause coalescing with the previous interval. @@ -1600,7 +1590,6 @@ operator--(); return tmp; } - }; /// canCoalesceLeft - Can the current interval coalesce to the left after @@ -1801,7 +1790,6 @@ treeInsert(a, b, y); } - template void IntervalMap:: iterator::treeInsert(KeyT a, KeyT b, ValT y) { @@ -2162,6 +2150,6 @@ } }; -} // namespace llvm +} // end namespace llvm -#endif +#endif // LLVM_ADT_INTERVALMAP_H Index: llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h =================================================================== --- llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h +++ llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h @@ -27,9 +27,6 @@ namespace llvm { - template - class IntrusiveRefCntPtr; - //===----------------------------------------------------------------------===// /// RefCountedBase - A generic base class for objects that wish to /// have their lifetimes managed using reference counts. Classes @@ -42,10 +39,10 @@ //===----------------------------------------------------------------------===// template class RefCountedBase { - mutable unsigned ref_cnt; + mutable unsigned ref_cnt = 0; public: - RefCountedBase() : ref_cnt(0) {} + RefCountedBase() = default; RefCountedBase(const RefCountedBase &) : ref_cnt(0) {} void Retain() const { ++ref_cnt; } @@ -64,14 +61,15 @@ /// attempting to do this will produce a compile error. //===----------------------------------------------------------------------===// class RefCountedBaseVPTR { - mutable unsigned ref_cnt; + mutable unsigned ref_cnt = 0; + virtual void anchor(); protected: - RefCountedBaseVPTR() : ref_cnt(0) {} + RefCountedBaseVPTR() = default; RefCountedBaseVPTR(const RefCountedBaseVPTR &) : ref_cnt(0) {} - virtual ~RefCountedBaseVPTR() {} + virtual ~RefCountedBaseVPTR() = default; void Retain() const { ++ref_cnt; } void Release() const { @@ -133,12 +131,12 @@ //===----------------------------------------------------------------------===// template class IntrusiveRefCntPtr { - T* Obj; + T* Obj = nullptr; public: typedef T element_type; - explicit IntrusiveRefCntPtr() : Obj(nullptr) {} + explicit IntrusiveRefCntPtr() = default; IntrusiveRefCntPtr(T* obj) : Obj(obj) { retain(); @@ -269,14 +267,14 @@ template struct simplify_type; - template struct simplify_type > { + template struct simplify_type> { typedef T* SimpleType; static SimpleType getSimplifiedValue(IntrusiveRefCntPtr& Val) { return Val.get(); } }; - template struct simplify_type > { + template struct simplify_type> { typedef /*const*/ T* SimpleType; static SimpleType getSimplifiedValue(const IntrusiveRefCntPtr& Val) { return Val.get(); Index: llvm/trunk/include/llvm/ADT/PointerUnion.h =================================================================== --- llvm/trunk/include/llvm/ADT/PointerUnion.h +++ llvm/trunk/include/llvm/ADT/PointerUnion.h @@ -17,7 +17,10 @@ #include "llvm/ADT/DenseMapInfo.h" #include "llvm/ADT/PointerIntPair.h" -#include "llvm/Support/Compiler.h" +#include "llvm/Support/PointerLikeTypeTraits.h" +#include +#include +#include namespace llvm { @@ -57,6 +60,7 @@ public: static inline void *getAsVoidPointer(void *P) { return P; } static inline void *getFromVoidPointer(void *P) { return P; } + enum { PT1BitsAv = (int)(PointerLikeTypeTraits::NumLowBitsAvailable), PT2BitsAv = (int)(PointerLikeTypeTraits::NumLowBitsAvailable), @@ -97,7 +101,7 @@ template struct UNION_DOESNT_CONTAIN_TYPE {}; public: - PointerUnion() {} + PointerUnion() = default; PointerUnion(PT1 V) : Val(const_cast( @@ -208,6 +212,7 @@ static inline void *getAsVoidPointer(const PointerUnion &P) { return P.getOpaqueValue(); } + static inline PointerUnion getFromVoidPointer(void *P) { return PointerUnion::getFromOpaqueValue(P); } @@ -249,7 +254,7 @@ }; public: - PointerUnion3() {} + PointerUnion3() = default; PointerUnion3(PT1 V) { Val = InnerUnion(V); } PointerUnion3(PT2 V) { Val = InnerUnion(V); } @@ -328,6 +333,7 @@ static inline void *getAsVoidPointer(const PointerUnion3 &P) { return P.getOpaqueValue(); } + static inline PointerUnion3 getFromVoidPointer(void *P) { return PointerUnion3::getFromOpaqueValue(P); } @@ -352,7 +358,7 @@ ValTy Val; public: - PointerUnion4() {} + PointerUnion4() = default; PointerUnion4(PT1 V) { Val = InnerUnion1(V); } PointerUnion4(PT2 V) { Val = InnerUnion1(V); } @@ -435,6 +441,7 @@ getAsVoidPointer(const PointerUnion4 &P) { return P.getOpaqueValue(); } + static inline PointerUnion4 getFromVoidPointer(void *P) { return PointerUnion4::getFromOpaqueValue(P); } @@ -469,6 +476,6 @@ } }; -} +} // end namespace llvm -#endif +#endif // LLVM_ADT_POINTERUNION_H Index: llvm/trunk/include/llvm/ADT/SmallString.h =================================================================== --- llvm/trunk/include/llvm/ADT/SmallString.h +++ llvm/trunk/include/llvm/ADT/SmallString.h @@ -16,6 +16,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" +#include namespace llvm { @@ -25,7 +26,7 @@ class SmallString : public SmallVector { public: /// Default ctor - Initialize to empty. - SmallString() {} + SmallString() = default; /// Initialize from a StringRef. SmallString(StringRef S) : SmallVector(S.begin(), S.end()) {} @@ -79,7 +80,6 @@ SmallVectorImpl::append(NumInputs, Elt); } - /// Append from a StringRef. void append(StringRef RHS) { SmallVectorImpl::append(RHS.begin(), RHS.end()); @@ -292,6 +292,6 @@ } }; -} +} // end namespace llvm -#endif +#endif // LLVM_ADT_SMALLSTRING_H Index: llvm/trunk/include/llvm/ADT/StringMap.h =================================================================== --- llvm/trunk/include/llvm/ADT/StringMap.h +++ llvm/trunk/include/llvm/ADT/StringMap.h @@ -17,10 +17,17 @@ #include "llvm/ADT/StringRef.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/PointerLikeTypeTraits.h" +#include +#include +#include #include #include +#include +#include +#include namespace llvm { + template class StringMapConstIterator; template @@ -119,8 +126,6 @@ /// and data. template class StringMapEntry : public StringMapEntryBase { - StringMapEntry(StringMapEntry &E) = delete; - public: ValueTy second; @@ -129,6 +134,7 @@ template StringMapEntry(unsigned strLen, InitTy &&... InitVals) : StringMapEntryBase(strLen), second(std::forward(InitVals)...) {} + StringMapEntry(StringMapEntry &E) = delete; StringRef getKey() const { return StringRef(getKeyData(), getKeyLength()); @@ -440,12 +446,12 @@ template class StringMapConstIterator { protected: - StringMapEntryBase **Ptr; + StringMapEntryBase **Ptr = nullptr; public: typedef StringMapEntry value_type; - StringMapConstIterator() : Ptr(nullptr) { } + StringMapConstIterator() = default; explicit StringMapConstIterator(StringMapEntryBase **Bucket, bool NoAdvance = false) @@ -486,11 +492,13 @@ template class StringMapIterator : public StringMapConstIterator { public: - StringMapIterator() {} + StringMapIterator() = default; + explicit StringMapIterator(StringMapEntryBase **Bucket, bool NoAdvance = false) : StringMapConstIterator(Bucket, NoAdvance) { } + StringMapEntry &operator*() const { return *static_cast*>(*this->Ptr); } @@ -498,6 +506,7 @@ return static_cast*>(*this->Ptr); } }; -} -#endif +} // end namespace llvm + +#endif // LLVM_ADT_STRINGMAP_H Index: llvm/trunk/include/llvm/ADT/iterator.h =================================================================== --- llvm/trunk/include/llvm/ADT/iterator.h +++ llvm/trunk/include/llvm/ADT/iterator.h @@ -12,6 +12,7 @@ #include #include +#include namespace llvm { @@ -264,7 +265,7 @@ mutable T Ptr; public: - pointer_iterator() {} + pointer_iterator() = default; explicit pointer_iterator(WrappedIteratorT u) : pointer_iterator::iterator_adaptor_base(std::move(u)) {} @@ -273,6 +274,6 @@ const T &operator*() const { return Ptr = &*this->I; } }; -} // namespace llvm +} // end namespace llvm -#endif +#endif // LLVM_ADT_ITERATOR_H