comparison clang/test/Rewriter/finally.m @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents 1d019706d866
children
comparison
equal deleted inserted replaced
232:70dce7da266c 236:c4bab56944e8
1 // RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -fobjc-exceptions -verify %s -o - 1 // RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -fobjc-exceptions -verify %s -o -
2 2
3 int main() { 3 extern int printf(const char *, ...);
4
5 int main(void) {
4 @try { 6 @try {
5 printf("executing try"); // expected-warning{{implicitly declaring library function 'printf' with type 'int (const char *, ...)'}} \ 7 printf("executing try");
6 // expected-note{{include the header <stdio.h> or explicitly provide a declaration for 'printf'}}
7 return(0); // expected-warning{{rewriter doesn't support user-specified control flow semantics for @try/@finally (code may not execute properly)}} 8 return(0); // expected-warning{{rewriter doesn't support user-specified control flow semantics for @try/@finally (code may not execute properly)}}
8 } @finally { 9 } @finally {
9 printf("executing finally"); 10 printf("executing finally");
10 } 11 }
11 while (1) { 12 while (1) {
23 printf("executing finally"); 24 printf("executing finally");
24 } 25 }
25 return 0; 26 return 0;
26 } 27 }
27 28
28 void test_sync_with_implicit_finally() { 29 void test_sync_with_implicit_finally(void) {
29 id foo; 30 id foo;
30 @synchronized (foo) { 31 @synchronized (foo) {
31 return; // The rewriter knows how to generate code for implicit finally 32 return; // The rewriter knows how to generate code for implicit finally
32 } 33 }
33 } 34 }
34 35
35 void test2_try_with_implicit_finally() { 36 void test2_try_with_implicit_finally(void) {
36 @try { 37 @try {
37 return; // The rewriter knows how to generate code for implicit finally 38 return; // The rewriter knows how to generate code for implicit finally
38 } @catch (id e) { 39 } @catch (id e) {
39 40
40 } 41 }