Debian Codegraph @

clang/test/Sema/attr-musttail.m

raw
1 // RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-objc-root-class -verify %s
2
3 void TestObjcBlock(void) {
4 void (^x)(void) = ^(void) {
5 __attribute__((musttail)) return TestObjcBlock(); // expected-error{{'musttail' attribute cannot be used from a block}}
6 };
7 __attribute__((musttail)) return x();
8 }
9
10 void ReturnsVoid(void);
11 void TestObjcBlockVar(void) {
12 __block int i = 0; // expected-note{{jump exits scope of __block variable}}
13 __attribute__((musttail)) return ReturnsVoid(); // expected-error{{cannot perform a tail call from this return statement}}
14 }
15
16 __attribute__((objc_root_class))
17 @interface TestObjcClass
18 @end
19
20 @implementation TestObjcClass
21
22 - (void)testObjCMethod {
23 __attribute__((musttail)) return ReturnsVoid(); // expected-error{{'musttail' attribute cannot be used from an Objective-C function}}
24 }
25
26 @end