18c1441f8SAlexey Samsonov // 2*2946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 3*2946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 4*2946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 58c1441f8SAlexey Samsonov 68c1441f8SAlexey Samsonov // 78c1441f8SAlexey Samsonov // byrefaccess.m 88c1441f8SAlexey Samsonov // test that byref access to locals is accurate 98c1441f8SAlexey Samsonov // testObjects 108c1441f8SAlexey Samsonov // 118c1441f8SAlexey Samsonov // Created by Blaine Garst on 5/13/08. 128c1441f8SAlexey Samsonov // 138c1441f8SAlexey Samsonov // CONFIG 148c1441f8SAlexey Samsonov 158c1441f8SAlexey Samsonov #include <stdio.h> 168c1441f8SAlexey Samsonov 178c1441f8SAlexey Samsonov 188c1441f8SAlexey Samsonov void callVoidVoid(void (^closure)(void)) { 198c1441f8SAlexey Samsonov closure(); 208c1441f8SAlexey Samsonov } 218c1441f8SAlexey Samsonov main(int argc,char * argv[])228c1441f8SAlexey Samsonovint main(int argc, char *argv[]) { 238c1441f8SAlexey Samsonov __block int i = 10; 248c1441f8SAlexey Samsonov 258c1441f8SAlexey Samsonov callVoidVoid(^{ ++i; }); 268c1441f8SAlexey Samsonov 278c1441f8SAlexey Samsonov if (i != 11) { 288c1441f8SAlexey Samsonov printf("*** %s didn't update i\n", argv[0]); 298c1441f8SAlexey Samsonov return 1; 308c1441f8SAlexey Samsonov } 318c1441f8SAlexey Samsonov printf("%s: success\n", argv[0]); 328c1441f8SAlexey Samsonov return 0; 338c1441f8SAlexey Samsonov } 34