Repository navigation
Commit 38418ba
committed
NeverDestroyed needs std::launder
https://bugs.webkit.org/show_bug.cgi?id=328643
Reviewed by Darin Adler and Geoffrey Garen.
NeverDestroyed and LazyNeverDestroyed construct an object in raw storage with placement new and
later access it through a reinterpret_cast'ed pointer. Wrap those accesses in std::launder so that
the pointer is guaranteed to refer to the constructed object.
NeverDestroyed and LazyNeverDestroyed still use the unlaundered storage pointer for placement new
since std::launder requires an object to be alive at the address.
* Source/WTF/wtf/NeverDestroyed.h:
(WTF::NeverDestroyed::NeverDestroyed):
(WTF::NeverDestroyed::operator T&):
(WTF::NeverDestroyed::get):
(WTF::NeverDestroyed::operator->):
(WTF::NeverDestroyed::operator const T& const):
(WTF::NeverDestroyed::get const):
(WTF::NeverDestroyed::operator-> const):
(WTF::NeverDestroyed::objectPointer const): Added.
(WTF::LazyNeverDestroyed::operator T&):
(WTF::LazyNeverDestroyed::get):
(WTF::LazyNeverDestroyed::operator->):
(WTF::LazyNeverDestroyed::operator const T& const):
(WTF::LazyNeverDestroyed::get const):
(WTF::LazyNeverDestroyed::operator-> const):
(WTF::LazyNeverDestroyed::objectPointer const): Added.
Canonical link: https://commits.webkit.org/324609@main1 parent c1276fc commit 38418ba
1 file changed
Lines changed: 20 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
81 | | - | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | | - | |
85 | | - | |
| 85 | + | |
| 86 | + | |
86 | 87 | | |
87 | | - | |
| 88 | + | |
88 | 89 | | |
89 | | - | |
90 | | - | |
| 90 | + | |
| 91 | + | |
91 | 92 | | |
92 | | - | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| |||
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
103 | 107 | | |
104 | 108 | | |
105 | 109 | | |
| |||
131 | 135 | | |
132 | 136 | | |
133 | 137 | | |
134 | | - | |
135 | | - | |
| 138 | + | |
| 139 | + | |
136 | 140 | | |
137 | | - | |
| 141 | + | |
138 | 142 | | |
139 | | - | |
140 | | - | |
| 143 | + | |
| 144 | + | |
141 | 145 | | |
142 | | - | |
| 146 | + | |
143 | 147 | | |
144 | 148 | | |
145 | 149 | | |
| |||
160 | 164 | | |
161 | 165 | | |
162 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
163 | 170 | | |
164 | 171 | | |
165 | 172 | | |
| |||
0 commit comments