[llvm] r257155 - [TableGen] Combine variable declaration and initialization. Move a string into a vector instead of copying. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 7 23:06:29 PST 2016


Author: ctopper
Date: Fri Jan  8 01:06:29 2016
New Revision: 257155

URL: http://llvm.org/viewvc/llvm-project?rev=257155&view=rev
Log:
[TableGen] Combine variable declaration and initialization. Move a string into a vector instead of copying. NFC

Modified:
    llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp

Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=257155&r1=257154&r2=257155&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Fri Jan  8 01:06:29 2016
@@ -159,11 +159,10 @@ FindUniqueOperandCommands(std::vector<st
     if (!Inst)
       continue; // PHI, INLINEASM, CFI_INSTRUCTION, etc.
 
-    std::string Command;
     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.
@@ -178,7 +177,7 @@ FindUniqueOperandCommands(std::vector<st
       }
     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.




More information about the llvm-commits mailing list