Clang Project

clang_source_code/test/Refactor/Extract/ExtractionSemicolonPolicy.m
1// RUN: clang-refactor extract -selection=test:%s %s -- 2>&1 | grep -v CHECK | FileCheck %s
2
3@interface NSArray
4+ (id)arrayWithObjects:(const id [])objects count:(unsigned long)cnt;
5@end
6
7void extractStatementNoSemiObjCFor(NSArray *array) {
8  /*range astmt=->+2:4*/for (id i in array) {
9    int x = 0;
10  }
11}
12// CHECK: 1 'astmt' results:
13// CHECK:      static void extracted() {
14// CHECK-NEXT: for (id i in array) {
15// CHECK-NEXT: int x = 0;
16// CHECK-NEXT: }{{$}}
17// CHECK-NEXT: }{{[[:space:]].*}}
18
19void extractStatementNoSemiSync() {
20  id lock;
21  /*range bstmt=->+2:4*/@synchronized(lock) {
22    int x = 0;
23  }
24}
25// CHECK: 1 'bstmt' results:
26// CHECK:      static void extracted() {
27// CHECK-NEXT: @synchronized(lock) {
28// CHECK-NEXT: int x = 0;
29// CHECK-NEXT: }{{$}}
30// CHECK-NEXT: }{{[[:space:]].*}}
31
32void extractStatementNoSemiAutorel() {
33  /*range cstmt=->+2:4*/@autoreleasepool {
34    int x = 0;
35  }
36}
37// CHECK: 1 'cstmt' results:
38// CHECK:      static void extracted() {
39// CHECK-NEXT: @autoreleasepool {
40// CHECK-NEXT: int x = 0;
41// CHECK-NEXT: }{{$}}
42// CHECK-NEXT: }{{[[:space:]].*}}
43
44void extractStatementNoSemiTryFinalllllly() {
45  /*range dstmt=->+3:4*/@try {
46    int x = 0;
47  } @finally {
48  }
49}
50// CHECK: 1 'dstmt' results:
51// CHECK:      static void extracted() {
52// CHECK-NEXT: @try {
53// CHECK-NEXT: int x = 0;
54// CHECK-NEXT: } @finally {
55// CHECK-NEXT: }{{$}}
56// CHECK-NEXT: }{{[[:space:]].*}}
57