llvm.org GIT mirror llvm / 0a3eef5
[C++11] Switch all uses of the llvm_move macro to use std::move directly, and remove the macro. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202612 91177308-0d34-0410-b5e6-96231b3b80d8 Chandler Carruth 5 years ago
15 changed file(s) with 41 addition(s) and 45 deletion(s). Raw diff Collapse all Expand all
284284 bool FoundVal = LookupBucketFor(B->first, DestBucket);
285285 (void)FoundVal; // silence warning.
286286 assert(!FoundVal && "Key already in new map?");
287 DestBucket->first = llvm_move(B->first);
288 new (&DestBucket->second) ValueT(llvm_move(B->second));
287 DestBucket->first = std::move(B->first);
288 new (&DestBucket->second) ValueT(std::move(B->second));
289289 incrementNumEntries();
290290
291291 // Free the value.
752752 // Swap separately and handle any assymetry.
753753 std::swap(LHSB->first, RHSB->first);
754754 if (hasLHSValue) {
755 new (&RHSB->second) ValueT(llvm_move(LHSB->second));
755 new (&RHSB->second) ValueT(std::move(LHSB->second));
756756 LHSB->second.~ValueT();
757757 } else if (hasRHSValue) {
758 new (&LHSB->second) ValueT(llvm_move(RHSB->second));
758 new (&LHSB->second) ValueT(std::move(RHSB->second));
759759 RHSB->second.~ValueT();
760760 }
761761 }
771771 SmallDenseMap &LargeSide = Small ? RHS : *this;
772772
773773 // First stash the large side's rep and move the small side across.
774 LargeRep TmpRep = llvm_move(*LargeSide.getLargeRep());
774 LargeRep TmpRep = std::move(*LargeSide.getLargeRep());
775775 LargeSide.getLargeRep()->~LargeRep();
776776 LargeSide.Small = true;
777777 // This is similar to the standard move-from-old-buckets, but the bucket
781781 for (unsigned i = 0, e = InlineBuckets; i != e; ++i) {
782782 BucketT *NewB = &LargeSide.getInlineBuckets()[i],
783783 *OldB = &SmallSide.getInlineBuckets()[i];
784 new (&NewB->first) KeyT(llvm_move(OldB->first));
784 new (&NewB->first) KeyT(std::move(OldB->first));
785785 OldB->first.~KeyT();
786786 if (!KeyInfoT::isEqual(NewB->first, EmptyKey) &&
787787 !KeyInfoT::isEqual(NewB->first, TombstoneKey)) {
788 new (&NewB->second) ValueT(llvm_move(OldB->second));
788 new (&NewB->second) ValueT(std::move(OldB->second));
789789 OldB->second.~ValueT();
790790 }
791791 }
793793 // The hard part of moving the small buckets across is done, just move
794794 // the TmpRep into its new home.
795795 SmallSide.Small = false;
796 new (SmallSide.getLargeRep()) LargeRep(llvm_move(TmpRep));
796 new (SmallSide.getLargeRep()) LargeRep(std::move(TmpRep));
797797 }
798798
799799 SmallDenseMap& operator=(const SmallDenseMap& other) {
851851 !KeyInfoT::isEqual(P->first, TombstoneKey)) {
852852 assert(size_t(TmpEnd - TmpBegin) < InlineBuckets &&
853853 "Too many inline buckets!");
854 new (&TmpEnd->first) KeyT(llvm_move(P->first));
855 new (&TmpEnd->second) ValueT(llvm_move(P->second));
854 new (&TmpEnd->first) KeyT(std::move(P->first));
855 new (&TmpEnd->second) ValueT(std::move(P->second));
856856 ++TmpEnd;
857857 P->second.~ValueT();
858858 }
867867 return;
868868 }
869869
870 LargeRep OldRep = llvm_move(*getLargeRep());
870 LargeRep OldRep = std::move(*getLargeRep());
871871 getLargeRep()->~LargeRep();
872872 if (AtLeast <= InlineBuckets) {
873873 Small = true;
218218 U = ToVisit.UseAndIsOffsetKnown.getPointer();
219219 IsOffsetKnown = ToVisit.UseAndIsOffsetKnown.getInt();
220220 if (IsOffsetKnown)
221 Offset = llvm_move(ToVisit.Offset);
221 Offset = std::move(ToVisit.Offset);
222222
223223 Instruction *I = cast(U->getUser());
224224 static_cast(this)->visit(I);
203203 template
204204 struct PassModel
205205 true> : PassConcept {
206 PassModel(PassT Pass) : Pass(llvm_move(Pass)) {}
206 PassModel(PassT Pass) : Pass(std::move(Pass)) {}
207207 virtual PassModel *clone() { return new PassModel(Pass); }
208208 virtual PreservedAnalyses run(IRUnitT IR, AnalysisManagerT *AM) {
209209 return Pass.run(IR, AM);
217217 template
218218 struct PassModel
219219 false> : PassConcept {
220 PassModel(PassT Pass) : Pass(llvm_move(Pass)) {}
220 PassModel(PassT Pass) : Pass(std::move(Pass)) {}
221221 virtual PassModel *clone() { return new PassModel(Pass); }
222222 virtual PreservedAnalyses run(IRUnitT IR, AnalysisManagerT *AM) {
223223 return Pass.run(IR);
279279 template
280280 struct AnalysisResultModel
281281 false> : AnalysisResultConcept {
282 AnalysisResultModel(ResultT Result) : Result(llvm_move(Result)) {}
282 AnalysisResultModel(ResultT Result) : Result(std::move(Result)) {}
283283 virtual AnalysisResultModel *clone() {
284284 return new AnalysisResultModel(Result);
285285 }
301301 template
302302 struct AnalysisResultModel
303303 true> : AnalysisResultConcept {
304 AnalysisResultModel(ResultT Result) : Result(llvm_move(Result)) {}
304 AnalysisResultModel(ResultT Result) : Result(std::move(Result)) {}
305305 virtual AnalysisResultModel *clone() {
306306 return new AnalysisResultModel(Result);
307307 }
346346 struct AnalysisPassModel
347347 true> : AnalysisPassConcept
348348 AnalysisManagerT> {
349 AnalysisPassModel(PassT Pass) : Pass(llvm_move(Pass)) {}
349 AnalysisPassModel(PassT Pass) : Pass(std::move(Pass)) {}
350350 virtual AnalysisPassModel *clone() { return new AnalysisPassModel(Pass); }
351351
352352 // FIXME: Replace PassT::Result with type traits when we use C++11.
369369 struct AnalysisPassModel
370370 false> : AnalysisPassConcept
371371 AnalysisManagerT> {
372 AnalysisPassModel(PassT Pass) : Pass(llvm_move(Pass)) {}
372 AnalysisPassModel(PassT Pass) : Pass(std::move(Pass)) {}
373373 virtual AnalysisPassModel *clone() { return new AnalysisPassModel(Pass); }
374374
375375 // FIXME: Replace PassT::Result with type traits when we use C++11.
402402 PreservedAnalyses run(Module *M, ModuleAnalysisManager *AM = 0);
403403
404404 template void addPass(ModulePassT Pass) {
405 Passes.push_back(new ModulePassModel(llvm_move(Pass)));
405 Passes.push_back(new ModulePassModel(std::move(Pass)));
406406 }
407407
408408 static StringRef name() { return "ModulePassManager"; }
427427 explicit FunctionPassManager() {}
428428
429429 template void addPass(FunctionPassT Pass) {
430 Passes.push_back(new FunctionPassModel(llvm_move(Pass)));
430 Passes.push_back(new FunctionPassModel(std::move(Pass)));
431431 }
432432
433433 PreservedAnalyses run(Function *F, FunctionAnalysisManager *AM = 0);
518518 assert(!AnalysisPasses.count(PassT::ID()) &&
519519 "Registered the same analysis pass twice!");
520520 typedef detail::AnalysisPassModel PassModelT;
521 AnalysisPasses[PassT::ID()] = new PassModelT(llvm_move(Pass));
521 AnalysisPasses[PassT::ID()] = new PassModelT(std::move(Pass));
522522 }
523523
524524 /// \brief Invalidate a specific analysis pass for an IR module.
782782 class ModuleToFunctionPassAdaptor {
783783 public:
784784 explicit ModuleToFunctionPassAdaptor(FunctionPassT Pass)
785 : Pass(llvm_move(Pass)) {}
785 : Pass(std::move(Pass)) {}
786786
787787 /// \brief Runs the function pass across every function in the module.
788788 PreservedAnalyses run(Module *M, ModuleAnalysisManager *AM) {
803803
804804 // Then intersect the preserved set so that invalidation of module
805805 // analyses will eventually occur when the module pass completes.
806 PA.intersect(llvm_move(PassPA));
806 PA.intersect(std::move(PassPA));
807807 }
808808
809809 // By definition we preserve the proxy. This precludes *any* invalidation
825825 template
826826 ModuleToFunctionPassAdaptor
827827 createModuleToFunctionPassAdaptor(FunctionPassT Pass) {
828 return ModuleToFunctionPassAdaptor(llvm_move(Pass));
828 return ModuleToFunctionPassAdaptor(std::move(Pass));
829829 }
830830
831831 }
7676 #else
7777 # define LLVM_HAS_VARIADIC_TEMPLATES 0
7878 #endif
79
80 /// llvm_move - Expands to ::std::move. This is a hold-over from when we did
81 /// not support R-value references.
82 #define llvm_move(value) (::std::move(value))
8379
8480 /// Expands to '&' if r-value references are supported.
8581 ///
2222 UseToVisit::UseAndIsOffsetKnownPair(&UI.getUse(), IsOffsetKnown),
2323 Offset
2424 };
25 Worklist.push_back(llvm_move(NewU));
25 Worklist.push_back(std::move(NewU));
2626 }
2727 }
2828 }
469469 RI != RE; ++RI) {
470470 RangeSpan Span(getLabelBeforeInsn(RI->first),
471471 getLabelAfterInsn(RI->second));
472 List.addRange(llvm_move(Span));
472 List.addRange(std::move(Span));
473473 }
474474
475475 // Add the range list to the set of ranges to be emitted.
476 TheCU->addRangeList(llvm_move(List));
476 TheCU->addRangeList(std::move(List));
477477 }
478478
479479 // Construct new DW_TAG_lexical_block for this scope and attach
17991799
18001800 // Add the range of this function to the list of ranges for the CU.
18011801 RangeSpan Span(FunctionBeginSym, FunctionEndSym);
1802 TheCU->addRange(llvm_move(Span));
1802 TheCU->addRange(std::move(Span));
18031803
18041804 // Clear debug info
18051805 for (ScopeVariablesMap::iterator I = ScopeVariables.begin(),
6767 Offset += Bytes;
6868 E.Loc.reserve(str.size());
6969 std::copy(str.begin(), str.end(), std::back_inserter(E.Loc));
70 Loc.Entries.push_back(llvm_move(E));
70 Loc.Entries.push_back(std::move(E));
7171 }
7272 }
7373 if (data.isValidOffset(Offset))
3030 PreservedAnalyses PassPA = Passes[Idx]->run(M, AM);
3131 if (AM)
3232 AM->invalidate(M, PassPA);
33 PA.intersect(llvm_move(PassPA));
33 PA.intersect(std::move(PassPA));
3434 }
3535
3636 if (DebugPM)
8888 PreservedAnalyses PassPA = Passes[Idx]->run(F, AM);
8989 if (AM)
9090 AM->invalidate(F, PassPA);
91 PA.intersect(llvm_move(PassPA));
91 PA.intersect(std::move(PassPA));
9292 }
9393
9494 if (DebugPM)
3838 /// Initialize a range to hold the single specified value.
3939 ///
4040 ConstantRange::ConstantRange(APIntMoveTy V)
41 : Lower(llvm_move(V)), Upper(Lower + 1) {}
41 : Lower(std::move(V)), Upper(Lower + 1) {}
4242
4343 ConstantRange::ConstantRange(APIntMoveTy L, APIntMoveTy U)
44 : Lower(llvm_move(L)), Upper(llvm_move(U)) {
44 : Lower(std::move(L)), Upper(std::move(U)) {
4545 assert(Lower.getBitWidth() == Upper.getBitWidth() &&
4646 "ConstantRange with unequal bit widths");
4747 assert((Lower != Upper || (Lower.isMaxValue() || Lower.isMinValue())) &&
16161616 if (Raw.find_last_of('!') == 0) {
16171617 Ret = Doc->getTagMap().find("!")->second;
16181618 Ret += Raw.substr(1);
1619 return llvm_move(Ret);
1619 return std::move(Ret);
16201620 } else if (Raw.startswith("!!")) {
16211621 Ret = Doc->getTagMap().find("!!")->second;
16221622 Ret += Raw.substr(2);
1623 return llvm_move(Ret);
1623 return std::move(Ret);
16241624 } else {
16251625 StringRef TagHandle = Raw.substr(0, Raw.find_last_of('!') + 1);
16261626 std::map::const_iterator It =
16341634 setError(Twine("Unknown tag handle ") + TagHandle, T);
16351635 }
16361636 Ret += Raw.substr(Raw.find_last_of('!') + 1);
1637 return llvm_move(Ret);
1637 return std::move(Ret);
16381638 }
16391639 }
16401640
228228 ConstantInfo::RebasedConstantInfo RCI;
229229 RCI.OriginalConstant = I->first;
230230 RCI.Offset = ConstantInt::get(Ty, Diff);
231 RCI.Uses = llvm_move(I->second.Uses);
231 RCI.Uses = std::move(I->second.Uses);
232232 CI.RebasedConstants.push_back(RCI);
233233 }
234234 Constants.push_back(CI);
142142 s3.insert(&buf[5]);
143143 s3.insert(&buf[6]);
144144 s3.insert(&buf[7]);
145 s1 = llvm_move(s3);
145 s1 = std::move(s3);
146146 EXPECT_EQ(8U, s1.size());
147147 EXPECT_TRUE(s3.empty());
148148 for (int i = 0; i < 8; ++i)
5656 EXPECT_EQ(s, p.get());
5757 EXPECT_EQ(42, p->x);
5858
59 polymorphic_ptr p2((llvm_move(p)));
59 polymorphic_ptr p2((std::move(p)));
6060 EXPECT_FALSE((bool)p);
6161 EXPECT_TRUE(!p);
6262 EXPECT_TRUE((bool)p2);
587587 EC);
588588 ASSERT_NO_ERROR(EC);
589589 const char *Data = m.const_data();
590 fs::mapped_file_region mfrrv(llvm_move(m));
590 fs::mapped_file_region mfrrv(std::move(m));
591591 EXPECT_EQ(mfrrv.const_data(), Data);
592592 }
593593 } // anonymous namespace
6868 if (StringRef(Tag).startswith("tag:yaml.org,2002:")) {
6969 std::string Ret = "!!";
7070 Ret += StringRef(Tag).substr(18);
71 return llvm_move(Ret);
71 return std::move(Ret);
7272 }
7373 std::string Ret = "!<";
7474 Ret += Tag;