[llvm] r256624 - [TableGen] Use 'size_t' instead of 'unsigned' to better match the argument types of addAsmOperand. Simplify some code by using StringRef::find instead of std::find. These were previously done in r247527 and r247528, but another commit seems to have erased them. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 29 22:00:16 PST 2015
Author: ctopper
Date: Wed Dec 30 00:00:15 2015
New Revision: 256624
URL: http://llvm.org/viewvc/llvm-project?rev=256624&view=rev
Log:
[TableGen] Use 'size_t' instead of 'unsigned' to better match the argument types of addAsmOperand. Simplify some code by using StringRef::find instead of std::find. These were previously done in r247527 and r247528, but another commit seems to have erased them. NFC
Modified:
llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=256624&r1=256623&r2=256624&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Wed Dec 30 00:00:15 2015
@@ -882,11 +882,11 @@ void MatchableInfo::addAsmOperand(size_t
void MatchableInfo::tokenizeAsmString(const AsmMatcherInfo &Info,
AsmVariantInfo const &Variant) {
StringRef String = AsmString;
- unsigned Prev = 0;
+ size_t Prev = 0;
bool InTok = false;
std::string Separators = Variant.TokenizingCharacters +
Variant.SeparatorCharacters;
- for (unsigned i = 0, e = String.size(); i != e; ++i) {
+ for (size_t i = 0, e = String.size(); i != e; ++i) {
if(Variant.BreakCharacters.find(String[i]) != std::string::npos) {
if(InTok) {
addAsmOperand(Prev, i, Separators);
@@ -936,9 +936,9 @@ void MatchableInfo::tokenizeAsmString(co
break;
}
- StringRef::iterator End = std::find(String.begin() + i, String.end(),'}');
- assert(End != String.end() && "Missing brace in operand reference!");
- size_t EndPos = End - String.begin();
+ size_t EndPos = String.find('}', i);
+ assert(EndPos != StringRef::npos &&
+ "Missing brace in operand reference!");
addAsmOperand(i, EndPos+1, Separators);
Prev = EndPos + 1;
i = EndPos;
More information about the llvm-commits
mailing list