Clang Project

clang_source_code/test/CodeGenCXX/block-byref.cpp
1// RUN: %clang_cc1 %s -fblocks -triple x86_64-apple-darwin -std=c++11 -emit-llvm -o - | FileCheck %s
2// REQUIRES: x86-registered-target
3
4// CHECK: @b = global i32 0,
5
6// CHECK: define {{.*}}void @{{.*}}test{{.*}}_block_invoke(
7// CHECK: store i32 2, i32* @b,
8// CHECK: ret void
9
10int b;
11
12void test() {
13  int &a = b;
14  ^{ a = 2; };
15}
16