[llvm] r237511 - [TableGen] Restructure a loop to make it exit early instead of skipping a portion of the body based on what will also be the terminating condition. NFC
Craig Topper
craig.topper at gmail.com
Fri May 15 22:42:05 PDT 2015
Author: ctopper
Date: Sat May 16 00:42:03 2015
New Revision: 237511
URL: http://llvm.org/viewvc/llvm-project?rev=237511&view=rev
Log:
[TableGen] Restructure a loop to make it exit early instead of skipping a portion of the body based on what will also be the terminating condition. NFC
Modified:
llvm/trunk/lib/TableGen/Record.cpp
Modified: llvm/trunk/lib/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Record.cpp?rev=237511&r1=237510&r2=237511&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Record.cpp (original)
+++ llvm/trunk/lib/TableGen/Record.cpp Sat May 16 00:42:03 2015
@@ -1113,12 +1113,13 @@ Init *TernOpInit::Fold(Record *CurRec, M
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);
}
More information about the llvm-commits
mailing list