Mercurial > hg > CbC > CbC_llvm
diff clang/test/Sema/attr-musttail.m @ 207:2e18cbf3894f
LLVM12
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 08 Jun 2021 06:07:14 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clang/test/Sema/attr-musttail.m Tue Jun 08 06:07:14 2021 +0900 @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-objc-root-class -verify %s + +void TestObjcBlock(void) { + void (^x)(void) = ^(void) { + __attribute__((musttail)) return TestObjcBlock(); // expected-error{{'musttail' attribute cannot be used from a block}} + }; + __attribute__((musttail)) return x(); +} + +void ReturnsVoid(void); +void TestObjcBlockVar(void) { + __block int i = 0; // expected-note{{jump exits scope of __block variable}} + __attribute__((musttail)) return ReturnsVoid(); // expected-error{{cannot perform a tail call from this return statement}} +} + +__attribute__((objc_root_class)) +@interface TestObjcClass +@end + +@implementation TestObjcClass + +- (void)testObjCMethod { + __attribute__((musttail)) return ReturnsVoid(); // expected-error{{'musttail' attribute cannot be used from an Objective-C function}} +} + +@end