llvm.org GIT mirror llvm / 4334dd9
Switch LLVM_USE_RVALUE_REFERENCES to LLVM_HAS_RVALUE_REFERENCES. Rationale: 1) This was the name in the comment block. ;] 2) It matches Clang's __has_feature naming convention. 3) It matches other compiler-feature-test conventions. Sorry for the noise. =] I've also switch the comment block to use a \brief tag and not duplicate the name. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168996 91177308-0d34-0410-b5e6-96231b3b80d8 Chandler Carruth 6 years ago
17 changed file(s) with 55 addition(s) and 55 deletion(s). Raw diff Collapse all Expand all
273273 initSlowCase(that);
274274 }
275275
276 #if LLVM_USE_RVALUE_REFERENCES
276 #if LLVM_HAS_RVALUE_REFERENCES
277277 /// @brief Move Constructor.
278278 APInt(APInt&& that) : BitWidth(that.BitWidth), VAL(that.VAL) {
279279 that.BitWidth = 0;
600600 return AssignSlowCase(RHS);
601601 }
602602
603 #if LLVM_USE_RVALUE_REFERENCES
603 #if LLVM_HAS_RVALUE_REFERENCES
604604 /// @brief Move assignment operator.
605605 APInt& operator=(APInt&& that) {
606606 if (!isSingleWord())
9797 std::memcpy(Bits, RHS.Bits, Capacity * sizeof(BitWord));
9898 }
9999
100 #if LLVM_USE_RVALUE_REFERENCES
100 #if LLVM_HAS_RVALUE_REFERENCES
101101 BitVector(BitVector &&RHS)
102102 : Bits(RHS.Bits), Size(RHS.Size), Capacity(RHS.Capacity) {
103103 RHS.Bits = 0;
451451 return *this;
452452 }
453453
454 #if LLVM_USE_RVALUE_REFERENCES
454 #if LLVM_HAS_RVALUE_REFERENCES
455455 const BitVector &operator=(BitVector &&RHS) {
456456 if (this == &RHS) return *this;
457457
197197 return FindAndConstruct(Key).second;
198198 }
199199
200 #if LLVM_USE_RVALUE_REFERENCES
200 #if LLVM_HAS_RVALUE_REFERENCES
201201 value_type& FindAndConstruct(KeyT &&Key) {
202202 BucketT *TheBucket;
203203 if (LookupBucketFor(Key, TheBucket))
382382 return TheBucket;
383383 }
384384
385 #if LLVM_USE_RVALUE_REFERENCES
385 #if LLVM_HAS_RVALUE_REFERENCES
386386 BucketT *InsertIntoBucket(const KeyT &Key, ValueT &&Value,
387387 BucketT *TheBucket) {
388388 TheBucket = InsertIntoBucketImpl(Key, TheBucket);
535535 copyFrom(other);
536536 }
537537
538 #if LLVM_USE_RVALUE_REFERENCES
538 #if LLVM_HAS_RVALUE_REFERENCES
539539 DenseMap(DenseMap &&other) {
540540 init(0);
541541 swap(other);
565565 return *this;
566566 }
567567
568 #if LLVM_USE_RVALUE_REFERENCES
568 #if LLVM_HAS_RVALUE_REFERENCES
569569 DenseMap& operator=(DenseMap &&other) {
570570 this->destroyAll();
571571 operator delete(Buckets);
699699 copyFrom(other);
700700 }
701701
702 #if LLVM_USE_RVALUE_REFERENCES
702 #if LLVM_HAS_RVALUE_REFERENCES
703703 SmallDenseMap(SmallDenseMap &&other) {
704704 init(0);
705705 swap(other);
794794 return *this;
795795 }
796796
797 #if LLVM_USE_RVALUE_REFERENCES
797 #if LLVM_HAS_RVALUE_REFERENCES
798798 SmallDenseMap& operator=(SmallDenseMap &&other) {
799799 this->destroyAll();
800800 deallocateBuckets();
122122 retain();
123123 }
124124
125 #if LLVM_USE_RVALUE_REFERENCES
125 #if LLVM_HAS_RVALUE_REFERENCES
126126 IntrusiveRefCntPtr(IntrusiveRefCntPtr&& S) : Obj(S.Obj) {
127127 S.Obj = 0;
128128 }
1818 #include "llvm/Support/Compiler.h"
1919 #include
2020
21 #if LLVM_USE_RVALUE_REFERENCES
21 #if LLVM_HAS_RVALUE_REFERENCES
2222 #include
2323 #endif
2424
3232 explicit Optional() : x(), hasVal(false) {}
3333 Optional(const T &y) : x(y), hasVal(true) {}
3434
35 #if LLVM_USE_RVALUE_REFERENCES
35 #if LLVM_HAS_RVALUE_REFERENCES
3636 Optional(T &&y) : x(std::forward(y)), hasVal(true) {}
3737 #endif
3838
3131 public:
3232 explicit OwningPtr(T *P = 0) : Ptr(P) {}
3333
34 #if LLVM_USE_RVALUE_REFERENCES
34 #if LLVM_HAS_RVALUE_REFERENCES
3535 OwningPtr(OwningPtr &&Other) : Ptr(Other.take()) {}
3636
3737 OwningPtr &operator=(OwningPtr &&Other) {
9494 public:
9595 explicit OwningArrayPtr(T *P = 0) : Ptr(P) {}
9696
97 #if LLVM_USE_RVALUE_REFERENCES
97 #if LLVM_HAS_RVALUE_REFERENCES
9898 OwningArrayPtr(OwningArrayPtr &&Other) : Ptr(Other.take()) {}
9999
100100 OwningArrayPtr &operator=(OwningArrayPtr &&Other) {
152152 switchToLarge(new BitVector(*RHS.getPointer()));
153153 }
154154
155 #if LLVM_USE_RVALUE_REFERENCES
155 #if LLVM_HAS_RVALUE_REFERENCES
156156 SmallBitVector(SmallBitVector &&RHS) : X(RHS.X) {
157157 RHS.X = 1;
158158 }
471471 return *this;
472472 }
473473
474 #if LLVM_USE_RVALUE_REFERENCES
474 #if LLVM_HAS_RVALUE_REFERENCES
475475 const SmallBitVector &operator=(SmallBitVector &&RHS) {
476476 if (this != &RHS) {
477477 clear();
177177 /// std::move, but not all stdlibs actually provide that.
178178 template
179179 static It2 move(It1 I, It1 E, It2 Dest) {
180 #if LLVM_USE_RVALUE_REFERENCES
180 #if LLVM_HAS_RVALUE_REFERENCES
181181 for (; I != E; ++I, ++Dest)
182182 *Dest = ::std::move(*I);
183183 return Dest;
192192 /// std::move_backward, but not all stdlibs actually provide that.
193193 template
194194 static It2 move_backward(It1 I, It1 E, It2 Dest) {
195 #if LLVM_USE_RVALUE_REFERENCES
195 #if LLVM_HAS_RVALUE_REFERENCES
196196 while (I != E)
197197 *--Dest = ::std::move(*--E);
198198 return Dest;
205205 /// memory starting with "Dest", constructing elements as needed.
206206 template
207207 static void uninitialized_move(It1 I, It1 E, It2 Dest) {
208 #if LLVM_USE_RVALUE_REFERENCES
208 #if LLVM_HAS_RVALUE_REFERENCES
209209 for (; I != E; ++I, ++Dest)
210210 ::new ((void*) &*Dest) T(::std::move(*I));
211211 #else
238238 goto Retry;
239239 }
240240
241 #if LLVM_USE_RVALUE_REFERENCES
241 #if LLVM_HAS_RVALUE_REFERENCES
242242 void push_back(T &&Elt) {
243243 if (this->EndX < this->CapacityX) {
244244 Retry:
421421 }
422422
423423 T pop_back_val() {
424 #if LLVM_USE_RVALUE_REFERENCES
424 #if LLVM_HAS_RVALUE_REFERENCES
425425 T Result = ::std::move(this->back());
426426 #else
427427 T Result = this->back();
494494 return(N);
495495 }
496496
497 #if LLVM_USE_RVALUE_REFERENCES
497 #if LLVM_HAS_RVALUE_REFERENCES
498498 iterator insert(iterator I, T &&Elt) {
499499 if (I == this->end()) { // Important special case for empty vector.
500500 this->push_back(::std::move(Elt));
666666
667667 SmallVectorImpl &operator=(const SmallVectorImpl &RHS);
668668
669 #if LLVM_USE_RVALUE_REFERENCES
669 #if LLVM_HAS_RVALUE_REFERENCES
670670 SmallVectorImpl &operator=(SmallVectorImpl &&RHS);
671671 #endif
672672
786786 return *this;
787787 }
788788
789 #if LLVM_USE_RVALUE_REFERENCES
789 #if LLVM_HAS_RVALUE_REFERENCES
790790 template
791791 SmallVectorImpl &SmallVectorImpl::operator=(SmallVectorImpl &&RHS) {
792792 // Avoid self-assignment.
897897 return *this;
898898 }
899899
900 #if LLVM_USE_RVALUE_REFERENCES
900 #if LLVM_HAS_RVALUE_REFERENCES
901901 SmallVector(SmallVector &&RHS) : SmallVectorImpl(N) {
902902 if (!RHS.empty())
903903 SmallVectorImpl::operator=(::std::move(RHS));
6969 return *this;
7070 }
7171
72 #if LLVM_USE_RVALUE_REFERENCES
72 #if LLVM_HAS_RVALUE_REFERENCES
7373 TinyPtrVector(TinyPtrVector &&RHS) : Val(RHS.Val) {
7474 RHS.Val = (EltTy)0;
7575 }
1818 # define __has_feature(x) 0
1919 #endif
2020
21 /// LLVM_HAS_RVALUE_REFERENCES - Does the compiler provide r-value references?
21 /// \brief Does the compiler support r-value references?
2222 /// This implies that provides the one-argument std::move; it
2323 /// does not imply the existence of any other C++ library features.
2424 #if (__has_feature(cxx_rvalue_references) \
2525 || defined(__GXX_EXPERIMENTAL_CXX0X__) \
2626 || (defined(_MSC_VER) && _MSC_VER >= 1600))
27 #define LLVM_USE_RVALUE_REFERENCES 1
28 #else
29 #define LLVM_USE_RVALUE_REFERENCES 0
27 #define LLVM_HAS_RVALUE_REFERENCES 1
28 #else
29 #define LLVM_HAS_RVALUE_REFERENCES 0
3030 #endif
3131
3232 /// \brief Does the compiler support r-value reference *this?
4343
4444 /// llvm_move - Expands to ::std::move if the compiler supports
4545 /// r-value references; otherwise, expands to the argument.
46 #if LLVM_USE_RVALUE_REFERENCES
46 #if LLVM_HAS_RVALUE_REFERENCES
4747 #define llvm_move(value) (::std::move(value))
4848 #else
4949 #define llvm_move(value) (value)
606606 public:
607607 typedef char char_type;
608608
609 #if LLVM_USE_RVALUE_REFERENCES
609 #if LLVM_HAS_RVALUE_REFERENCES
610610 mapped_file_region(mapped_file_region&&);
611611 mapped_file_region &operator =(mapped_file_region&&);
612612 #endif
545545 ::munmap(Mapping, Size);
546546 }
547547
548 #if LLVM_USE_RVALUE_REFERENCES
548 #if LLVM_HAS_RVALUE_REFERENCES
549549 mapped_file_region::mapped_file_region(mapped_file_region &&other)
550550 : Mode(other.Mode), Size(other.Size), Mapping(other.Mapping) {
551551 other.Mapping = 0;
860860 ::CloseHandle(FileHandle);
861861 }
862862
863 #if LLVM_USE_RVALUE_REFERENCES
863 #if LLVM_HAS_RVALUE_REFERENCES
864864 mapped_file_region::mapped_file_region(mapped_file_region &&other)
865865 : Mode(other.Mode)
866866 , Size(other.Size)
15381538 def : Mips16Pat<(i32 (extloadi8 addr16:$src)),
15391539 (LbuRxRyOffMemX16 addr16:$src)>;
15401540 def : Mips16Pat<(i32 (extloadi16 addr16:$src)),
1541 (LhuRxRyOffMemX16 addr16:$src)>;
1541 (LhuRxRyOffMemX16 addr16:$src)>;
156156 this->expectValues(Copy2, this->testArray(42));
157157 this->expectValues(this->V2, this->testArray(0));
158158
159 #if LLVM_USE_RVALUE_REFERENCES
159 #if LLVM_HAS_RVALUE_REFERENCES
160160 TypeParam Move(std::move(Copy2));
161161 this->expectValues(Move, this->testArray(42));
162162 this->expectValues(Copy2, this->testArray(0));
167167 this->V = this->V2;
168168 this->expectValues(this->V, this->testArray(0));
169169 this->expectValues(this->V2, this->testArray(0));
170 #if LLVM_USE_RVALUE_REFERENCES
170 #if LLVM_HAS_RVALUE_REFERENCES
171171 this->V = std::move(this->V2);
172172 this->expectValues(this->V, this->testArray(0));
173173 #endif
176176 this->V = this->V2;
177177 this->expectValues(this->V, this->testArray(0));
178178 this->expectValues(this->V2, this->testArray(0));
179 #if LLVM_USE_RVALUE_REFERENCES
179 #if LLVM_HAS_RVALUE_REFERENCES
180180 this->setVectors(this->testArray(1), this->testArray(0));
181181 this->V = std::move(this->V2);
182182 this->expectValues(this->V, this->testArray(0));
186186 this->V = this->V2;
187187 this->expectValues(this->V, this->testArray(0));
188188 this->expectValues(this->V2, this->testArray(0));
189 #if LLVM_USE_RVALUE_REFERENCES
189 #if LLVM_HAS_RVALUE_REFERENCES
190190 this->setVectors(this->testArray(2), this->testArray(0));
191191 this->V = std::move(this->V2);
192192 this->expectValues(this->V, this->testArray(0));
196196 this->V = this->V2;
197197 this->expectValues(this->V, this->testArray(0));
198198 this->expectValues(this->V2, this->testArray(0));
199 #if LLVM_USE_RVALUE_REFERENCES
199 #if LLVM_HAS_RVALUE_REFERENCES
200200 this->setVectors(this->testArray(42), this->testArray(0));
201201 this->V = std::move(this->V2);
202202 this->expectValues(this->V, this->testArray(0));
206206 this->V = this->V2;
207207 this->expectValues(this->V, this->testArray(1));
208208 this->expectValues(this->V2, this->testArray(1));
209 #if LLVM_USE_RVALUE_REFERENCES
209 #if LLVM_HAS_RVALUE_REFERENCES
210210 this->setVectors(this->testArray(0), this->testArray(1));
211211 this->V = std::move(this->V2);
212212 this->expectValues(this->V, this->testArray(1));
216216 this->V = this->V2;
217217 this->expectValues(this->V, this->testArray(2));
218218 this->expectValues(this->V2, this->testArray(2));
219 #if LLVM_USE_RVALUE_REFERENCES
219 #if LLVM_HAS_RVALUE_REFERENCES
220220 this->setVectors(this->testArray(0), this->testArray(2));
221221 this->V = std::move(this->V2);
222222 this->expectValues(this->V, this->testArray(2));
226226 this->V = this->V2;
227227 this->expectValues(this->V, this->testArray(42));
228228 this->expectValues(this->V2, this->testArray(42));
229 #if LLVM_USE_RVALUE_REFERENCES
229 #if LLVM_HAS_RVALUE_REFERENCES
230230 this->setVectors(this->testArray(0), this->testArray(42));
231231 this->V = std::move(this->V2);
232232 this->expectValues(this->V, this->testArray(42));
236236 this->V = this->V2;
237237 this->expectValues(this->V, this->testArray(1));
238238 this->expectValues(this->V2, this->testArray(1));
239 #if LLVM_USE_RVALUE_REFERENCES
239 #if LLVM_HAS_RVALUE_REFERENCES
240240 this->V = std::move(this->V2);
241241 this->expectValues(this->V, this->testArray(1));
242242 #endif
245245 this->V = this->V2;
246246 this->expectValues(this->V, this->testArray(2));
247247 this->expectValues(this->V2, this->testArray(2));
248 #if LLVM_USE_RVALUE_REFERENCES
248 #if LLVM_HAS_RVALUE_REFERENCES
249249 this->setVectors(this->testArray(1), this->testArray(2));
250250 this->V = std::move(this->V2);
251251 this->expectValues(this->V, this->testArray(2));
255255 this->V = this->V2;
256256 this->expectValues(this->V, this->testArray(42));
257257 this->expectValues(this->V2, this->testArray(42));
258 #if LLVM_USE_RVALUE_REFERENCES
258 #if LLVM_HAS_RVALUE_REFERENCES
259259 this->setVectors(this->testArray(1), this->testArray(42));
260260 this->V = std::move(this->V2);
261261 this->expectValues(this->V, this->testArray(42));
265265 this->V = this->V2;
266266 this->expectValues(this->V, this->testArray(1));
267267 this->expectValues(this->V2, this->testArray(1));
268 #if LLVM_USE_RVALUE_REFERENCES
268 #if LLVM_HAS_RVALUE_REFERENCES
269269 this->setVectors(this->testArray(2), this->testArray(1));
270270 this->V = std::move(this->V2);
271271 this->expectValues(this->V, this->testArray(1));
275275 this->V = this->V2;
276276 this->expectValues(this->V, this->testArray(2));
277277 this->expectValues(this->V2, this->testArray(2));
278 #if LLVM_USE_RVALUE_REFERENCES
278 #if LLVM_HAS_RVALUE_REFERENCES
279279 this->setVectors(this->testArray(2), this->testArray(2));
280280 this->V = std::move(this->V2);
281281 this->expectValues(this->V, this->testArray(2));
285285 this->V = this->V2;
286286 this->expectValues(this->V, this->testArray(42));
287287 this->expectValues(this->V2, this->testArray(42));
288 #if LLVM_USE_RVALUE_REFERENCES
288 #if LLVM_HAS_RVALUE_REFERENCES
289289 this->setVectors(this->testArray(2), this->testArray(42));
290290 this->V = std::move(this->V2);
291291 this->expectValues(this->V, this->testArray(42));
295295 this->V = this->V2;
296296 this->expectValues(this->V, this->testArray(1));
297297 this->expectValues(this->V2, this->testArray(1));
298 #if LLVM_USE_RVALUE_REFERENCES
298 #if LLVM_HAS_RVALUE_REFERENCES
299299 this->setVectors(this->testArray(42), this->testArray(1));
300300 this->V = std::move(this->V2);
301301 this->expectValues(this->V, this->testArray(1));
305305 this->V = this->V2;
306306 this->expectValues(this->V, this->testArray(2));
307307 this->expectValues(this->V2, this->testArray(2));
308 #if LLVM_USE_RVALUE_REFERENCES
308 #if LLVM_HAS_RVALUE_REFERENCES
309309 this->setVectors(this->testArray(42), this->testArray(2));
310310 this->V = std::move(this->V2);
311311 this->expectValues(this->V, this->testArray(2));
315315 this->V = this->V2;
316316 this->expectValues(this->V, this->testArray(42));
317317 this->expectValues(this->V2, this->testArray(42));
318 #if LLVM_USE_RVALUE_REFERENCES
318 #if LLVM_HAS_RVALUE_REFERENCES
319319 this->setVectors(this->testArray(42), this->testArray(42));
320320 this->V = std::move(this->V2);
321321 this->expectValues(this->V, this->testArray(42));
374374
375375 // Unmap temp file
376376
377 #if LLVM_USE_RVALUE_REFERENCES
377 #if LLVM_HAS_RVALUE_REFERENCES
378378 fs::mapped_file_region m(Twine(TempPath),
379379 fs::mapped_file_region::readonly,
380380 0,