brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 26f601a Raw
57 lines · plain
1// RUN: clang-refactor extract -selection=test:%s %s -- 2>&1 | grep -v CHECK | FileCheck %s2 3@interface NSArray4+ (id)arrayWithObjects:(const id [])objects count:(unsigned long)cnt;5@end6 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(void) {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(void) {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(void) {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