blob: 17d74ba71f0c55f55d0319c4eec9df3eb2fdd2e5 [file] [log] [blame]
Eli Friedmanc219a152009-05-19 11:12:40 +00001// RUN: clang-cc -triple i386-pc-linux-gnu -emit-llvm -o %t %s &&
Daniel Dunbar524ed952009-02-20 23:09:27 +00002// RUN: grep '@_Z2f0i' %t &&
Chris Lattnerca3f25c2009-03-21 08:24:40 +00003// RUN: grep '@_Z2f0l' %t &&
Daniel Dunbar524ed952009-02-20 23:09:27 +00004
5// Make sure we mangle overloadable, even in C system headers.
6
7# 1 "somesystemheader.h" 1 3 4
8void __attribute__((__overloadable__)) f0(int a) {}
9void __attribute__((__overloadable__)) f0(long b) {}
Chris Lattnerca3f25c2009-03-21 08:24:40 +000010
11
12
13// These should get merged.
14void foo() __asm__("bar");
15void foo2() __asm__("bar");
16
17// RUN: grep '@"\\01foo"' %t &&
18// RUN: grep '@"\\01bar"' %t
19
20int nux __asm__("foo");
21extern float nux2 __asm__("foo");
22
23int test() {
24 foo();
25 foo2();
26
27 return nux + nux2;
28}
Chris Lattner570585c2009-03-21 09:16:30 +000029
30
31// Function becomes a variable.
32void foo3() __asm__("var");
33
34void test2() {
35 foo3();
36}
37int foo4 __asm__("var") = 4;
38
Chris Lattner0558e792009-03-21 09:25:43 +000039
40// Variable becomes a function
41extern int foo5 __asm__("var2");
42
43void test3() {
44 foo5 = 1;
45}
46
47void foo6() __asm__("var2");
48void foo6() {
49}
Chris Lattner35f38a22009-03-31 22:37:52 +000050
51
52
53int foo7 __asm__("foo7") __attribute__((used));
54float foo8 __asm__("foo7") = 42;