1678e19d8SPuyan Lotfi // REQUIRES: x86-registered-target
2e782192dSPuyan Lotfi // RUN: %clang_cc1 -DINLINE=inline -triple x86_64-unknown-linux-gnu -o - \
3c382d03cSPuyan Lotfi // RUN: -emit-interface-stubs -std=gnu89 -xc %s | \
468f29dacSPuyan Lotfi // RUN: FileCheck -check-prefix=CHECK-GNU %s
568f29dacSPuyan Lotfi // RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -O0 -o - -c \
668f29dacSPuyan Lotfi // RUN: -std=gnu89 -xc %s | llvm-nm - | FileCheck -check-prefix=CHECK-GNU %s
768f29dacSPuyan Lotfi
8e782192dSPuyan Lotfi // RUN: %clang_cc1 -DINLINE="__attribute__((always_inline))" \
9e782192dSPuyan Lotfi // RUN: -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs -xc %s | \
1068f29dacSPuyan Lotfi // RUN: FileCheck -check-prefix=CHECK-GNU %s
1168f29dacSPuyan Lotfi // RUN: %clang -DINLINE="__attribute__((always_inline))" \
1268f29dacSPuyan Lotfi // RUN: -target x86_64-linux-gnu -O0 -o - -c -xc %s | \
1368f29dacSPuyan Lotfi // RUN: llvm-nm - | FileCheck -check-prefix=CHECK-GNU %s
1468f29dacSPuyan Lotfi
15e782192dSPuyan Lotfi // RUN: %clang_cc1 -DINLINE=inline -triple x86_64-unknown-linux-gnu -o - \
16c382d03cSPuyan Lotfi // RUN: -emit-interface-stubs -std=c99 -xc %s | \
1768f29dacSPuyan Lotfi // RUN: FileCheck -check-prefix=CHECK-STD %s
1868f29dacSPuyan Lotfi // RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -O0 -o - -c -std=c99 \
19932b5d6fSFangrui Song // RUN: -xc %s | llvm-nm - 2>&1 | count 0
2068f29dacSPuyan Lotfi
21e782192dSPuyan Lotfi // RUN: %clang_cc1 -DINLINE="__attribute__((noinline))" \
22e782192dSPuyan Lotfi // RUN: -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs -std=c99 -xc %s | \
2368f29dacSPuyan Lotfi // RUN: FileCheck -check-prefix=CHECK-NOINLINE %s
2468f29dacSPuyan Lotfi // RUN: %clang -DINLINE="__attribute__((noinline))" -target x86_64-linux-gnu \
2568f29dacSPuyan Lotfi // RUN: -O0 -o - -c -std=c99 -xc %s | llvm-nm - 2>&1 | \
2668f29dacSPuyan Lotfi // RUN: FileCheck -check-prefix=CHECK-NOINLINE %s
2768f29dacSPuyan Lotfi
28e782192dSPuyan Lotfi // RUN: %clang_cc1 -DINLINE="static" -triple x86_64-unknown-linux-gnu -o - \
29c382d03cSPuyan Lotfi // RUN: -emit-interface-stubs -std=c99 -xc %s | \
3068f29dacSPuyan Lotfi // RUN: FileCheck -check-prefix=CHECK-STATIC %s
3168f29dacSPuyan Lotfi // RUN: %clang -DINLINE="static" -target x86_64-linux-gnu -O0 -o - -c \
32932b5d6fSFangrui Song // RUN: -std=c99 -xc %s | llvm-nm - 2>&1 | count 0
3368f29dacSPuyan Lotfi
3468f29dacSPuyan Lotfi // CHECK-GNU-DAG: foo
3568f29dacSPuyan Lotfi // CHECK-GNU-DAG: foo.var
3668f29dacSPuyan Lotfi // CHECK-NOINLINE-DAG: foo
3768f29dacSPuyan Lotfi // CHECK-NOINLINE-DAG: foo.var
3868f29dacSPuyan Lotfi // CHECK-STATIC-NOT: foo
3968f29dacSPuyan Lotfi // CHECK-STATIC-NOT: foo.var
4068f29dacSPuyan Lotfi // CHECK-STD-NOT: foo
4168f29dacSPuyan Lotfi #pragma clang diagnostic ignored "-Wstatic-local-in-inline"
foo(void)42*7de71613SAaron Ballman INLINE int foo(void) {
4368f29dacSPuyan Lotfi static int var = 42;
4468f29dacSPuyan Lotfi return var;
4568f29dacSPuyan Lotfi }
4668f29dacSPuyan Lotfi
47e782192dSPuyan Lotfi // RUN: %clang_cc1 -DINLINE=inline -triple x86_64-linux-gnu -o - \
48c382d03cSPuyan Lotfi // RUN: -emit-interface-stubs \
4968f29dacSPuyan Lotfi // RUN: -std=gnu89 -xc %s | FileCheck -check-prefix=CHECK-TAPI %s
5068f29dacSPuyan Lotfi
51e782192dSPuyan Lotfi // RUN: %clang_cc1 -DINLINE=inline -triple x86_64-linux-gnu -o - \
52c382d03cSPuyan Lotfi // RUN: -emit-interface-stubs \
5368f29dacSPuyan Lotfi // RUN: -std=gnu89 -xc %s | FileCheck -check-prefix=CHECK-SYMBOLS %s
5468f29dacSPuyan Lotfi // RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -o - \
5568f29dacSPuyan Lotfi // RUN: -c -std=gnu89 -xc %s | llvm-nm - 2>&1 | \
5668f29dacSPuyan Lotfi // RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
5768f29dacSPuyan Lotfi
58e3033c0cSPuyan Lotfi // CHECK-TAPI-DAG: foo", Type: Func }
59e3033c0cSPuyan Lotfi // CHECK-TAPI-DAG: foo.var", Type: Object, Size: 4 }
6068f29dacSPuyan Lotfi // CHECK-SYMBOLS-DAG: foo
6168f29dacSPuyan Lotfi // CHECK-SYMBOLS-DAG: foo.var
6268f29dacSPuyan Lotfi #include "inline.h"
63