[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / mangle.c
blobf5f6710555934d61beb01bfeb0b9fb1a8e52e68b
1 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
3 // CHECK: @foo
5 // Make sure we mangle overloadable, even in C system headers.
6 # 1 "somesystemheader.h" 1 3 4
7 // CHECK: @_Z2f0i
8 void __attribute__((__overloadable__)) f0(int a) {}
9 // CHECK: @_Z2f0l
10 void __attribute__((__overloadable__)) f0(long b) {}
12 // Unless it's unmarked.
13 // CHECK: @f0
14 void f0(float b) {}
16 // CHECK: @bar
18 // These should get merged.
19 void foo() __asm__("bar");
20 void foo2() __asm__("bar");
22 int nux __asm__("foo");
23 extern float nux2 __asm__("foo");
25 int test() {
26 foo();
27 foo2();
29 return nux + nux2;
33 // Function becomes a variable.
34 void foo3() __asm__("var");
36 void test2() {
37 foo3();
39 int foo4 __asm__("var") = 4;
42 // Variable becomes a function
43 extern int foo5 __asm__("var2");
45 void test3() {
46 foo5 = 1;
49 void foo6() __asm__("var2");
50 void foo6() {
55 int foo7 __asm__("foo7") __attribute__((used));
56 float foo8 __asm__("foo7") = 42;
58 // PR4412
59 int func(void);
60 extern int func (void) __asm__ ("FUNC");
62 // CHECK: @FUNC
63 int func(void) {
64 return 42;
67 // CHECK: @_Z4foo9Dv4_f
68 typedef __attribute__(( vector_size(16) )) float float4;
69 void __attribute__((__overloadable__)) foo9(float4 f) {}
71 // Intrinsic calls.
72 extern int llvm_cas(volatile int*, int, int)
73 __asm__("llvm.atomic.cmp.swap.i32.p0i32");
75 int foo10(volatile int* add, int from, int to) {
76 // CHECK: call i32 @llvm.atomic.cmp.swap.i32.p0
77 return llvm_cas(add, from, to);