diff options
Diffstat (limited to 'llvm/lib/TableGen/Record.cpp')
-rw-r--r-- | llvm/lib/TableGen/Record.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp index 1b5a902dea6..0ce7b6f5d98 100644 --- a/llvm/lib/TableGen/Record.cpp +++ b/llvm/lib/TableGen/Record.cpp @@ -1113,12 +1113,13 @@ Init *TernOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) const { std::string::size_type found; std::string::size_type idx = 0; - do { + while (true) { found = Val.find(LHSs->getValue(), idx); - if (found != std::string::npos) - Val.replace(found, LHSs->getValue().size(), MHSs->getValue()); - idx = found + MHSs->getValue().size(); - } while (found != std::string::npos); + if (found == std::string::npos) + break; + Val.replace(found, LHSs->getValue().size(), MHSs->getValue()); + idx = found + MHSs->getValue().size(); + } return StringInit::get(Val); } |