Files
clang-p2996/clang/test/Rewriter/rewrite-captured-nested-bvar.c
Aaron Ballman 0dd49a5628 Use functions with prototypes when appropriate; NFC
A significant number of our tests in C accidentally use functions
without prototypes. This patch converts the function signatures to have
a prototype for the situations where the test is not specific to K&R C
declarations. e.g.,

  void func();

becomes

  void func(void);

This is the eighth batch of tests being updated (there are a
significant number of other tests left to be updated).
2022-02-12 07:25:06 -05:00

36 lines
845 B
C

// RUN: %clang_cc1 -x c -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
// RUN: FileCheck --input-file=%t-rw.cpp %s
// rdar://9006279
void q(void (^p)(void)) {
p();
}
void f(void) {
__block char BYREF_VAR_CHECK = 'a';
__block char d = 'd';
q(^{
q(^{
__block char e = 'e';
char l = 'l';
BYREF_VAR_CHECK = 'b';
d = 'd';
q(^{
e = '1';
BYREF_VAR_CHECK = '2';
d = '3';
}
);
});
});
}
int main(void) {
f();
return 0;
}
// CHECK: (__Block_byref_BYREF_VAR_CHECK_0 *)BYREF_VAR_CHECK
// CHECK: (__Block_byref_BYREF_VAR_CHECK_0 *)&BYREF_VAR_CHECK
// CHECK: (struct __Block_byref_BYREF_VAR_CHECK_0 *)&BYREF_VAR_CHECK, (struct __Block_byref_d_1 *)&d, 570425344));