llvm.org GIT mirror llvm / 904bc55
[ADT] Fix some Clang-tidy modernize-use-default and Include What You Use warnings; other minor fixes. Differential revision: https://reviews.llvm.org/D27001 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287725 91177308-0d34-0410-b5e6-96231b3b80d8 Eugene Zelenko 3 years ago
11 changed file(s) with 140 addition(s) and 110 deletion(s). Raw diff Collapse all Expand all
99 #define LLVM_ADT_DAGDELTAALGORITHM_H
1010
1111 #include
12 #include
1213 #include
1314
1415 namespace llvm {
3637 /// should satisfy.
3738 class DAGDeltaAlgorithm {
3839 virtual void anchor();
40
3941 public:
4042 typedef unsigned change_ty;
4143 typedef std::pair edge_ty;
4547 typedef std::vector changesetlist_ty;
4648
4749 public:
48 virtual ~DAGDeltaAlgorithm() {}
50 virtual ~DAGDeltaAlgorithm() = default;
4951
5052 /// Run - Minimize the DAG formed by the \p Changes vertices and the
5153 /// \p Dependencies edges by executing \see ExecuteOneTest() on subsets of
7375
7476 } // end namespace llvm
7577
76 #endif
78 #endif // LLVM_ADT_DAGDELTAALGORITHM_H
3333 #define LLVM_ADT_DEPTHFIRSTITERATOR_H
3434
3535 #include "llvm/ADT/GraphTraits.h"
36 #include "llvm/ADT/None.h"
3637 #include "llvm/ADT/Optional.h"
3738 #include "llvm/ADT/SmallPtrSet.h"
3839 #include "llvm/ADT/iterator_range.h"
40 #include
3941 #include
42 #include
4043 #include
4144
4245 namespace llvm {
5457 public:
5558 df_iterator_storage(SetType &VSet) : Visited(VSet) {}
5659 df_iterator_storage(const df_iterator_storage &S) : Visited(S.Visited) {}
60
5761 SetType &Visited;
5862 };
5963
6266 // node have been processed. It is intended to distinguish of back and
6367 // cross edges in the spanning tree but is not used in the common case.
6468 template
65 struct df_iterator_default_set : public llvm::SmallPtrSet {
66 typedef llvm::SmallPtrSet BaseSet;
69 struct df_iterator_default_set : public SmallPtrSet {
70 typedef SmallPtrSet BaseSet;
6771 typedef typename BaseSet::iterator iterator;
6872 std::pair insert(NodeRef N) { return BaseSet::insert(N) ; }
6973 template
98102 this->Visited.insert(Node);
99103 VisitStack.push_back(StackElement(Node, None));
100104 }
101 inline df_iterator() {
102 // End is when stack is empty
103 }
105 inline df_iterator() = default; // End is when stack is empty
104106 inline df_iterator(NodeRef Node, SetType &S)
105107 : df_iterator_storage(S) {
106108 if (this->Visited.insert(Node).second)
297299 return make_range(idf_ext_begin(G, S), idf_ext_end(G, S));
298300 }
299301
300 } // End llvm namespace
301
302 #endif
302 } // end namespace llvm
303
304 #endif // LLVM_ADT_DEPTHFIRSTITERATOR_H
1414 #ifndef LLVM_ADT_EQUIVALENCECLASSES_H
1515 #define LLVM_ADT_EQUIVALENCECLASSES_H
1616
17 #include "llvm/Support/DataTypes.h"
1817 #include
1918 #include
19 #include
20 #include
2021 #include
2122
2223 namespace llvm {
6970 friend class EquivalenceClasses;
7071 mutable const ECValue *Leader, *Next;
7172 ElemTy Data;
73
7274 // ECValue ctor - Start out with EndOfList pointing to this node, Next is
7375 // Null, isLeader = true.
7476 ECValue(const ElemTy &Elt)
8082 // Path compression.
8183 return Leader = Leader->getLeader();
8284 }
85
8386 const ECValue *getEndOfList() const {
8487 assert(isLeader() && "Cannot get the end of a list for a non-leader!");
8588 return Leader;
8992 assert(getNext() == nullptr && "Already has a next pointer!");
9093 Next = (const ECValue*)((intptr_t)NewNext | (intptr_t)isLeader());
9194 }
95
9296 public:
9397 ECValue(const ECValue &RHS) : Leader(this), Next((ECValue*)(intptr_t)1),
9498 Data(RHS.Data) {
114118 std::set TheMapping;
115119
116120 public:
117 EquivalenceClasses() {}
121 EquivalenceClasses() = default;
118122 EquivalenceClasses(const EquivalenceClasses &RHS) {
119123 operator=(RHS);
120124 }
186190 return NC;
187191 }
188192
189
190193 //===--------------------------------------------------------------------===//
191194 // Mutation methods
192195
209212 return findLeader(TheMapping.find(V));
210213 }
211214
212
213215 /// union - Merge the two equivalence sets for the specified values, inserting
214216 /// them if they do not already exist in the equivalence set.
215217 member_iterator unionSets(const ElemTy &V1, const ElemTy &V2) {
242244 const ElemTy, ptrdiff_t> super;
243245 const ECValue *Node;
244246 friend class EquivalenceClasses;
247
245248 public:
246249 typedef size_t size_type;
247250 typedef typename super::pointer pointer;
248251 typedef typename super::reference reference;
249252
250 explicit member_iterator() {}
253 explicit member_iterator() = default;
251254 explicit member_iterator(const ECValue *N) : Node(N) {}
252255
253256 reference operator*() const {
277280 };
278281 };
279282
280 } // End llvm namespace
281
282 #endif
283 } // end namespace llvm
284
285 #endif // LLVM_ADT_EQUIVALENCECLASSES_H
1818 #include "llvm/ADT/SmallVector.h"
1919 #include "llvm/ADT/iterator.h"
2020 #include "llvm/Support/Allocator.h"
21 #include
22 #include
23 #include
24 #include
2125
2226 namespace llvm {
27
2328 /// This folding set used for two purposes:
2429 /// 1. Given information about a node we want to create, look up the unique
2530 /// instance of the node in the set. If the node already exists, return
183188 /// EltCount-th node won't cause a rebucket operation. reserve is permitted
184189 /// to allocate more space than requested by EltCount.
185190 void reserve(unsigned EltCount);
191
186192 /// capacity - Returns the number of nodes permitted in the folding set
187193 /// before a rebucket operation is performed.
188194 unsigned capacity() {
199205 /// NewBucketCount must be a power of two, and must be greater than the old
200206 /// bucket count.
201207 void GrowBucketCount(unsigned NewBucketCount);
208
202209 protected:
203210 /// GetNodeProfile - Instantiations of the FoldingSet template implement
204211 /// this function to gather data bits for the given node.
205212 virtual void GetNodeProfile(Node *N, FoldingSetNodeID &ID) const = 0;
213
206214 /// NodeEquals - Instantiations of the FoldingSet template implement
207215 /// this function to compare the given node with the given ID.
208216 virtual bool NodeEquals(Node *N, const FoldingSetNodeID &ID, unsigned IDHash,
209217 FoldingSetNodeID &TempID) const=0;
218
210219 /// ComputeNodeHash - Instantiations of the FoldingSet template implement
211220 /// this function to compute a hash value for the given node.
212221 virtual unsigned ComputeNodeHash(Node *N, FoldingSetNodeID &TempID) const = 0;
213222 };
214223
215224 //===----------------------------------------------------------------------===//
216
217 template struct FoldingSetTrait;
218225
219226 /// DefaultFoldingSetTrait - This class provides default implementations
220227 /// for FoldingSetTrait implementations.
251258 template struct FoldingSetTrait
252259 : public DefaultFoldingSetTrait {};
253260
254 template struct ContextualFoldingSetTrait;
255
256261 /// DefaultContextualFoldingSetTrait - Like DefaultFoldingSetTrait, but
257262 /// for ContextualFoldingSets.
258263 template
260265 static void Profile(T &X, FoldingSetNodeID &ID, Ctx Context) {
261266 X.Profile(ID, Context);
262267 }
268
263269 static inline bool Equals(T &X, const FoldingSetNodeID &ID, unsigned IDHash,
264270 FoldingSetNodeID &TempID, Ctx Context);
265271 static inline unsigned ComputeHash(T &X, FoldingSetNodeID &TempID,
278284 /// is often much larger than necessary, and the possibility of heap
279285 /// allocation means it requires a non-trivial destructor call.
280286 class FoldingSetNodeIDRef {
281 const unsigned *Data;
282 size_t Size;
283
284 public:
285 FoldingSetNodeIDRef() : Data(nullptr), Size(0) {}
287 const unsigned *Data = nullptr;
288 size_t Size = 0;
289
290 public:
291 FoldingSetNodeIDRef() = default;
286292 FoldingSetNodeIDRef(const unsigned *D, size_t S) : Data(D), Size(S) {}
287293
288294 /// ComputeHash - Compute a strong hash value for this FoldingSetNodeIDRef,
312318 SmallVector Bits;
313319
314320 public:
315 FoldingSetNodeID() {}
321 FoldingSetNodeID() = default;
316322
317323 FoldingSetNodeID(FoldingSetNodeIDRef Ref)
318324 : Bits(Ref.getData(), Ref.getData() + Ref.getSize()) {}
417423 T *TN = static_cast(N);
418424 FoldingSetTrait::Profile(*TN, ID);
419425 }
426
420427 /// NodeEquals - Instantiations may optionally provide a way to compare a
421428 /// node with a specified ID.
422429 bool NodeEquals(Node *N, const FoldingSetNodeID &ID, unsigned IDHash,
424431 T *TN = static_cast(N);
425432 return FoldingSetTrait::Equals(*TN, ID, IDHash, TempID);
426433 }
434
427435 /// ComputeNodeHash - Instantiations may optionally provide a way to compute a
428436 /// hash value directly from a node.
429437 unsigned ComputeNodeHash(Node *N, FoldingSetNodeID &TempID) const override {
482490 ///
483491 /// T must be a subclass of FoldingSetNode and implement a Profile
484492 /// function with signature
485 /// void Profile(llvm::FoldingSetNodeID &, Ctx);
493 /// void Profile(FoldingSetNodeID &, Ctx);
486494 template
487495 class ContextualFoldingSet final : public FoldingSetImpl {
488496 // Unfortunately, this can't derive from FoldingSet because the
500508 T *TN = static_cast(N);
501509 ContextualFoldingSetTrait::Profile(*TN, ID, Context);
502510 }
511
503512 bool NodeEquals(FoldingSetImpl::Node *N, const FoldingSetNodeID &ID,
504513 unsigned IDHash, FoldingSetNodeID &TempID) const override {
505514 T *TN = static_cast(N);
506515 return ContextualFoldingSetTrait::Equals(*TN, ID, IDHash, TempID,
507516 Context);
508517 }
518
509519 unsigned ComputeNodeHash(FoldingSetImpl::Node *N,
510520 FoldingSetNodeID &TempID) const override {
511521 T *TN = static_cast(N);
557567 /// to provide the interface of FoldingSet but with deterministic iteration
558568 /// order based on the insertion order. T must be a subclass of FoldingSetNode
559569 /// and implement a Profile function.
560 template >
570 template >
561571 class FoldingSetVector {
562572 FoldingSet Set;
563573 VectorT Vector;
622632 class FoldingSetIteratorImpl {
623633 protected:
624634 FoldingSetNode *NodePtr;
635
625636 FoldingSetIteratorImpl(void **Bucket);
637
626638 void advance();
627639
628640 public:
753765 template
754766 struct FoldingSetTrait> {
755767 static inline void Profile(const std::pair &P,
756 llvm::FoldingSetNodeID &ID) {
768 FoldingSetNodeID &ID) {
757769 ID.Add(P.first);
758770 ID.Add(P.second);
759771 }
760772 };
761 } // End of namespace llvm.
762
763 #endif
773
774 } // end namespace llvm
775
776 #endif // LLVM_ADT_FOLDINGSET_H
1515
1616 #include "llvm/ADT/DenseMap.h"
1717 #include "llvm/ADT/FoldingSet.h"
18 #include "llvm/ADT/iterator.h"
19 #include "llvm/ADT/SmallVector.h"
1820 #include "llvm/Support/Allocator.h"
19 #include "llvm/Support/DataTypes.h"
2021 #include "llvm/Support/ErrorHandling.h"
2122 #include
2223 #include
2324 #include
25 #include
26 #include
27 #include
2428
2529 namespace llvm {
2630
328332
329333 public:
330334 void retain() { ++refCount; }
335
331336 void release() {
332337 assert(refCount > 0);
333338 if (--refCount == 0)
334339 destroy();
335340 }
341
336342 void destroy() {
337343 if (left)
338344 left->release();
374380 std::vector freeNodes;
375381
376382 bool ownsAllocator() const {
377 return Allocator & 0x1 ? false : true;
383 return (Allocator & 0x1) == 0;
378384 }
379385
380386 BumpPtrAllocator& getAllocator() const {
413419 TreeTy* getEmptyTree() const { return nullptr; }
414420
415421 protected:
416
417422 //===--------------------------------------------------===//
418423 // A bunch of quick helper functions used for reasoning
419424 // about the properties of trees and their children.
648653 : public std::iterator
649654 ImutAVLTree> {
650655 SmallVector stack;
656
651657 public:
652658 enum VisitFlag { VisitedNone=0x0, VisitedLeft=0x1, VisitedRight=0x3,
653659 Flags=0x3 };
654660
655661 typedef ImutAVLTree TreeTy;
656662
657 ImutAVLTreeGenericIterator() {}
663 ImutAVLTreeGenericIterator() = default;
658664 ImutAVLTreeGenericIterator(const TreeTy *Root) {
659665 if (Root) stack.push_back(reinterpret_cast(Root));
660666 }
669675 assert(!stack.empty());
670676 return stack.back() & Flags;
671677 }
672
673678
674679 bool atEnd() const { return stack.empty(); }
675680
880885 }
881886 };
882887
883
884888 /// Generic profile trait for pointer types. We treat pointers as
885889 /// references to unique objects.
886890 template
899903 // inherit from the profile traits (ImutProfileInfo) to include operations
900904 // for element profiling.
901905 //===----------------------------------------------------------------------===//
902
903906
904907 /// ImutContainerInfo - Generic definition of comparison operations for
905908 /// elements of immutable containers that defaults to using
953956 // Immutable Set
954957 //===----------------------------------------------------------------------===//
955958
956 template >
959 template >
957960 class ImmutableSet {
958961 public:
959962 typedef typename ValInfo::value_type value_type;
971974 explicit ImmutableSet(TreeTy* R) : Root(R) {
972975 if (Root) { Root->retain(); }
973976 }
977
974978 ImmutableSet(const ImmutableSet &X) : Root(X.Root) {
975979 if (Root) { Root->retain(); }
976980 }
981
977982 ImmutableSet &operator=(const ImmutableSet &X) {
978983 if (Root != X.Root) {
979984 if (X.Root) { X.Root->retain(); }
982987 }
983988 return *this;
984989 }
990
985991 ~ImmutableSet() {
986992 if (Root) { Root->release(); }
987993 }
9961002
9971003 Factory(BumpPtrAllocator& Alloc, bool canonicalize = true)
9981004 : F(Alloc), Canonicalize(canonicalize) {}
1005
1006 Factory(const Factory& RHS) = delete;
1007 void operator=(const Factory& RHS) = delete;
9991008
10001009 /// getEmptySet - Returns an immutable set that contains no elements.
10011010 ImmutableSet getEmptySet() {
10311040 typename TreeTy::Factory *getTreeFactory() const {
10321041 return const_cast(&F);
10331042 }
1034
1035 private:
1036 Factory(const Factory& RHS) = delete;
1037 void operator=(const Factory& RHS) = delete;
10381043 };
10391044
10401045 friend class Factory;
11031108 };
11041109
11051110 // NOTE: This may some day replace the current ImmutableSet.
1106 template >
1111 template >
11071112 class ImmutableSetRef {
11081113 public:
11091114 typedef typename ValInfo::value_type value_type;
11251130 Factory(F) {
11261131 if (Root) { Root->retain(); }
11271132 }
1133
11281134 ImmutableSetRef(const ImmutableSetRef &X)
11291135 : Root(X.Root),
11301136 Factory(X.Factory) {
11311137 if (Root) { Root->retain(); }
11321138 }
1139
11331140 ImmutableSetRef &operator=(const ImmutableSetRef &X) {
11341141 if (Root != X.Root) {
11351142 if (X.Root) { X.Root->retain(); }
12141221
12151222 } // end namespace llvm
12161223
1217 #endif
1224 #endif // LLVM_ADT_IMMUTABLESET_H
103103 #include "llvm/Support/AlignOf.h"
104104 #include "llvm/Support/Allocator.h"
105105 #include "llvm/Support/RecyclingAllocator.h"
106 #include
107 #include
106108 #include
109 #include
110 #include
107111
108112 namespace llvm {
109
110113
111114 //===----------------------------------------------------------------------===//
112115 //--- Key traits ---//
130133
131134 template
132135 struct IntervalMapInfo {
133
134136 /// startLess - Return true if x is not in [a;b].
135137 /// This is x < a both for closed intervals and for [a;b) half-open intervals.
136138 static inline bool startLess(const T &x, const T &a) {
154156 static inline bool nonEmpty(const T &a, const T &b) {
155157 return a <= b;
156158 }
157
158159 };
159160
160161 template
161162 struct IntervalMapHalfOpenInfo {
162
163163 /// startLess - Return true if x is not in [a;b).
164164 static inline bool startLess(const T &x, const T &a) {
165165 return x < a;
179179 static inline bool nonEmpty(const T &a, const T &b) {
180180 return a < b;
181181 }
182
183182 };
184183
185184 /// IntervalMapImpl - Namespace used for IntervalMap implementation details.
186185 /// It should be considered private to the implementation.
187186 namespace IntervalMapImpl {
188187
189 // Forward declarations.
190 template class LeafNode;
191 template class BranchNode;
192
193188 typedef std::pair IdxPair;
194
195189
196190 //===----------------------------------------------------------------------===//
197191 //--- IntervalMapImpl::NodeBase ---//
416410 const unsigned *CurSize, unsigned NewSize[],
417411 unsigned Position, bool Grow);
418412
419
420413 //===----------------------------------------------------------------------===//
421414 //--- IntervalMapImpl::NodeSizer ---//
422415 //===----------------------------------------------------------------------===//
469462 /// different kinds of maps.
470463 typedef RecyclingAllocator
471464 AllocBytes, CacheLineBytes> Allocator;
472
473465 };
474
475466
476467 //===----------------------------------------------------------------------===//
477468 //--- IntervalMapImpl::NodeRef ---//
504495
505496 public:
506497 /// NodeRef - Create a null ref.
507 NodeRef() {}
498 NodeRef() = default;
508499
509500 /// operator bool - Detect a null ref.
510501 explicit operator bool() const { return pip.getOpaqueValue(); }
684675 return Size + 1;
685676 }
686677
687
688678 //===----------------------------------------------------------------------===//
689679 //--- IntervalMapImpl::BranchNode ---//
690680 //===----------------------------------------------------------------------===//
929919 }
930920 };
931921
932 } // namespace IntervalMapImpl
933
922 } // end namespace IntervalMapImpl
934923
935924 //===----------------------------------------------------------------------===//
936925 //--- IntervalMap ----//
938927
939928 template
940929 unsigned N = IntervalMapImpl::NodeSizer::LeafSize,
941 typename Traits = IntervalMapInfo >
930 typename Traits = IntervalMapInfo>
942931 class IntervalMap {
943932 typedef IntervalMapImpl::NodeSizer Sizer;
944933 typedef IntervalMapImpl::LeafNode Leaf;
1005994 assert(!branched() && "Cannot acces leaf data in branched root");
1006995 return dataAs();
1007996 }
997
1008998 RootBranchData &rootBranchData() const {
1009999 assert(branched() && "Cannot access branch data in non-branched root");
10101000 return dataAs();
10131003 assert(branched() && "Cannot access branch data in non-branched root");
10141004 return dataAs();
10151005 }
1006
10161007 const RootBranch &rootBranch() const { return rootBranchData().node; }
10171008 RootBranch &rootBranch() { return rootBranchData().node; }
10181009 KeyT rootBranchStart() const { return rootBranchData().start; }
11581149 NR = NR.get().safeLookup(x);
11591150 return NR.get().safeLookup(x, NotFound);
11601151 }
1161
11621152
11631153 // branchRoot - Switch from a leaf root to a branched root.
11641154 // Return the new (root offset, node offset) corresponding to Position.
12941284 template
12951285 class IntervalMap::const_iterator :
12961286 public std::iterator {
1287
12971288 protected:
12981289 friend class IntervalMap;
12991290
14461437 path.leafOffset() =
14471438 map->rootLeaf().findFrom(path.leafOffset(), map->rootSize, x);
14481439 }
1449
14501440 };
14511441
14521442 /// pathFillFind - Complete path by searching for x.
15331523
15341524 public:
15351525 /// iterator - Create null iterator.
1536 iterator() {}
1526 iterator() = default;
15371527
15381528 /// setStart - Move the start of the current interval.
15391529 /// This may cause coalescing with the previous interval.
15991589 operator--();
16001590 return tmp;
16011591 }
1602
16031592 };
16041593
16051594 /// canCoalesceLeft - Can the current interval coalesce to the left after
17991788 // Now it fits in the new leaf.
18001789 treeInsert(a, b, y);
18011790 }
1802
18031791
18041792 template
18051793 void IntervalMap::
21612149 }
21622150 };
21632151
2164 } // namespace llvm
2165
2166 #endif
2152 } // end namespace llvm
2153
2154 #endif // LLVM_ADT_INTERVALMAP_H
2525 #include
2626
2727 namespace llvm {
28
29 template
30 class IntrusiveRefCntPtr;
3128
3229 //===----------------------------------------------------------------------===//
3330 /// RefCountedBase - A generic base class for objects that wish to
4138 //===----------------------------------------------------------------------===//
4239 template
4340 class RefCountedBase {
44 mutable unsigned ref_cnt;
41 mutable unsigned ref_cnt = 0;
4542
4643 public:
47 RefCountedBase() : ref_cnt(0) {}
44 RefCountedBase() = default;
4845 RefCountedBase(const RefCountedBase &) : ref_cnt(0) {}
4946
5047 void Retain() const { ++ref_cnt; }
6360 /// attempting to do this will produce a compile error.
6461 //===----------------------------------------------------------------------===//
6562 class RefCountedBaseVPTR {
66 mutable unsigned ref_cnt;
63 mutable unsigned ref_cnt = 0;
64
6765 virtual void anchor();
6866
6967 protected:
70 RefCountedBaseVPTR() : ref_cnt(0) {}
68 RefCountedBaseVPTR() = default;
7169 RefCountedBaseVPTR(const RefCountedBaseVPTR &) : ref_cnt(0) {}
7270
73 virtual ~RefCountedBaseVPTR() {}
71 virtual ~RefCountedBaseVPTR() = default;
7472
7573 void Retain() const { ++ref_cnt; }
7674 void Release() const {
132130 //===----------------------------------------------------------------------===//
133131 template
134132 class IntrusiveRefCntPtr {
135 T* Obj;
133 T* Obj = nullptr;
136134
137135 public:
138136 typedef T element_type;
139137
140 explicit IntrusiveRefCntPtr() : Obj(nullptr) {}
138 explicit IntrusiveRefCntPtr() = default;
141139
142140 IntrusiveRefCntPtr(T* obj) : Obj(obj) {
143141 retain();
268266
269267 template struct simplify_type;
270268
271 template struct simplify_type > {
269 template struct simplify_type> {
272270 typedef T* SimpleType;
273271 static SimpleType getSimplifiedValue(IntrusiveRefCntPtr& Val) {
274272 return Val.get();
275273 }
276274 };
277275
278 template struct simplify_type > {
276 template struct simplify_type> {
279277 typedef /*const*/ T* SimpleType;
280278 static SimpleType getSimplifiedValue(const IntrusiveRefCntPtr& Val) {
281279 return Val.get();
1616
1717 #include "llvm/ADT/DenseMapInfo.h"
1818 #include "llvm/ADT/PointerIntPair.h"
19 #include "llvm/Support/Compiler.h"
19 #include "llvm/Support/PointerLikeTypeTraits.h"
20 #include
21 #include
22 #include
2023
2124 namespace llvm {
2225
5659 public:
5760 static inline void *getAsVoidPointer(void *P) { return P; }
5861 static inline void *getFromVoidPointer(void *P) { return P; }
62
5963 enum {
6064 PT1BitsAv = (int)(PointerLikeTypeTraits::NumLowBitsAvailable),
6165 PT2BitsAv = (int)(PointerLikeTypeTraits::NumLowBitsAvailable),
96100 template struct UNION_DOESNT_CONTAIN_TYPE {};
97101
98102 public:
99 PointerUnion() {}
103 PointerUnion() = default;
100104
101105 PointerUnion(PT1 V)
102106 : Val(const_cast(
207211 static inline void *getAsVoidPointer(const PointerUnion &P) {
208212 return P.getOpaqueValue();
209213 }
214
210215 static inline PointerUnion getFromVoidPointer(void *P) {
211216 return PointerUnion::getFromOpaqueValue(P);
212217 }
248253 };
249254
250255 public:
251 PointerUnion3() {}
256 PointerUnion3() = default;
252257
253258 PointerUnion3(PT1 V) { Val = InnerUnion(V); }
254259 PointerUnion3(PT2 V) { Val = InnerUnion(V); }
327332 static inline void *getAsVoidPointer(const PointerUnion3 &P) {
328333 return P.getOpaqueValue();
329334 }
335
330336 static inline PointerUnion3 getFromVoidPointer(void *P) {
331337 return PointerUnion3::getFromOpaqueValue(P);
332338 }
351357 ValTy Val;
352358
353359 public:
354 PointerUnion4() {}
360 PointerUnion4() = default;
355361
356362 PointerUnion4(PT1 V) { Val = InnerUnion1(V); }
357363 PointerUnion4(PT2 V) { Val = InnerUnion1(V); }
434440 getAsVoidPointer(const PointerUnion4 &P) {
435441 return P.getOpaqueValue();
436442 }
443
437444 static inline PointerUnion4 getFromVoidPointer(void *P) {
438445 return PointerUnion4::getFromOpaqueValue(P);
439446 }
468475 }
469476 };
470477
471 }
472
473 #endif
478 } // end namespace llvm
479
480 #endif // LLVM_ADT_POINTERUNION_H
1515
1616 #include "llvm/ADT/SmallVector.h"
1717 #include "llvm/ADT/StringRef.h"
18 #include
1819
1920 namespace llvm {
2021
2425 class SmallString : public SmallVector {
2526 public:
2627 /// Default ctor - Initialize to empty.
27 SmallString() {}
28 SmallString() = default;
2829
2930 /// Initialize from a StringRef.
3031 SmallString(StringRef S) : SmallVector(S.begin(), S.end()) {}
7778 void append(size_t NumInputs, char Elt) {
7879 SmallVectorImpl::append(NumInputs, Elt);
7980 }
80
8181
8282 /// Append from a StringRef.
8383 void append(StringRef RHS) {
291291 }
292292 };
293293
294 }
295
296 #endif
294 } // end namespace llvm
295
296 #endif // LLVM_ADT_SMALLSTRING_H
1616 #include "llvm/ADT/StringRef.h"
1717 #include "llvm/Support/Allocator.h"
1818 #include "llvm/Support/PointerLikeTypeTraits.h"
19 #include
20 #include
21 #include
1922 #include
2023 #include
24 #include
25 #include
26 #include
2127
2228 namespace llvm {
29
2330 template
2431 class StringMapConstIterator;
2532 template
118125 /// and data.
119126 template
120127 class StringMapEntry : public StringMapEntryBase {
121 StringMapEntry(StringMapEntry &E) = delete;
122
123128 public:
124129 ValueTy second;
125130
128133 template
129134 StringMapEntry(unsigned strLen, InitTy &&... InitVals)
130135 : StringMapEntryBase(strLen), second(std::forward(InitVals)...) {}
136 StringMapEntry(StringMapEntry &E) = delete;
131137
132138 StringRef getKey() const {
133139 return StringRef(getKeyData(), getKeyLength());
439445
440446 template class StringMapConstIterator {
441447 protected:
442 StringMapEntryBase **Ptr;
448 StringMapEntryBase **Ptr = nullptr;
443449
444450 public:
445451 typedef StringMapEntry value_type;
446452
447 StringMapConstIterator() : Ptr(nullptr) { }
453 StringMapConstIterator() = default;
448454
449455 explicit StringMapConstIterator(StringMapEntryBase **Bucket,
450456 bool NoAdvance = false)
485491 template
486492 class StringMapIterator : public StringMapConstIterator {
487493 public:
488 StringMapIterator() {}
494 StringMapIterator() = default;
495
489496 explicit StringMapIterator(StringMapEntryBase **Bucket,
490497 bool NoAdvance = false)
491498 : StringMapConstIterator(Bucket, NoAdvance) {
492499 }
500
493501 StringMapEntry &operator*() const {
494502 return *static_cast*>(*this->Ptr);
495503 }
497505 return static_cast*>(*this->Ptr);
498506 }
499507 };
500 }
501
502 #endif
508
509 } // end namespace llvm
510
511 #endif // LLVM_ADT_STRINGMAP_H
1111
1212 #include
1313 #include
14 #include
1415
1516 namespace llvm {
1617
263264 mutable T Ptr;
264265
265266 public:
266 pointer_iterator() {}
267 pointer_iterator() = default;
267268
268269 explicit pointer_iterator(WrappedIteratorT u)
269270 : pointer_iterator::iterator_adaptor_base(std::move(u)) {}
272273 const T &operator*() const { return Ptr = &*this->I; }
273274 };
274275
275 } // namespace llvm
276
277 #endif
276 } // end namespace llvm
277
278 #endif // LLVM_ADT_ITERATOR_H