blob: e32b4e100960dae0a1aea5d9b21a14916af9fcec [file] [log] [blame]
Puyan Lotfi678e19d2019-06-20 18:28:21 +00001// REQUIRES: x86-registered-target
Nico Weber6713f822019-10-03 02:38:43 +00002// RUN: %clang -DINLINE=inline -target x86_64-unknown-linux-gnu -o - \
3// RUN: -emit-interface-stubs \
4// RUN: -interface-stub-version=experimental-ifs-v1 -std=gnu89 -xc %s | \
Puyan Lotfi68f29da2019-06-20 16:59:48 +00005// RUN: FileCheck -check-prefix=CHECK-GNU %s
6// RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -O0 -o - -c \
7// RUN: -std=gnu89 -xc %s | llvm-nm - | FileCheck -check-prefix=CHECK-GNU %s
8
Nico Weber6713f822019-10-03 02:38:43 +00009// RUN: %clang -DINLINE="__attribute__((always_inline))" \
10// RUN: -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
11// RUN: -interface-stub-version=experimental-ifs-v1 -xc %s | \
Puyan Lotfi68f29da2019-06-20 16:59:48 +000012// RUN: FileCheck -check-prefix=CHECK-GNU %s
13// RUN: %clang -DINLINE="__attribute__((always_inline))" \
14// RUN: -target x86_64-linux-gnu -O0 -o - -c -xc %s | \
15// RUN: llvm-nm - | FileCheck -check-prefix=CHECK-GNU %s
16
Nico Weber6713f822019-10-03 02:38:43 +000017// RUN: %clang -DINLINE=inline -target x86_64-unknown-linux-gnu -o - \
18// RUN: -emit-interface-stubs \
19// RUN: -interface-stub-version=experimental-ifs-v1 -std=c99 -xc %s | \
Puyan Lotfi68f29da2019-06-20 16:59:48 +000020// RUN: FileCheck -check-prefix=CHECK-STD %s
21// RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -O0 -o - -c -std=c99 \
22// RUN: -xc %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-STD %s
23
Nico Weber6713f822019-10-03 02:38:43 +000024// RUN: %clang -DINLINE="__attribute__((noinline))" \
25// RUN: -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
26// RUN: -interface-stub-version=experimental-ifs-v1 -std=c99 -xc %s | \
Puyan Lotfi68f29da2019-06-20 16:59:48 +000027// RUN: FileCheck -check-prefix=CHECK-NOINLINE %s
28// RUN: %clang -DINLINE="__attribute__((noinline))" -target x86_64-linux-gnu \
29// RUN: -O0 -o - -c -std=c99 -xc %s | llvm-nm - 2>&1 | \
30// RUN: FileCheck -check-prefix=CHECK-NOINLINE %s
31
Nico Weber6713f822019-10-03 02:38:43 +000032// RUN: %clang -DINLINE="static" -target x86_64-unknown-linux-gnu -o - \
33// RUN: -emit-interface-stubs \
34// RUN: -interface-stub-version=experimental-ifs-v1 -std=c99 -xc %s | \
Puyan Lotfi68f29da2019-06-20 16:59:48 +000035// RUN: FileCheck -check-prefix=CHECK-STATIC %s
36// RUN: %clang -DINLINE="static" -target x86_64-linux-gnu -O0 -o - -c \
37// RUN: -std=c99 -xc %s | llvm-nm - 2>&1 | \
38// RUN: FileCheck -check-prefix=CHECK-STATIC %s
39
40// CHECK-GNU-DAG: foo
41// CHECK-GNU-DAG: foo.var
42// CHECK-NOINLINE-DAG: foo
43// CHECK-NOINLINE-DAG: foo.var
44// CHECK-STATIC-NOT: foo
45// CHECK-STATIC-NOT: foo.var
46// CHECK-STD-NOT: foo
47#pragma clang diagnostic ignored "-Wstatic-local-in-inline"
48INLINE int foo() {
49 static int var = 42;
50 return var;
51}
52
Nico Weber6713f822019-10-03 02:38:43 +000053// RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -o - \
54// RUN: -emit-interface-stubs -interface-stub-version=experimental-ifs-v1 \
Puyan Lotfi68f29da2019-06-20 16:59:48 +000055// RUN: -std=gnu89 -xc %s | FileCheck -check-prefix=CHECK-TAPI %s
56
Nico Weber6713f822019-10-03 02:38:43 +000057// RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -o - \
58// RUN: -emit-interface-stubs -interface-stub-version=experimental-ifs-v1 \
Puyan Lotfi68f29da2019-06-20 16:59:48 +000059// RUN: -std=gnu89 -xc %s | FileCheck -check-prefix=CHECK-SYMBOLS %s
60// RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -o - \
61// RUN: -c -std=gnu89 -xc %s | llvm-nm - 2>&1 | \
62// RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
63
64// CHECK-TAPI-DAG: foo: { Type: Func }
65// CHECK-TAPI-DAG: foo.var: { Type: Object, Size: 4 }
66// CHECK-SYMBOLS-DAG: foo
67// CHECK-SYMBOLS-DAG: foo.var
68#include "inline.h"