blob: 93d424a85dad371a8ba463eb4e0632283879d64d [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
Douglas Gregor457e2812009-10-28 16:31:34 +00002
3// CHECK: @"\01foo"
Daniel Dunbar524ed952009-02-20 23:09:27 +00004
5// Make sure we mangle overloadable, even in C system headers.
Daniel Dunbar524ed952009-02-20 23:09:27 +00006# 1 "somesystemheader.h" 1 3 4
Douglas Gregor457e2812009-10-28 16:31:34 +00007// CHECK: @_Z2f0i
Daniel Dunbar524ed952009-02-20 23:09:27 +00008void __attribute__((__overloadable__)) f0(int a) {}
Douglas Gregor457e2812009-10-28 16:31:34 +00009// CHECK: @_Z2f0l
Daniel Dunbar524ed952009-02-20 23:09:27 +000010void __attribute__((__overloadable__)) f0(long b) {}
Chris Lattnerca3f25c2009-03-21 08:24:40 +000011
Douglas Gregor457e2812009-10-28 16:31:34 +000012// CHECK: @"\01bar"
Chris Lattnerca3f25c2009-03-21 08:24:40 +000013
14// These should get merged.
15void foo() __asm__("bar");
16void foo2() __asm__("bar");
17
Chris Lattnerca3f25c2009-03-21 08:24:40 +000018int nux __asm__("foo");
19extern float nux2 __asm__("foo");
20
21int test() {
22 foo();
23 foo2();
24
25 return nux + nux2;
26}
Chris Lattner570585c2009-03-21 09:16:30 +000027
28
29// Function becomes a variable.
30void foo3() __asm__("var");
31
32void test2() {
33 foo3();
34}
35int foo4 __asm__("var") = 4;
36
Chris Lattner0558e792009-03-21 09:25:43 +000037
38// Variable becomes a function
39extern int foo5 __asm__("var2");
40
41void test3() {
42 foo5 = 1;
43}
44
45void foo6() __asm__("var2");
46void foo6() {
47}
Chris Lattner35f38a22009-03-31 22:37:52 +000048
49
50
51int foo7 __asm__("foo7") __attribute__((used));
52float foo8 __asm__("foo7") = 42;
Douglas Gregor457e2812009-10-28 16:31:34 +000053
54// PR4412
55int func(void);
56extern int func (void) __asm__ ("FUNC");
57
58// CHECK: @"\01FUNC"
59int func(void) {
60 return 42;
61}
Nick Lewycky0e5f0672010-03-26 07:18:04 +000062
63// CHECK: @_Z4foo9Dv4_f
64typedef __attribute__(( vector_size(16) )) float float4;
65void __attribute__((__overloadable__)) foo9(float4 f) {}