Skip to content

Commit 3ebc935

Browse files
[ADT] Simplify control flow in ImmutableSet (NFC) (#165133)
A conventional "if" statement is easier to read than the do-while(false) pattern used here.
1 parent be29f0d commit 3ebc935

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

llvm/include/llvm/ADT/ImmutableSet.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -635,9 +635,7 @@ class ImutAVLFactory {
635635
// if find a collision compare those trees by their contents.
636636
unsigned digest = TNew->computeDigest();
637637
TreeTy *&entry = Cache[maskCacheIndex(digest)];
638-
do {
639-
if (!entry)
640-
break;
638+
if (entry) {
641639
for (TreeTy *T = entry ; T != nullptr; T = T->next) {
642640
// Compare the Contents('T') with Contents('TNew')
643641
typename TreeTy::iterator TI = T->begin(), TE = T->end();
@@ -653,7 +651,6 @@ class ImutAVLFactory {
653651
entry->prev = TNew;
654652
TNew->next = entry;
655653
}
656-
while (false);
657654

658655
entry = TNew;
659656
TNew->IsCanonicalized = true;

0 commit comments

Comments
 (0)