summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2015-05-16 05:42:03 +0000
committerCraig Topper <craig.topper@gmail.com>2015-05-16 05:42:03 +0000
commit6ee494b6775043bad29d07eb06ceaeb10055d5ee (patch)
tree79249af0b5eba4590f5c31c69afb7cdc2d6a20c0 /llvm/lib
parent352b89c460cc4827d0458925006a2d04686807db (diff)
downloadbcm5719-llvm-6ee494b6775043bad29d07eb06ceaeb10055d5ee.tar.gz
bcm5719-llvm-6ee494b6775043bad29d07eb06ceaeb10055d5ee.zip
[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
llvm-svn: 237511
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/TableGen/Record.cpp11
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);
}
OpenPOWER on IntegriCloud