1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[C++11] Switch all uses of the llvm_move macro to use std::move

directly, and remove the macro.

llvm-svn: 202612
This commit is contained in:
Chandler Carruth 2014-03-02 04:08:41 +00:00
parent 6aea38dc6d
commit db906c8499
15 changed files with 41 additions and 45 deletions

View File

@ -285,8 +285,8 @@ protected:
bool FoundVal = LookupBucketFor(B->first, DestBucket);
(void)FoundVal; // silence warning.
assert(!FoundVal && "Key already in new map?");
DestBucket->first = llvm_move(B->first);
new (&DestBucket->second) ValueT(llvm_move(B->second));
DestBucket->first = std::move(B->first);
new (&DestBucket->second) ValueT(std::move(B->second));
incrementNumEntries();
// Free the value.
@ -753,10 +753,10 @@ public:
// Swap separately and handle any assymetry.
std::swap(LHSB->first, RHSB->first);
if (hasLHSValue) {
new (&RHSB->second) ValueT(llvm_move(LHSB->second));
new (&RHSB->second) ValueT(std::move(LHSB->second));
LHSB->second.~ValueT();
} else if (hasRHSValue) {
new (&LHSB->second) ValueT(llvm_move(RHSB->second));
new (&LHSB->second) ValueT(std::move(RHSB->second));
RHSB->second.~ValueT();
}
}
@ -772,7 +772,7 @@ public:
SmallDenseMap &LargeSide = Small ? RHS : *this;
// First stash the large side's rep and move the small side across.
LargeRep TmpRep = llvm_move(*LargeSide.getLargeRep());
LargeRep TmpRep = std::move(*LargeSide.getLargeRep());
LargeSide.getLargeRep()->~LargeRep();
LargeSide.Small = true;
// This is similar to the standard move-from-old-buckets, but the bucket
@ -782,11 +782,11 @@ public:
for (unsigned i = 0, e = InlineBuckets; i != e; ++i) {
BucketT *NewB = &LargeSide.getInlineBuckets()[i],
*OldB = &SmallSide.getInlineBuckets()[i];
new (&NewB->first) KeyT(llvm_move(OldB->first));
new (&NewB->first) KeyT(std::move(OldB->first));
OldB->first.~KeyT();
if (!KeyInfoT::isEqual(NewB->first, EmptyKey) &&
!KeyInfoT::isEqual(NewB->first, TombstoneKey)) {
new (&NewB->second) ValueT(llvm_move(OldB->second));
new (&NewB->second) ValueT(std::move(OldB->second));
OldB->second.~ValueT();
}
}
@ -794,7 +794,7 @@ public:
// The hard part of moving the small buckets across is done, just move
// the TmpRep into its new home.
SmallSide.Small = false;
new (SmallSide.getLargeRep()) LargeRep(llvm_move(TmpRep));
new (SmallSide.getLargeRep()) LargeRep(std::move(TmpRep));
}
SmallDenseMap& operator=(const SmallDenseMap& other) {
@ -852,8 +852,8 @@ public:
!KeyInfoT::isEqual(P->first, TombstoneKey)) {
assert(size_t(TmpEnd - TmpBegin) < InlineBuckets &&
"Too many inline buckets!");
new (&TmpEnd->first) KeyT(llvm_move(P->first));
new (&TmpEnd->second) ValueT(llvm_move(P->second));
new (&TmpEnd->first) KeyT(std::move(P->first));
new (&TmpEnd->second) ValueT(std::move(P->second));
++TmpEnd;
P->second.~ValueT();
}
@ -868,7 +868,7 @@ public:
return;
}
LargeRep OldRep = llvm_move(*getLargeRep());
LargeRep OldRep = std::move(*getLargeRep());
getLargeRep()->~LargeRep();
if (AtLeast <= InlineBuckets) {
Small = true;

View File

@ -219,7 +219,7 @@ public:
U = ToVisit.UseAndIsOffsetKnown.getPointer();
IsOffsetKnown = ToVisit.UseAndIsOffsetKnown.getInt();
if (IsOffsetKnown)
Offset = llvm_move(ToVisit.Offset);
Offset = std::move(ToVisit.Offset);
Instruction *I = cast<Instruction>(U->getUser());
static_cast<DerivedT*>(this)->visit(I);

View File

@ -204,7 +204,7 @@ struct PassModel;
template <typename IRUnitT, typename AnalysisManagerT, typename PassT>
struct PassModel<IRUnitT, AnalysisManagerT, PassT,
true> : PassConcept<IRUnitT, AnalysisManagerT> {
PassModel(PassT Pass) : Pass(llvm_move(Pass)) {}
PassModel(PassT Pass) : Pass(std::move(Pass)) {}
virtual PassModel *clone() { return new PassModel(Pass); }
virtual PreservedAnalyses run(IRUnitT IR, AnalysisManagerT *AM) {
return Pass.run(IR, AM);
@ -218,7 +218,7 @@ struct PassModel<IRUnitT, AnalysisManagerT, PassT,
template <typename IRUnitT, typename AnalysisManagerT, typename PassT>
struct PassModel<IRUnitT, AnalysisManagerT, PassT,
false> : PassConcept<IRUnitT, AnalysisManagerT> {
PassModel(PassT Pass) : Pass(llvm_move(Pass)) {}
PassModel(PassT Pass) : Pass(std::move(Pass)) {}
virtual PassModel *clone() { return new PassModel(Pass); }
virtual PreservedAnalyses run(IRUnitT IR, AnalysisManagerT *AM) {
return Pass.run(IR);
@ -280,7 +280,7 @@ struct AnalysisResultModel;
template <typename IRUnitT, typename PassT, typename ResultT>
struct AnalysisResultModel<IRUnitT, PassT, ResultT,
false> : AnalysisResultConcept<IRUnitT> {
AnalysisResultModel(ResultT Result) : Result(llvm_move(Result)) {}
AnalysisResultModel(ResultT Result) : Result(std::move(Result)) {}
virtual AnalysisResultModel *clone() {
return new AnalysisResultModel(Result);
}
@ -302,7 +302,7 @@ struct AnalysisResultModel<IRUnitT, PassT, ResultT,
template <typename IRUnitT, typename PassT, typename ResultT>
struct AnalysisResultModel<IRUnitT, PassT, ResultT,
true> : AnalysisResultConcept<IRUnitT> {
AnalysisResultModel(ResultT Result) : Result(llvm_move(Result)) {}
AnalysisResultModel(ResultT Result) : Result(std::move(Result)) {}
virtual AnalysisResultModel *clone() {
return new AnalysisResultModel(Result);
}
@ -347,7 +347,7 @@ template <typename IRUnitT, typename AnalysisManagerT, typename PassT>
struct AnalysisPassModel<IRUnitT, AnalysisManagerT, PassT,
true> : AnalysisPassConcept<IRUnitT,
AnalysisManagerT> {
AnalysisPassModel(PassT Pass) : Pass(llvm_move(Pass)) {}
AnalysisPassModel(PassT Pass) : Pass(std::move(Pass)) {}
virtual AnalysisPassModel *clone() { return new AnalysisPassModel(Pass); }
// FIXME: Replace PassT::Result with type traits when we use C++11.
@ -370,7 +370,7 @@ template <typename IRUnitT, typename AnalysisManagerT, typename PassT>
struct AnalysisPassModel<IRUnitT, AnalysisManagerT, PassT,
false> : AnalysisPassConcept<IRUnitT,
AnalysisManagerT> {
AnalysisPassModel(PassT Pass) : Pass(llvm_move(Pass)) {}
AnalysisPassModel(PassT Pass) : Pass(std::move(Pass)) {}
virtual AnalysisPassModel *clone() { return new AnalysisPassModel(Pass); }
// FIXME: Replace PassT::Result with type traits when we use C++11.
@ -403,7 +403,7 @@ public:
PreservedAnalyses run(Module *M, ModuleAnalysisManager *AM = 0);
template <typename ModulePassT> void addPass(ModulePassT Pass) {
Passes.push_back(new ModulePassModel<ModulePassT>(llvm_move(Pass)));
Passes.push_back(new ModulePassModel<ModulePassT>(std::move(Pass)));
}
static StringRef name() { return "ModulePassManager"; }
@ -428,7 +428,7 @@ public:
explicit FunctionPassManager() {}
template <typename FunctionPassT> void addPass(FunctionPassT Pass) {
Passes.push_back(new FunctionPassModel<FunctionPassT>(llvm_move(Pass)));
Passes.push_back(new FunctionPassModel<FunctionPassT>(std::move(Pass)));
}
PreservedAnalyses run(Function *F, FunctionAnalysisManager *AM = 0);
@ -519,7 +519,7 @@ public:
assert(!AnalysisPasses.count(PassT::ID()) &&
"Registered the same analysis pass twice!");
typedef detail::AnalysisPassModel<IRUnitT, DerivedT, PassT> PassModelT;
AnalysisPasses[PassT::ID()] = new PassModelT(llvm_move(Pass));
AnalysisPasses[PassT::ID()] = new PassModelT(std::move(Pass));
}
/// \brief Invalidate a specific analysis pass for an IR module.
@ -783,7 +783,7 @@ template <typename FunctionPassT>
class ModuleToFunctionPassAdaptor {
public:
explicit ModuleToFunctionPassAdaptor(FunctionPassT Pass)
: Pass(llvm_move(Pass)) {}
: Pass(std::move(Pass)) {}
/// \brief Runs the function pass across every function in the module.
PreservedAnalyses run(Module *M, ModuleAnalysisManager *AM) {
@ -804,7 +804,7 @@ public:
// Then intersect the preserved set so that invalidation of module
// analyses will eventually occur when the module pass completes.
PA.intersect(llvm_move(PassPA));
PA.intersect(std::move(PassPA));
}
// By definition we preserve the proxy. This precludes *any* invalidation
@ -826,7 +826,7 @@ private:
template <typename FunctionPassT>
ModuleToFunctionPassAdaptor<FunctionPassT>
createModuleToFunctionPassAdaptor(FunctionPassT Pass) {
return ModuleToFunctionPassAdaptor<FunctionPassT>(llvm_move(Pass));
return ModuleToFunctionPassAdaptor<FunctionPassT>(std::move(Pass));
}
}

View File

@ -78,10 +78,6 @@
# define LLVM_HAS_VARIADIC_TEMPLATES 0
#endif
/// llvm_move - Expands to ::std::move. This is a hold-over from when we did
/// not support R-value references.
#define llvm_move(value) (::std::move(value))
/// Expands to '&' if r-value references are supported.
///
/// This can be used to provide l-value/r-value overrides of member functions.

View File

@ -23,7 +23,7 @@ void detail::PtrUseVisitorBase::enqueueUsers(Instruction &I) {
UseToVisit::UseAndIsOffsetKnownPair(&UI.getUse(), IsOffsetKnown),
Offset
};
Worklist.push_back(llvm_move(NewU));
Worklist.push_back(std::move(NewU));
}
}
}

View File

@ -470,11 +470,11 @@ void DwarfDebug::addScopeRangeList(DwarfCompileUnit *TheCU, DIE *ScopeDIE,
RI != RE; ++RI) {
RangeSpan Span(getLabelBeforeInsn(RI->first),
getLabelAfterInsn(RI->second));
List.addRange(llvm_move(Span));
List.addRange(std::move(Span));
}
// Add the range list to the set of ranges to be emitted.
TheCU->addRangeList(llvm_move(List));
TheCU->addRangeList(std::move(List));
}
// Construct new DW_TAG_lexical_block for this scope and attach
@ -1800,7 +1800,7 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
// Add the range of this function to the list of ranges for the CU.
RangeSpan Span(FunctionBeginSym, FunctionEndSym);
TheCU->addRange(llvm_move(Span));
TheCU->addRange(std::move(Span));
// Clear debug info
for (ScopeVariablesMap::iterator I = ScopeVariables.begin(),

View File

@ -68,7 +68,7 @@ void DWARFDebugLoc::parse(DataExtractor data, unsigned AddressSize) {
Offset += Bytes;
E.Loc.reserve(str.size());
std::copy(str.begin(), str.end(), std::back_inserter(E.Loc));
Loc.Entries.push_back(llvm_move(E));
Loc.Entries.push_back(std::move(E));
}
}
if (data.isValidOffset(Offset))

View File

@ -31,7 +31,7 @@ PreservedAnalyses ModulePassManager::run(Module *M, ModuleAnalysisManager *AM) {
PreservedAnalyses PassPA = Passes[Idx]->run(M, AM);
if (AM)
AM->invalidate(M, PassPA);
PA.intersect(llvm_move(PassPA));
PA.intersect(std::move(PassPA));
}
if (DebugPM)
@ -89,7 +89,7 @@ PreservedAnalyses FunctionPassManager::run(Function *F, FunctionAnalysisManager
PreservedAnalyses PassPA = Passes[Idx]->run(F, AM);
if (AM)
AM->invalidate(F, PassPA);
PA.intersect(llvm_move(PassPA));
PA.intersect(std::move(PassPA));
}
if (DebugPM)

View File

@ -39,10 +39,10 @@ ConstantRange::ConstantRange(uint32_t BitWidth, bool Full) {
/// Initialize a range to hold the single specified value.
///
ConstantRange::ConstantRange(APIntMoveTy V)
: Lower(llvm_move(V)), Upper(Lower + 1) {}
: Lower(std::move(V)), Upper(Lower + 1) {}
ConstantRange::ConstantRange(APIntMoveTy L, APIntMoveTy U)
: Lower(llvm_move(L)), Upper(llvm_move(U)) {
: Lower(std::move(L)), Upper(std::move(U)) {
assert(Lower.getBitWidth() == Upper.getBitWidth() &&
"ConstantRange with unequal bit widths");
assert((Lower != Upper || (Lower.isMaxValue() || Lower.isMinValue())) &&

View File

@ -1617,11 +1617,11 @@ std::string Node::getVerbatimTag() const {
if (Raw.find_last_of('!') == 0) {
Ret = Doc->getTagMap().find("!")->second;
Ret += Raw.substr(1);
return llvm_move(Ret);
return std::move(Ret);
} else if (Raw.startswith("!!")) {
Ret = Doc->getTagMap().find("!!")->second;
Ret += Raw.substr(2);
return llvm_move(Ret);
return std::move(Ret);
} else {
StringRef TagHandle = Raw.substr(0, Raw.find_last_of('!') + 1);
std::map<StringRef, StringRef>::const_iterator It =
@ -1635,7 +1635,7 @@ std::string Node::getVerbatimTag() const {
setError(Twine("Unknown tag handle ") + TagHandle, T);
}
Ret += Raw.substr(Raw.find_last_of('!') + 1);
return llvm_move(Ret);
return std::move(Ret);
}
}

View File

@ -229,7 +229,7 @@ void ConstantHoisting::FindAndMakeBaseConstant(ConstantMapType::iterator S,
ConstantInfo::RebasedConstantInfo RCI;
RCI.OriginalConstant = I->first;
RCI.Offset = ConstantInt::get(Ty, Diff);
RCI.Uses = llvm_move(I->second.Uses);
RCI.Uses = std::move(I->second.Uses);
CI.RebasedConstants.push_back(RCI);
}
Constants.push_back(CI);

View File

@ -143,7 +143,7 @@ TEST(SmallPtrSetTest, CopyAndMoveTest) {
s3.insert(&buf[5]);
s3.insert(&buf[6]);
s3.insert(&buf[7]);
s1 = llvm_move(s3);
s1 = std::move(s3);
EXPECT_EQ(8U, s1.size());
EXPECT_TRUE(s3.empty());
for (int i = 0; i < 8; ++i)

View File

@ -57,7 +57,7 @@ TEST(polymorphic_ptr_test, Basic) {
EXPECT_EQ(s, p.get());
EXPECT_EQ(42, p->x);
polymorphic_ptr<S> p2((llvm_move(p)));
polymorphic_ptr<S> p2((std::move(p)));
EXPECT_FALSE((bool)p);
EXPECT_TRUE(!p);
EXPECT_TRUE((bool)p2);

View File

@ -588,7 +588,7 @@ TEST_F(FileSystemTest, FileMapping) {
EC);
ASSERT_NO_ERROR(EC);
const char *Data = m.const_data();
fs::mapped_file_region mfrrv(llvm_move(m));
fs::mapped_file_region mfrrv(std::move(m));
EXPECT_EQ(mfrrv.const_data(), Data);
}
} // anonymous namespace

View File

@ -69,7 +69,7 @@ static std::string prettyTag(yaml::Node *N) {
if (StringRef(Tag).startswith("tag:yaml.org,2002:")) {
std::string Ret = "!!";
Ret += StringRef(Tag).substr(18);
return llvm_move(Ret);
return std::move(Ret);
}
std::string Ret = "!<";
Ret += Tag;