Commit 14b8a4e
PR #1625: absl::is_trivially_relocatable now respects assignment operators
Imported from GitHub PR #1625
Trivial relocatability also requires that the type not do anything weird with its assignment operator; update the type-trait to reflect this. (This is the definition used by BSL, Folly, HPX, Thrust, Parlay, Amadeus, and P1144.)
This is important if we want to use `absl::is_trivially_relocatable` as a gate for memcpy optimizations in `inlined_vector::erase` and/or `inlined_vector::swap`, because in those cases relocation is used to replace part of a sequence involving assignment; the optimization requires an assignment operator that behaves value-semantically.
Clang's builtin currently fails to check the assignment operator, so we stop using it entirely for now. We already refused to use it on Win32, Win64, and Apple, for various unrelated reasons. I'm working on giving Clang's builtin the behavior that would let us re-enable it here.
Assume that any compiler providing both `__cpp_impl_trivially_relocatable` and a builtin `__is_trivially_relocatable(T)` will use the appropriate (P1144) definition for its builtin. Right now there's only one such compiler (the P1144 reference implementation, which forks Clang), so this is largely a moot point, but I'm being optimistic.
Merge d943abd into 34604d5
Merging this change closes #1625
COPYBARA_INTEGRATE_REVIEW=#1625 from Quuxplusone:trivially-relocatable d943abd
PiperOrigin-RevId: 607977323
Change-Id: I6436a60326c6d1064bdd71ec2e15b86b7a29efd41 parent 8a3caf7 commit 14b8a4e
2 files changed
+70
-39
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
156 | | - | |
| 155 | + | |
| 156 | + | |
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
318 | | - | |
319 | 318 | | |
320 | 319 | | |
321 | 320 | | |
322 | 321 | | |
323 | 322 | | |
324 | | - | |
325 | | - | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
326 | 326 | | |
327 | 327 | | |
328 | | - | |
| 328 | + | |
| 329 | + | |
329 | 330 | | |
330 | 331 | | |
331 | 332 | | |
332 | 333 | | |
333 | | - | |
| 334 | + | |
334 | 335 | | |
335 | 336 | | |
336 | 337 | | |
| |||
463 | 464 | | |
464 | 465 | | |
465 | 466 | | |
466 | | - | |
467 | 467 | | |
| 468 | + | |
468 | 469 | | |
469 | 470 | | |
470 | 471 | | |
471 | 472 | | |
472 | 473 | | |
473 | 474 | | |
474 | | - | |
475 | | - | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
476 | 478 | | |
477 | | - | |
478 | | - | |
479 | | - | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
480 | 484 | | |
481 | 485 | | |
482 | 486 | | |
| |||
509 | 513 | | |
510 | 514 | | |
511 | 515 | | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
512 | 522 | | |
513 | 523 | | |
514 | | - | |
515 | | - | |
516 | | - | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
517 | 527 | | |
518 | 528 | | |
519 | 529 | | |
520 | 530 | | |
521 | 531 | | |
522 | | - | |
523 | | - | |
| 532 | + | |
| 533 | + | |
524 | 534 | | |
525 | | - | |
526 | | - | |
527 | | - | |
| 535 | + | |
528 | 536 | | |
529 | 537 | | |
530 | 538 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
365 | | - | |
366 | | - | |
| 365 | + | |
| 366 | + | |
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
| |||
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
385 | | - | |
386 | | - | |
| 385 | + | |
| 386 | + | |
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
| |||
580 | 580 | | |
581 | 581 | | |
582 | 582 | | |
583 | | - | |
| 583 | + | |
584 | 584 | | |
585 | 585 | | |
586 | 586 | | |
| |||
664 | 664 | | |
665 | 665 | | |
666 | 666 | | |
667 | | - | |
668 | | - | |
| 667 | + | |
669 | 668 | | |
670 | 669 | | |
671 | 670 | | |
| |||
751 | 750 | | |
752 | 751 | | |
753 | 752 | | |
754 | | - | |
| 753 | + | |
755 | 754 | | |
756 | 755 | | |
757 | 756 | | |
| |||
780 | 779 | | |
781 | 780 | | |
782 | 781 | | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
783 | 806 | | |
784 | 807 | | |
785 | 808 | | |
| |||
794 | 817 | | |
795 | 818 | | |
796 | 819 | | |
797 | | - | |
798 | | - | |
799 | | - | |
800 | | - | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
801 | 824 | | |
802 | | - | |
803 | | - | |
804 | | - | |
| 825 | + | |
| 826 | + | |
805 | 827 | | |
806 | 828 | | |
807 | 829 | | |
808 | | - | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
809 | 833 | | |
810 | 834 | | |
811 | 835 | | |
| |||
824 | 848 | | |
825 | 849 | | |
826 | 850 | | |
827 | | - | |
| 851 | + | |
828 | 852 | | |
829 | 853 | | |
830 | 854 | | |
| |||
840 | 864 | | |
841 | 865 | | |
842 | 866 | | |
843 | | - | |
844 | 867 | | |
0 commit comments