You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
captureInt(1, // expected-warning {{object whose reference is captured by 'x' will be destroyed at the end of the full-expression}}
26
17
x);
27
-
captureRValInt(1, x); // expected-warning {{object whose reference is captured by 'x'}}
18
+
captureRValInt(1, x); // expected-warning {{object whose reference is captured by 'x' will be destroyed at the end of the full-expression}}
28
19
captureInt(local, x);
29
20
noCaptureInt(1, x);
30
21
noCaptureInt(local, x);
@@ -41,10 +32,10 @@ void captureRValString(std::string &&s [[clang::lifetime_capture_by(x)]], X &x);
41
32
42
33
voiduse() {
43
34
std::string local_string;
44
-
captureString(std::string(), x); // expected-warning {{object whose reference is captured by 'x'}}
35
+
captureString(std::string(), x); // expected-warning {{object whose reference is captured by 'x' will be destroyed at the end of the full-expression}}
45
36
captureString(local_string, x);
46
37
captureRValString(std::move(local_string), x);
47
-
captureRValString(std::string(), x); // expected-warning {{object whose reference is captured by 'x'}}
38
+
captureRValString(std::string(), x); // expected-warning {{object whose reference is captured by 'x' will be destroyed at the end of the full-expression}}
48
39
}
49
40
} // namespace capture_string
50
41
@@ -57,34 +48,39 @@ void captureStringView(std::string_view s [[clang::lifetime_capture_by(x)]], X &
57
48
voidcaptureRValStringView(std::string_view &&sv [[clang::lifetime_capture_by(x)]], X &x);
58
49
voidnoCaptureStringView(std::string_view sv, X &x);
59
50
51
+
std::string_view getLifetimeBoundView(const std::string& s [[clang::lifetimebound]]);
captureRValStringView(std::string(), x); // expected-warning {{object whose reference is captured by 'x'}}
66
+
captureRValStringView(std::string(), x); // expected-warning {{object whose reference is captured by 'x' will be destroyed at the end of the full-expression}}
captureRValStringView(getLifetimeBoundView(std::string()), x); // expected-warning {{object whose reference is captured by 'x'}}
77
+
captureRValStringView(getLifetimeBoundView(std::string()), x); // expected-warning {{object whose reference is captured by 'x' will be destroyed at the end of the full-expression}}
captureStringView(getLifetimeBoundString(std::string()), x); // expected-warning {{object whose reference is captured by 'x'}}
85
-
captureStringView(getLifetimeBoundString(getLifetimeBoundView(std::string())), x); // expected-warning {{object whose reference is captured by 'x'}}
80
+
captureStringView(getLifetimeBoundString(std::string()), x); // expected-warning {{object whose reference is captured by 'x' will be destroyed at the end of the full-expression}}
81
+
captureStringView(getLifetimeBoundString(getLifetimeBoundView(std::string())), x); // expected-warning {{object whose reference is captured by 'x' will be destroyed at the end of the full-expression}}
std::string() // expected-warning {{object whose reference is captured by 'x'}}
83
+
std::string() // expected-warning {{object whose reference is captured by 'x' will be destroyed at the end of the full-expression}}
88
84
)), x);
89
85
}
90
86
} // namespace capture_string_view
@@ -99,9 +95,9 @@ namespace capture_pointer {
99
95
structX {} x;
100
96
voidcapturePointer(const std::string* sp [[clang::lifetime_capture_by(x)]], X &x);
101
97
voiduse() {
102
-
capturePointer(getLifetimeBoundPointer(std::string()), x); // expected-warning {{object whose reference is captured by 'x'}}
98
+
capturePointer(getLifetimeBoundPointer(std::string()), x); // expected-warning {{object whose reference is captured by 'x' will be destroyed at the end of the full-expression}}
captureVector({1, 2, 3}, x); // expected-warning {{captured by 'x'}}
125
-
captureVector(std::vector<int>{}, x); // expected-warning {{captured by 'x'}}
120
+
captureVector({1, 2, 3}, x); // expected-warning {{object whose reference is captured by 'x' will be destroyed at the end of the full-expression}}
121
+
captureVector(std::vector<int>{}, x); // expected-warning {{object whose reference is captured by 'x' will be destroyed at the end of the full-expression}}
126
122
std::vector<int> local_vector;
127
123
captureVector(local_vector, x);
128
124
int local_array[2];
129
125
captureArray(local_array, x);
130
-
captureInitList({1, 2}, x); // expected-warning {{captured by 'x'}}
131
-
captureInitList(getLifetimeBoundInitList({1, 2}), x); // expected-warning {{captured by 'x'}}
126
+
captureInitList({1, 2}, x); // expected-warning {{object whose reference is captured by 'x' will be destroyed at the end of the full-expression}}
127
+
captureInitList(getLifetimeBoundInitList({1, 2}), x); // expected-warning {{object whose reference is captured by 'x' will be destroyed at the end of the full-expression}}
s.captureInt(1); // expected-warning {{object whose reference is captured by 's'}}
185
-
s.captureView(std::string()); // expected-warning {{captured by 's'}}
186
-
s.captureView(getLifetimeBoundView(std::string())); // expected-warning {{captured by 's'}}
187
-
s.captureView(getLifetimeBoundString(std::string())); // expected-warning {{captured by 's'}}
186
+
s.captureInt(1); // expected-warning {{object whose reference is captured by 's' will be destroyed at the end of the full-expression}}
187
+
s.captureView(std::string()); // expected-warning {{object whose reference is captured by 's' will be destroyed at the end of the full-expression}}
188
+
s.captureView(getLifetimeBoundView(std::string())); // expected-warning {{object whose reference is captured by 's' will be destroyed at the end of the full-expression}}
189
+
s.captureView(getLifetimeBoundString(std::string())); // expected-warning {{object whose reference is captured by 's' will be destroyed at the end of the full-expression}}
captureDefaultArg(x, std::string("temp")); // expected-warning {{captured by 'x'}}
220
-
captureDefaultArg(x, getLifetimeBoundView(std::string())); // expected-warning {{captured by 'x'}}
224
+
captureDefaultArg(x, std::string("temp")); // expected-warning {{object whose reference is captured by 'x' will be destroyed at the end of the full-expression}}
225
+
captureDefaultArg(x, getLifetimeBoundView(std::string())); // expected-warning {{object whose reference is captured by 'x' will be destroyed at the end of the full-expression}}
221
226
std::string local;
222
227
captureDefaultArg(x, local);
223
228
}
@@ -234,9 +239,9 @@ struct MySet {
234
239
};
235
240
voiduser_defined_containers() {
236
241
MySet<int> set_of_int;
237
-
set_of_int.insert(1); // expected-warning {{object whose reference is captured by 'set_of_int' will be destroyed}}
242
+
set_of_int.insert(1); // expected-warning {{object whose reference is captured by 'set_of_int' will be destroyed at the end of the full-expression}}
238
243
MySet<std::string_view> set_of_sv;
239
-
set_of_sv.insert(std::string()); // expected-warning {{object whose reference is captured by 'set_of_sv' will be destroyed}}
244
+
set_of_sv.insert(std::string()); // expected-warning {{object whose reference is captured by 'set_of_sv' will be destroyed at the end of the full-expression}}
std::string_view getLifetimeBoundView(const std::string& s [[clang::lifetimebound]]);
266
+
260
267
voiduse_container() {
261
268
std::string local;
262
269
263
270
MyVector<std::string> vector_of_string;
264
271
vector_of_string.push_back(std::string()); // Ok.
265
272
266
273
MyVector<std::string_view> vector_of_view;
267
-
vector_of_view.push_back(std::string()); // expected-warning {{object whose reference is captured by 'vector_of_view'}}
268
-
vector_of_view.push_back(getLifetimeBoundView(std::string())); // expected-warning {{captured by 'vector_of_view'}}
274
+
vector_of_view.push_back(std::string()); // expected-warning {{object whose reference is captured by 'vector_of_view' will be destroyed at the end of the full-expression}}
275
+
vector_of_view.push_back(getLifetimeBoundView(std::string())); // expected-warning {{object whose reference is captured by 'vector_of_view' will be destroyed at the end of the full-expression}}
269
276
270
277
MyVector<const std::string*> vector_of_pointer;
271
-
vector_of_pointer.push_back(getLifetimeBoundPointer(std::string())); // expected-warning {{captured by 'vector_of_pointer'}}
272
-
vector_of_pointer.push_back(getLifetimeBoundPointer(*getLifetimeBoundPointer(std::string()))); // expected-warning {{captured by 'vector_of_pointer'}}
278
+
vector_of_pointer.push_back(getLifetimeBoundPointer(std::string())); // expected-warning {{object whose reference is captured by 'vector_of_pointer' will be destroyed at the end of the full-expression}}
279
+
vector_of_pointer.push_back(getLifetimeBoundPointer(*getLifetimeBoundPointer(std::string()))); // expected-warning {{object whose reference is captured by 'vector_of_pointer' will be destroyed at the end of the full-expression}}
vector_of_my_view.push_back(std::string{}); // expected-warning {{object whose reference is captured by 'vector_of_my_view'}}
304
-
vector_of_my_view.push_back(getLifetimeBoundView(std::string{})); // expected-warning {{captured by 'vector_of_my_view'}}
305
-
vector_of_my_view.push_back(getLifetimeBoundString(getLifetimeBoundView(std::string{}))); // expected-warning {{captured by 'vector_of_my_view'}}
315
+
vector_of_my_view.push_back(std::string{}); // expected-warning {{object whose reference is captured by 'vector_of_my_view' will be destroyed at the end of the full-expression}}
316
+
vector_of_my_view.push_back(getLifetimeBoundView(std::string{})); // expected-warning {{object whose reference is captured by 'vector_of_my_view' will be destroyed at the end of the full-expression}}
317
+
vector_of_my_view.push_back(getLifetimeBoundString(getLifetimeBoundView(std::string{}))); // expected-warning {{object whose reference is captured by 'vector_of_my_view' will be destroyed at the end of the full-expression}}
vector_of_view.push_back(getOptionalS().value()); // expected-warning {{captured by 'vector_of_view'}}
334
+
vector_of_view.push_back(getOptionalS().value()); // expected-warning {{object whose reference is captured by 'vector_of_view' will be destroyed at the end of the full-expression}}
0 commit comments