diff options
author | Craig Topper <craig.topper@gmail.com> | 2016-01-17 08:05:30 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2016-01-17 08:05:30 +0000 |
commit | a99859d7da46f445717f7e7bf22deb5bc64ab3d2 (patch) | |
tree | 3081bf8d5cf92ea0313f934a8f705b2ad9a28714 /llvm/utils | |
parent | 413111952a3fd359d131f2142754b1181b3e7831 (diff) | |
download | bcm5719-llvm-a99859d7da46f445717f7e7bf22deb5bc64ab3d2.tar.gz bcm5719-llvm-a99859d7da46f445717f7e7bf22deb5bc64ab3d2.zip |
[TableGen] Use std::find instead of a manual loop. NFC
llvm-svn: 258004
Diffstat (limited to 'llvm/utils')
-rw-r--r-- | llvm/utils/TableGen/AsmWriterEmitter.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/llvm/utils/TableGen/AsmWriterEmitter.cpp b/llvm/utils/TableGen/AsmWriterEmitter.cpp index 6c8ebfb5d21..6ebb3efe672 100644 --- a/llvm/utils/TableGen/AsmWriterEmitter.cpp +++ b/llvm/utils/TableGen/AsmWriterEmitter.cpp @@ -169,16 +169,14 @@ FindUniqueOperandCommands(std::vector<std::string> &UniqueOperandCommands, // Check to see if we already have 'Command' in UniqueOperandCommands. // If not, add it. - bool FoundIt = false; - for (unsigned idx = 0, e = UniqueOperandCommands.size(); idx != e; ++idx) - if (UniqueOperandCommands[idx] == Command) { - InstIdxs[i] = idx; - InstrsForCase[idx] += ", "; - InstrsForCase[idx] += Inst->CGI->TheDef->getName(); - FoundIt = true; - break; - } - if (!FoundIt) { + auto I = std::find(UniqueOperandCommands.begin(), + UniqueOperandCommands.end(), Command); + if (I != UniqueOperandCommands.end()) { + size_t idx = I - UniqueOperandCommands.begin(); + InstIdxs[i] = idx; + InstrsForCase[idx] += ", "; + InstrsForCase[idx] += Inst->CGI->TheDef->getName(); + } else { InstIdxs[i] = UniqueOperandCommands.size(); UniqueOperandCommands.push_back(std::move(Command)); InstrsForCase.push_back(Inst->CGI->TheDef->getName()); |