Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / block-with-perdefinedexpr.cpp
blob890c2d6358569e73a53a265d416665d90109c53c
1 // RUN: %clang_cc1 %s -emit-llvm -o - -fblocks -triple x86_64-apple-darwin10 -std=c++11 | FileCheck %s
3 void bar() {
4 // CHECK-DAG: @__FUNCTION__.___Z3barv_block_invoke = private unnamed_addr constant [17 x i8] c"bar_block_invoke\00", align 1
5 const char * (^block1)() = ^() {
6 return __FUNCTION__;
7 };
8 // CHECK-DAG: @__FUNCTION__.___Z3barv_block_invoke_2 = private unnamed_addr constant [19 x i8] c"bar_block_invoke_2\00", align 1
9 const char * (^block2)() = ^() {
10 return __FUNCTION__;
14 void baz() {
15 // CHECK-DAG: @__PRETTY_FUNCTION__.___Z3bazv_block_invoke = private unnamed_addr constant [24 x i8] c"void baz()_block_invoke\00", align 1
16 const char * (^block1)() = ^() {
17 return __PRETTY_FUNCTION__;
19 // CHECK-DAG: @__PRETTY_FUNCTION__.___Z3bazv_block_invoke_2 = private unnamed_addr constant [26 x i8] c"void baz()_block_invoke_2\00", align 1
20 const char * (^block2)() = ^() {
21 return __PRETTY_FUNCTION__;
25 namespace foonamespace {
26 class Foo {
27 public:
28 Foo() {
29 // CHECK-DAG: @__PRETTY_FUNCTION__.___ZN12foonamespace3FooC2Ev_block_invoke = private unnamed_addr constant [38 x i8] c"foonamespace::Foo::Foo()_block_invoke\00", align 1
30 const char * (^block1)() = ^() {
31 return __PRETTY_FUNCTION__;
33 // CHECK-DAG: @__PRETTY_FUNCTION__.___ZN12foonamespace3FooC2Ev_block_invoke_2 = private unnamed_addr constant [40 x i8] c"foonamespace::Foo::Foo()_block_invoke_2\00", align 1
34 const char * (^block2)() = ^() {
35 return __PRETTY_FUNCTION__;
37 // CHECK-DAG: @__func__.___ZN12foonamespace3FooC2Ev_block_invoke_3 = private unnamed_addr constant [19 x i8] c"Foo_block_invoke_3\00", align 1
38 const char * (^block3)() = ^() {
39 return __func__;
41 bar();
42 inside_lambda();
44 ~Foo() {
45 // CHECK-DAG: @__func__.___ZN12foonamespace3FooD2Ev_block_invoke = private unnamed_addr constant [18 x i8] c"~Foo_block_invoke\00", align 1
46 const char * (^block1)() = ^() {
47 return __func__;
49 // CHECK-DAG: @__PRETTY_FUNCTION__.___ZN12foonamespace3FooD2Ev_block_invoke_2 = private unnamed_addr constant [41 x i8] c"foonamespace::Foo::~Foo()_block_invoke_2\00", align 1
50 const char * (^block2)() = ^() {
51 return __PRETTY_FUNCTION__;
54 void bar() {
55 // CHECK-DAG: @__PRETTY_FUNCTION__.___ZN12foonamespace3Foo3barEv_block_invoke = private unnamed_addr constant [43 x i8] c"void foonamespace::Foo::bar()_block_invoke\00", align 1
56 const char * (^block1)() = ^() {
57 return __PRETTY_FUNCTION__;
59 // CHECK-DAG: @__PRETTY_FUNCTION__.___ZN12foonamespace3Foo3barEv_block_invoke_2 = private unnamed_addr constant [45 x i8] c"void foonamespace::Foo::bar()_block_invoke_2\00", align 1
60 const char * (^block2)() = ^() {
61 return __PRETTY_FUNCTION__;
63 // CHECK-DAG: @__func__.___ZN12foonamespace3Foo3barEv_block_invoke_3 = private unnamed_addr constant [19 x i8] c"bar_block_invoke_3\00", align 1
64 const char * (^block3)() = ^() {
65 return __func__;
68 void inside_lambda() {
69 auto lambda = []() {
70 // CHECK-DAG: @__PRETTY_FUNCTION__.___ZZN12foonamespace3Foo13inside_lambdaEvENKUlvE_clEv_block_invoke = private unnamed_addr constant [92 x i8] c"auto foonamespace::Foo::inside_lambda()::(anonymous class)::operator()() const_block_invoke\00", align 1
71 const char * (^block1)() = ^() {
72 return __PRETTY_FUNCTION__;
74 // CHECK-DAG: @__PRETTY_FUNCTION__.___ZZN12foonamespace3Foo13inside_lambdaEvENKUlvE_clEv_block_invoke_2 = private unnamed_addr constant [94 x i8] c"auto foonamespace::Foo::inside_lambda()::(anonymous class)::operator()() const_block_invoke_2\00", align 1
75 const char * (^block2)() = ^() {
76 return __PRETTY_FUNCTION__;
78 // CHECK-DAG: @__func__.___ZZN12foonamespace3Foo13inside_lambdaEvENKUlvE_clEv_block_invoke_3 = private unnamed_addr constant [26 x i8] c"operator()_block_invoke_3\00", align 1
79 const char * (^block3)() = ^() {
80 return __func__;
83 lambda();
86 Foo f;