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 10
10
#ifndef __LIFETIMEBOUND_H
11
11
#define __LIFETIMEBOUND_H
12
12
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
13
22
#define __lifetimebound __attribute__ ((lifetimebound))
23
+ #endif
14
24
25
+ #if __use_cpp_spelling(clang::lifetime_capture_by)
26
+ #define __lifetime_capture_by (X ) [[clang::lifetime_capture_by(X)]]
27
+ #else
15
28
#define __lifetime_capture_by (X ) __attribute__((lifetime_capture_by(X)))
29
+ #endif
16
30
31
+ #if __use_cpp_spelling(clang::noescape)
32
+ #define __noescape [[clang::noescape]]
33
+ #else
17
34
#define __noescape __attribute__ ((noescape))
35
+ #endif
18
36
19
37
#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 6
6
7
7
struct has_lifetimebound_method {
8
8
const char * get_ptr (char * ptr __lifetimebound) const ;
9
+ const char * get_ptr () const __lifetimebound;
9
10
};
10
11
11
12
struct has_lifetime_capture_by_method {
You can’t perform that action at this time.
0 commit comments