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 @@ -290,6 +290,9 @@ set(files
290290# TO_UPSTREAM(BoundsSafety)
291291list (APPEND files ptrcheck.h)
292292
293+ # TO_UPSTREAM(Lifetimebound)
294+ list (APPEND files lifetimebound.h)
295+
293296set (cuda_wrapper_files
294297 cuda_wrappers/algorithm
295298 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 @@ -334,4 +334,11 @@ module ptrcheck {
334334 header "ptrcheck.h"
335335 export *
336336}
337- /* TO_UPSTREAM(BoundsSafety) OFF */
337+ /* TO_UPSTREAM(BoundsSafety) OFF */
338+
339+ /* TO_UPSTREAM(Lifetimebound) ON */
340+ module lifetimebound {
341+ header "lifetimebound.h"
342+ export *
343+ }
344+ /* 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