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
let _:MutableSpan<CInt>= dd.nonescapingLifetimebound(73)
24
+
25
+
#if VERIFY
26
+
aa.countedSelf(&p)
27
+
a.basic(&p) // expected-error{{cannot use mutating member on immutable value: 'a' is a 'let' constant}}
28
+
#endif
29
+
}
30
+
31
+
//--- Inputs/instance.h
32
+
#include <ptrcheck.h>
33
+
#include <lifetimebound.h>
34
+
35
+
#define SWIFT_IMMORTAL_REFERENCE \
36
+
__attribute__((swift_attr("import_reference"))) \
37
+
__attribute__((swift_attr("retain:immortal"))) \
38
+
__attribute__((swift_attr("release:immortal")))
39
+
40
+
#define SWIFT_NONESCAPABLE \
41
+
__attribute__((swift_attr("~Escapable")))
42
+
43
+
structA{};
44
+
structB{ int placeholder; };
45
+
structSWIFT_IMMORTAL_REFERENCE C {};
46
+
structSWIFT_NONESCAPABLE D {};
47
+
48
+
void basic(struct A *a, int * __counted_by(len) p __noescape, int len) __attribute__((swift_name("A.basic(self:_:_:)")));
49
+
50
+
void renamed(struct A *a, int * __counted_by(len) p __noescape, int len) __attribute__((swift_name("A.bar(self:_:_:)")));
51
+
52
+
void countedSelf(struct A * __counted_by(len)
53
+
a, // expected-warning{{bounds attribute '__counted_by' ignored on parameter mapped to 'self'}}
54
+
int * __counted_by(len) p __noescape, int len)
55
+
__attribute__((
56
+
swift_name // expected-note{{swift_name maps free function to instance method here}}
57
+
("A.countedSelf(self:_:_:)")));
58
+
59
+
void constSelf(const struct A *a, int * __counted_by(len) p __noescape, int len) __attribute__((swift_name("A.constSelf(self:_:_:)")));
60
+
61
+
void valSelf(struct A a, int * __counted_by(len) p __noescape, int len) __attribute__((swift_name("A.valSelf(self:_:_:)")));
62
+
63
+
void wrongSelf(struct B b, int * __counted_by(len) p __noescape, int len) __attribute__((swift_name("A.wrongSelf(self:_:_:)")));
64
+
65
+
void refSelf(struct C *c, int * __counted_by(len) p __noescape, int len) __attribute__((swift_name("C.refSelf(self:_:_:)")));
66
+
67
+
int * __counted_by(len) lifetimeBoundSelf(struct A a __lifetimebound, int len) __attribute__((swift_name("A.lifetimeBoundSelf(self:_:)")));
68
+
69
+
void nonescaping(const struct D *d, int * __counted_by(len) p __noescape, int len) __attribute__((swift_name("D.nonescaping(self:_:_:)")));
70
+
71
+
int * __counted_by(len) nonescapingLifetimebound(struct D *d __lifetimebound, int len) __attribute__((swift_name("D.nonescapingLifetimebound(self:_:)")));
0 commit comments