diff options
Diffstat (limited to 'test/CodeGenObjCXX/mangle-blocks.mm')
-rw-r--r-- | test/CodeGenObjCXX/mangle-blocks.mm | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/test/CodeGenObjCXX/mangle-blocks.mm b/test/CodeGenObjCXX/mangle-blocks.mm index 892c8af..405e528 100644 --- a/test/CodeGenObjCXX/mangle-blocks.mm +++ b/test/CodeGenObjCXX/mangle-blocks.mm @@ -1,19 +1,22 @@ // RUN: %clang_cc1 -emit-llvm -fblocks -o - -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 %s | FileCheck %s -// CHECK: @_ZGVN3foo22___Z3foov_block_invoke5valueE = internal global i64 0 +// CHECK: @_ZGVZZ3foovEUb_E5value = internal global i64 0 +// CHECK: @_ZZZN26externally_visible_statics1S3fooEiEd_Ub_E1k = linkonce_odr global i32 0 +// CHECK: @_ZZ26externally_visible_statics1S1xMUb_E1j = linkonce_odr global i32 0 +// CHECK: @_ZZZN26externally_visible_statics10inlinefuncEvEUb_E1i = linkonce_odr global i32 0 int f(); void foo() { - // CHECK: define internal i32 @___Z3foov_block_invoke - // CHECK: call i32 @__cxa_guard_acquire(i64* @_ZGVN3foo22___Z3foov_block_invoke5valueE + // CHECK-LABEL: define internal i32 @___Z3foov_block_invoke + // CHECK: call i32 @__cxa_guard_acquire(i64* @_ZGVZZ3foovEUb_E5value (void)^(int x) { static int value = f(); return x + value; }; } -// CHECK: define internal i32 @i_block_invoke +// CHECK-LABEL: define internal i32 @i_block_invoke int i = ^(int x) { return x;}(i); @interface A @@ -24,7 +27,7 @@ int i = ^(int x) { return x;}(i); - (void)method { // CHECK: define internal signext i8 @"__11-[A method]_block_invoke" (void)^(int x) { - // CHECK: @"_ZN11-[A method]28__11-[A method]_block_invoke4nameE" + // CHECK: @"_ZZZ11-[A method]EUb0_E4name" static const char *name = "hello"; return name[x]; }; @@ -39,12 +42,44 @@ void foo(int) { } namespace N { - // CHECK: define internal signext i8 @___Z3fooi_block_invoke + // CHECK-LABEL: define internal signext i8 @___Z3fooi_block_invoke void bar() { (void)^(int x) { - // CHECK: @_ZN1N3bar26___ZN1N3barEv_block_invoke4nameE + // CHECK: @_ZZZN1N3barEvEUb2_E4name static const char *name = "hello"; return name[x]; }; } } + +class C { + C(); +}; +C::C() { + (void)^(int x) { + // CHECK: @_ZZZN1CC1EvEUb3_E5nameb + static const char *nameb = "hello"; + return nameb[x]; + }; +} + +int f(); +namespace externally_visible_statics { + inline void inlinefunc() { + ^{ + static int i = f(); + }(); + } + struct S { + int x = ^{ + static int j = f(); + return j; + }(); + void foo(int y = ^{ static int k = f(); return k; }()) {} + }; + void g() { + inlinefunc(); + S s; + s.foo(); + } +} |