xref: /llvm-project/clang/test/ARCMT/remove-statements.m (revision 9b0a7cea0f5bb2d3197ff33734cc5411ea793e10)
1*9b0a7ceaSJohn McCall// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result
2*9b0a7ceaSJohn McCall// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t
3d70fb981SJohn McCall// RUN: diff %t %s.result
4d70fb981SJohn McCall
5d70fb981SJohn McCall#include "Common.h"
6d70fb981SJohn McCall
7d70fb981SJohn McCall@interface myController : NSObject
8d70fb981SJohn McCall-(id)test:(id)x;
9d70fb981SJohn McCall@end
10d70fb981SJohn McCall
11d70fb981SJohn McCall#define MY_MACRO1(x)
12d70fb981SJohn McCall#define MY_MACRO2(x) (void)x
13d70fb981SJohn McCall
14d70fb981SJohn McCall@implementation myController
15d70fb981SJohn McCall-(id) test:(id) x {
1684b528f3SArgyrios Kyrtzidis  [[x retain] release];
17d70fb981SJohn McCall  return [[x retain] autorelease];
18d70fb981SJohn McCall}
19d70fb981SJohn McCall
20d70fb981SJohn McCall-(void)dealloc
21d70fb981SJohn McCall{
22d70fb981SJohn McCall  id array, array_already_empty;
23d70fb981SJohn McCall  for (id element in array_already_empty) {
24d70fb981SJohn McCall  }
25d70fb981SJohn McCall
26d70fb981SJohn McCall  [array release];
27d70fb981SJohn McCall  ;
28d70fb981SJohn McCall
29d70fb981SJohn McCall  int b, b_array_already_empty;
30d70fb981SJohn McCall  if (b)
31d70fb981SJohn McCall    [array release];
32d70fb981SJohn McCall  if (b_array_already_empty) ;
33d70fb981SJohn McCall
34d70fb981SJohn McCall  if (b) {
35d70fb981SJohn McCall    [array release];
36d70fb981SJohn McCall  }
37d70fb981SJohn McCall  if (b_array_already_empty) {
38d70fb981SJohn McCall  }
39d70fb981SJohn McCall
40d70fb981SJohn McCall  if (b)
41d70fb981SJohn McCall    MY_MACRO1(array);
42d70fb981SJohn McCall  if (b)
43d70fb981SJohn McCall    MY_MACRO2(array);
44d70fb981SJohn McCall}
45d70fb981SJohn McCall@end
46