blob: 3607999eb17d4e71f07b86ebecb76c7554c59d10 [file] [log] [blame]
Duncan Sands46c403d2009-05-30 13:57:05 +00001// RUN: %llvmgcc -std=c99 %s -S -emit-llvm -O0 -o - | grep define | \
2// RUN: grep xglobWeak | grep weak | count 1
Reid Spencerdcb925e2007-04-15 20:08:37 +00003// RUN: %llvmgcc -std=c99 %s -S -emit-llvm -O0 -o - | grep define | \
Dan Gohman28beeea2007-08-15 13:36:28 +00004// RUN: grep xextWeak | grep weak | count 1
Reid Spencerdcb925e2007-04-15 20:08:37 +00005// RUN: %llvmgcc -std=c99 %s -S -emit-llvm -O0 -o - | grep define | \
Dan Gohman28beeea2007-08-15 13:36:28 +00006// RUN: grep xWeaknoinline | grep weak | count 1
Reid Spencerdcb925e2007-04-15 20:08:37 +00007// RUN: %llvmgcc -std=c99 %s -S -emit-llvm -O0 -o - | grep define | \
Dan Gohman28beeea2007-08-15 13:36:28 +00008// RUN: grep xWeakextnoinline | grep weak | count 1
Duncan Sands46c403d2009-05-30 13:57:05 +00009// RUN: %llvmgcc -std=c99 %s -S -emit-llvm -O0 -o - | grep define | \
10// RUN: grep xglobnoWeak | grep available_externally | count 1
Reid Spencerdcb925e2007-04-15 20:08:37 +000011// RUN: %llvmgcc -std=c99 %s -S -emit-llvm -O0 -o - | grep define | \
Dan Gohman28beeea2007-08-15 13:36:28 +000012// RUN: grep xstatnoWeak | grep internal | count 1
Reid Spencerdcb925e2007-04-15 20:08:37 +000013// RUN: %llvmgcc -std=c99 %s -S -emit-llvm -O0 -o - | grep define | \
14// RUN: grep xextnoWeak | grep -v internal | grep -v weak | \
Dan Gohman28beeea2007-08-15 13:36:28 +000015// RUN: grep -v linkonce | count 1
Dale Johannesen39cd6f12007-04-12 21:01:53 +000016inline int xglobWeak(int) __attribute__((weak));
17inline int xglobWeak (int i) {
18 return i*2;
19}
20inline int xextWeak(int) __attribute__((weak));
21extern inline int xextWeak (int i) {
22 return i*4;
23}
24int xWeaknoinline(int) __attribute__((weak));
25int xWeaknoinline(int i) {
26 return i*8;
27}
28int xWeakextnoinline(int) __attribute__((weak));
29extern int xWeakextnoinline(int i) {
30 return i*16;
31}
32inline int xglobnoWeak (int i) {
33 return i*32;
34}
35static inline int xstatnoWeak (int i) {
36 return i*64;
37}
38extern inline int xextnoWeak (int i) {
39 return i*128;
40}
41int j(int y) {
42 return xglobnoWeak(y)+xstatnoWeak(y)+xextnoWeak(y)+
43 xglobWeak(y)+xextWeak(y)+
44 xWeakextnoinline(y)+xWeaknoinline(y);
45}