Commit 75eb8c7
committed
[ADT] Make Zippy more iterator-like for lifetime safety
@geoffromer identifier/encountered a lifetime issue when using
concat+zip, zip would return by value, concat would take references to
that value and use them in its result after they had expired.
This is a common problem with range adapters and the lifetime of values.
But it's also non-conforming with the C++ iterator requirements, I think
- partly because op-> should be supported (which I haven't done here)
and that basically has to return by pointer.
So the best thing is to stash a value in the iterator and return a
pointer/reference to that.1 parent 23da169 commit 75eb8c7
File tree
3 files changed
+26
-20
lines changed- llvm
- include/llvm/ADT
- lib/Transforms/Vectorize
- unittests/ADT
3 files changed
+26
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
704 | 704 | | |
705 | 705 | | |
706 | 706 | | |
| 707 | + | |
707 | 708 | | |
708 | 709 | | |
709 | | - | |
710 | | - | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
711 | 713 | | |
712 | 714 | | |
713 | 715 | | |
| |||
728 | 730 | | |
729 | 731 | | |
730 | 732 | | |
731 | | - | |
| 733 | + | |
732 | 734 | | |
733 | 735 | | |
734 | 736 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9991 | 9991 | | |
9992 | 9992 | | |
9993 | 9993 | | |
9994 | | - | |
| 9994 | + | |
9995 | 9995 | | |
9996 | 9996 | | |
9997 | 9997 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
| 485 | + | |
489 | 486 | | |
490 | | - | |
491 | 487 | | |
492 | 488 | | |
493 | | - | |
494 | | - | |
495 | 489 | | |
496 | 490 | | |
497 | 491 | | |
498 | | - | |
499 | 492 | | |
500 | 493 | | |
501 | | - | |
502 | | - | |
| 494 | + | |
503 | 495 | | |
504 | 496 | | |
505 | | - | |
506 | | - | |
507 | 497 | | |
508 | 498 | | |
509 | 499 | | |
510 | 500 | | |
511 | 501 | | |
512 | | - | |
513 | | - | |
| 502 | + | |
514 | 503 | | |
515 | 504 | | |
516 | | - | |
517 | | - | |
518 | 505 | | |
519 | 506 | | |
520 | 507 | | |
| |||
643 | 630 | | |
644 | 631 | | |
645 | 632 | | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
646 | 650 | | |
647 | 651 | | |
648 | 652 | | |
| |||
0 commit comments