Commit 0f04955
Automerge: [ADT] Refactor StringMap iterators (NFC) (#156137)
StringMap has four iterator classes:
- StringMapIterBase
- StringMapIterator
- StringMapConstIterator
- StringMapKeyIterator
This patch consolidates the first three into one class, namely
StringMapIterBase, adds a boolean template parameter to indicate
desired constness, and then use "using" directives to specialize the
common class:
using const_iterator = StringMapIterBase<ValueTy, true>;
using iterator = StringMapIterBase<ValueTy, false>;
just like how we simplified DenseMapIterator.
Remarks:
- This patch drops CRTP and iterator_facade_base for simplicity. For
fairly simple forward iterators, iterator_facade_base doesn't buy us
much. We just have to write a few "using" directives and operator!=
manually.
- StringMapIterBase has a SFINAE-based constructor to construct a
const iterator from a non-const one just like DenseMapIterator.
- We now rely on compiler-generated copy and assignment operators.File tree
4 files changed
+91
-64
lines changed- clang-tools-extra/clang-tidy/fuchsia
- clang/lib/Driver
- llvm
- include/llvm/ADT
- unittests/ADT
4 files changed
+91
-64
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1936 | 1936 | | |
1937 | 1937 | | |
1938 | 1938 | | |
1939 | | - | |
1940 | | - | |
| 1939 | + | |
1941 | 1940 | | |
1942 | 1941 | | |
1943 | 1942 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
221 | | - | |
| 220 | + | |
| 221 | + | |
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| |||
431 | 431 | | |
432 | 432 | | |
433 | 433 | | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
| 434 | + | |
439 | 435 | | |
440 | 436 | | |
441 | 437 | | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
442 | 445 | | |
443 | 446 | | |
444 | 447 | | |
| |||
448 | 451 | | |
449 | 452 | | |
450 | 453 | | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
| 454 | + | |
| 455 | + | |
459 | 456 | | |
460 | | - | |
| 457 | + | |
461 | 458 | | |
462 | 459 | | |
463 | | - | |
| 460 | + | |
464 | 461 | | |
465 | 462 | | |
466 | | - | |
467 | | - | |
| 463 | + | |
| 464 | + | |
468 | 465 | | |
469 | 466 | | |
470 | 467 | | |
471 | 468 | | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
476 | 473 | | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | 474 | | |
492 | | - | |
493 | | - | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
494 | 478 | | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | 479 | | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
511 | 483 | | |
512 | 484 | | |
513 | | - | |
514 | | - | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
515 | 489 | | |
516 | 490 | | |
517 | 491 | | |
518 | 492 | | |
519 | 493 | | |
520 | 494 | | |
521 | | - | |
| 495 | + | |
522 | 496 | | |
523 | 497 | | |
524 | | - | |
| 498 | + | |
525 | 499 | | |
526 | 500 | | |
527 | 501 | | |
528 | 502 | | |
529 | | - | |
| 503 | + | |
530 | 504 | | |
531 | 505 | | |
532 | 506 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
693 | 693 | | |
694 | 694 | | |
695 | 695 | | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
696 | 750 | | |
0 commit comments