]> granicus.if.org Git - llvm/commitdiff
[TableGen] Add missing std::moves to fix build failure.
authorSimon Tatham <simon.tatham@arm.com>
Wed, 11 Jul 2018 08:57:56 +0000 (08:57 +0000)
committerSimon Tatham <simon.tatham@arm.com>
Wed, 11 Jul 2018 08:57:56 +0000 (08:57 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336772 91177308-0d34-0410-b5e6-96231b3b80d8

lib/TableGen/JSONBackend.cpp

index 94fa52097156bcf1b9990ae57f6aec382100d40e..36cb2208a294fc09ec27edcc11a1225737dd0da5 100644 (file)
@@ -55,7 +55,7 @@ json::Value JSONEmitter::translateInit(const Init &I) {
     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(const Init &I) {
     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(const Init &I) {
   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(const Init &I) {
       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(const Init &I) {
 
   assert(!I.isConcrete());
   obj["kind"] = "complex";
-  return obj;
+  return std::move(obj);
 }
 
 void JSONEmitter::run(raw_ostream &OS) {