File tree Expand file tree Collapse file tree 4 files changed +48
-1
lines changed Expand file tree Collapse file tree 4 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -329,6 +329,9 @@ set(files
329
329
# TO_UPSTREAM(BoundsSafety)
330
330
list (APPEND files ptrcheck.h )
331
331
332
+ # TO_UPSTREAM(Lifetimebound)
333
+ list (APPEND files lifetimebound.h )
334
+
332
335
set (cuda_wrapper_files
333
336
cuda_wrappers/algorithm
334
337
cuda_wrappers/cmath
Original file line number Diff line number Diff line change
1
+ /*===---- lifetimebound.h - Lifetime attributes -----------------------------===
2
+ *
3
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ * See https://llvm.org/LICENSE.txt for license information.
5
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ *
7
+ *===------------------------------------------------------------------------===
8
+ */
9
+
10
+ #ifndef __LIFETIMEBOUND_H
11
+ #define __LIFETIMEBOUND_H
12
+
13
+ #define __lifetimebound __attribute__((lifetimebound))
14
+
15
+ #define __lifetime_capture_by (X ) __attribute__((lifetime_capture_by(X)))
16
+
17
+ #define __noescape __attribute__((noescape))
18
+
19
+ #endif /* __LIFETIMEBOUND_H */
Original file line number Diff line number Diff line change @@ -332,4 +332,11 @@ module ptrcheck {
332
332
header "ptrcheck.h"
333
333
export *
334
334
}
335
- /* TO_UPSTREAM(BoundsSafety) OFF */
335
+ /* TO_UPSTREAM(BoundsSafety) OFF */
336
+
337
+ /* TO_UPSTREAM(Lifetimebound) ON */
338
+ module lifetimebound {
339
+ header "lifetimebound.h"
340
+ export *
341
+ }
342
+ /* TO_UPSTREAM(Lifetimebound) OFF */
Original file line number Diff line number Diff line change
1
+ // RUN: %clang_cc1 -fsyntax-only -verify %s
2
+ // expected-no-diagnostics
3
+
4
+ // Verify that we can include <lifetimebound.h>
5
+ #include < lifetimebound.h>
6
+
7
+ struct has_lifetimebound_method {
8
+ const char * get_ptr (char * ptr __lifetimebound) const ;
9
+ };
10
+
11
+ struct has_lifetime_capture_by_method {
12
+ void take_ptr (char * ptr __lifetime_capture_by (this ));
13
+ void take_ptr (has_lifetimebound_method a, char * ptr __lifetime_capture_by (a));
14
+ };
15
+
16
+ struct has_noescape_method {
17
+ void takes_noescape (char * ptr __noescape);
18
+ };
You can’t perform that action at this time.
0 commit comments