File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1010#ifndef __LIFETIMEBOUND_H
1111#define __LIFETIMEBOUND_H
1212
13+ #if defined(__cplusplus) && defined(__has_cpp_attribute)
14+ #define __use_cpp_spelling (x ) __has_cpp_attribute(x)
15+ #else
16+ #define __use_cpp_spelling (x ) 0
17+ #endif
18+
19+ #if __use_cpp_spelling(clang::lifetimebound)
20+ #define __lifetimebound [[clang::lifetimebound]]
21+ #else
1322#define __lifetimebound __attribute__ ((lifetimebound))
23+ #endif
1424
25+ #if __use_cpp_spelling(clang::lifetime_capture_by)
26+ #define __lifetime_capture_by (X ) [[clang::lifetime_capture_by(X)]]
27+ #else
1528#define __lifetime_capture_by (X ) __attribute__((lifetime_capture_by(X)))
29+ #endif
1630
31+ #if __use_cpp_spelling(clang::noescape)
32+ #define __noescape [[clang::noescape]]
33+ #else
1734#define __noescape __attribute__ ((noescape))
35+ #endif
1836
1937#endif /* __LIFETIMEBOUND_H */
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 foo {};
8+
9+ struct foo * get_foo (char * ptr __lifetimebound );
10+
11+ void non_escaping (char * ptr __noescape );
Original file line number Diff line number Diff line change 66
77struct has_lifetimebound_method {
88 const char * get_ptr (char * ptr __lifetimebound) const ;
9+ const char * get_ptr () const __lifetimebound;
910};
1011
1112struct has_lifetime_capture_by_method {
You can’t perform that action at this time.
0 commit comments