Home | History | Annotate | Download | only in Rewriter
      1 // RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o %t-rw.cpp
      2 // RUN: FileCheck -check-prefix CHECK-LP --input-file=%t-rw.cpp %s
      3 
      4 extern "C" {
      5 extern "C" void *_Block_copy(const void *aBlock);
      6 extern "C" void _Block_release(const void *aBlock);
      7 }
      8 
      9 int main() {
     10     __attribute__((__blocks__(byref))) int a = 42;
     11     int save_a = a;
     12 
     13     void (^b)(void) = ^{
     14         ((__typeof(^{ a = 2; }))_Block_copy((const void *)(^{ a = 2; })));
     15     };
     16 
     17     ((__typeof(b))_Block_copy((const void *)(b)));
     18 
     19     return 0;
     20 }
     21 
     22 // CHECK-LP: ((void (^)(void))_Block_copy((const void *)(b)))
     23 
     24 // radar 7628153
     25 void f() {
     26 	int a;	
     27 	__typeof__(a) aVal = a;
     28 	char *a1t = (char *)@encode(__typeof__(a));
     29         __typeof__(aVal) bVal;
     30 	char *a2t = (char *)@encode(__typeof__(bVal));
     31         __typeof__(bVal) cVal = bVal;
     32 	char *a3t = (char *)@encode(__typeof__(cVal));
     33 
     34 }
     35 
     36 
     37 // CHECK-LP: int aVal =  a;
     38 
     39 // CHECK-LP: int bVal;
     40