[TableGen] Combine variable declaration and initialization. Move a string into a...
authorCraig Topper <craig.topper@gmail.com>
Fri, 8 Jan 2016 07:06:29 +0000 (07:06 +0000)
committerCraig Topper <craig.topper@gmail.com>
Fri, 8 Jan 2016 07:06:29 +0000 (07:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257155 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/AsmWriterEmitter.cpp

index cc74f9ebceced78dc3c901482325b7b5a53dddb9..7b0a2fb79290bad303729b5d8d4ff42acf281beb 100644 (file)
@@ -159,11 +159,10 @@ FindUniqueOperandCommands(std::vector<std::string> &UniqueOperandCommands,
     if (!Inst)
       continue; // PHI, INLINEASM, CFI_INSTRUCTION, etc.
 
     if (!Inst)
       continue; // PHI, INLINEASM, CFI_INSTRUCTION, etc.
 
-    std::string Command;
     if (Inst->Operands.empty())
       continue;   // Instruction already done.
 
     if (Inst->Operands.empty())
       continue;   // Instruction already done.
 
-    Command = "    " + Inst->Operands[0].getCode() + "\n";
+    std::string Command = "    " + Inst->Operands[0].getCode() + "\n";
 
     // Check to see if we already have 'Command' in UniqueOperandCommands.
     // If not, add it.
 
     // Check to see if we already have 'Command' in UniqueOperandCommands.
     // If not, add it.
@@ -178,7 +177,7 @@ FindUniqueOperandCommands(std::vector<std::string> &UniqueOperandCommands,
       }
     if (!FoundIt) {
       InstIdxs[i] = UniqueOperandCommands.size();
       }
     if (!FoundIt) {
       InstIdxs[i] = UniqueOperandCommands.size();
-      UniqueOperandCommands.push_back(Command);
+      UniqueOperandCommands.push_back(std::move(Command));
       InstrsForCase.push_back(Inst->CGI->TheDef->getName());
 
       // This command matches one operand so far.
       InstrsForCase.push_back(Inst->CGI->TheDef->getName());
 
       // This command matches one operand so far.