[llvm] r336772 - [TableGen] Add missing std::moves to fix build failure.
Simon Tatham via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 11 01:57:56 PDT 2018
Author: statham
Date: Wed Jul 11 01:57:56 2018
New Revision: 336772
URL: http://llvm.org/viewvc/llvm-project?rev=336772&view=rev
Log:
[TableGen] Add missing std::moves to fix build failure.
gcc 4.7 seems to disagree with gcc 5.3 about whether you need to say
'return std::move(thing)' instead of just 'return thing'. All the
json::Arrays and json::Objects that I was implicitly turning into
json::Values by returning them from functions now have explicit
std::move wrappers, so hopefully 4.7 will be happy now.
Modified:
llvm/trunk/lib/TableGen/JSONBackend.cpp
Modified: llvm/trunk/lib/TableGen/JSONBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/JSONBackend.cpp?rev=336772&r1=336771&r2=336772&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/JSONBackend.cpp (original)
+++ llvm/trunk/lib/TableGen/JSONBackend.cpp Wed Jul 11 01:57:56 2018
@@ -55,7 +55,7 @@ json::Value JSONEmitter::translateInit(c
json::Array array;
for (unsigned i = 0, limit = Bits->getNumBits(); i < limit; i++)
array.push_back(translateInit(*Bits->getBit(i)));
- return array;
+ return std::move(array);
} else if (auto *Int = dyn_cast<IntInit>(&I)) {
return Int->getValue();
} else if (auto *Str = dyn_cast<StringInit>(&I)) {
@@ -66,7 +66,7 @@ json::Value JSONEmitter::translateInit(c
json::Array array;
for (auto val : *List)
array.push_back(translateInit(*val));
- return array;
+ return std::move(array);
}
// Init subclasses that we return as JSON objects containing a
@@ -80,17 +80,17 @@ json::Value JSONEmitter::translateInit(c
if (auto *Def = dyn_cast<DefInit>(&I)) {
obj["kind"] = "def";
obj["def"] = Def->getDef()->getName();
- return obj;
+ return std::move(obj);
} else if (auto *Var = dyn_cast<VarInit>(&I)) {
obj["kind"] = "var";
obj["var"] = Var->getName();
- return obj;
+ return std::move(obj);
} else if (auto *VarBit = dyn_cast<VarBitInit>(&I)) {
if (auto *Var = dyn_cast<VarInit>(VarBit->getBitVar())) {
obj["kind"] = "varbit";
obj["var"] = Var->getName();
obj["index"] = VarBit->getBitNum();
- return obj;
+ return std::move(obj);
}
} else if (auto *Dag = dyn_cast<DagInit>(&I)) {
obj["kind"] = "dag";
@@ -108,7 +108,7 @@ json::Value JSONEmitter::translateInit(c
args.push_back(std::move(arg));
}
obj["args"] = std::move(args);
- return obj;
+ return std::move(obj);
}
// Final fallback: anything that gets past here is simply given a
@@ -117,7 +117,7 @@ json::Value JSONEmitter::translateInit(c
assert(!I.isConcrete());
obj["kind"] = "complex";
- return obj;
+ return std::move(obj);
}
void JSONEmitter::run(raw_ostream &OS) {
More information about the llvm-commits
mailing list