blob: c64771185f385c3dd32f07ecec520fef16715162 [file] [log] [blame]
Puyan Lotfi8df7f1a2019-06-17 22:46:54 +00001// RUN: %clang -DINLINE=inline -target x86_64-unknown-linux-gnu -o - \
2// RUN: -emit-interface-stubs \
3// RUN: -interface-stub-version=experimental-yaml-elf-v1 -std=gnu89 -xc %s | \
4// RUN: FileCheck -check-prefix=CHECK-GNU %s
5// RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -O0 -o - -c \
6// RUN: -std=gnu89 -xc %s | llvm-nm - | FileCheck -check-prefix=CHECK-GNU %s
7
8// RUN: %clang -DINLINE="__attribute__((always_inline))" \
9// RUN: -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
10// RUN: -interface-stub-version=experimental-yaml-elf-v1 -xc %s | \
11// RUN: FileCheck -check-prefix=CHECK-GNU %s
12// RUN: %clang -DINLINE="__attribute__((always_inline))" \
13// RUN: -target x86_64-linux-gnu -O0 -o - -c -xc %s | \
14// RUN: llvm-nm - | FileCheck -check-prefix=CHECK-GNU %s
15
16// RUN: %clang -DINLINE=inline -target x86_64-unknown-linux-gnu -o - \
17// RUN: -emit-interface-stubs \
18// RUN: -interface-stub-version=experimental-yaml-elf-v1 -std=c99 -xc %s | \
19// RUN: FileCheck -check-prefix=CHECK-STD %s
20// RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -O0 -o - -c -std=c99 \
21// RUN: -xc %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-STD %s
22
23// RUN: %clang -DINLINE="__attribute__((noinline))" \
24// RUN: -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
25// RUN: -interface-stub-version=experimental-yaml-elf-v1 -std=c99 -xc %s | \
26// RUN: FileCheck -check-prefix=CHECK-NOINLINE %s
27// RUN: %clang -DINLINE="__attribute__((noinline))" -target x86_64-linux-gnu \
28// RUN: -O0 -o - -c -std=c99 -xc %s | llvm-nm - 2>&1 | \
29// RUN: FileCheck -check-prefix=CHECK-NOINLINE %s
30
31// RUN: %clang -DINLINE="static" -target x86_64-unknown-linux-gnu -o - \
32// RUN: -emit-interface-stubs \
33// RUN: -interface-stub-version=experimental-yaml-elf-v1 -std=c99 -xc %s | \
34// RUN: FileCheck -check-prefix=CHECK-STATIC %s
35// RUN: %clang -DINLINE="static" -target x86_64-linux-gnu -O0 -o - -c \
36// RUN: -std=c99 -xc %s | llvm-nm - 2>&1 | \
37// RUN: FileCheck -check-prefix=CHECK-STATIC %s
38
39// CHECK-GNU-DAG: foo
40// CHECK-GNU-DAG: foo.var
41// CHECK-NOINLINE-DAG: foo
42// CHECK-NOINLINE-DAG: foo.var
43// CHECK-STATIC-NOT: foo
44// CHECK-STATIC-NOT: foo.var
45// CHECK-STD-NOT: foo
46#pragma clang diagnostic ignored "-Wstatic-local-in-inline"
47INLINE int foo() {
48 static int var = 42;
49 return var;
50}
51
52// RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -o - \
53// RUN: -emit-interface-stubs -interface-stub-version=experimental-tapi-elf-v1 \
54// RUN: -std=gnu89 -xc %s | FileCheck -check-prefix=CHECK-TAPI %s
55
56// RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -o - \
57// RUN: -emit-interface-stubs -interface-stub-version=experimental-tapi-elf-v1 \
58// RUN: -std=gnu89 -xc %s | FileCheck -check-prefix=CHECK-SYMBOLS %s
59// RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -o - \
60// RUN: -c -std=gnu89 -xc %s | llvm-nm - 2>&1 | \
61// RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
62
63// CHECK-TAPI-DAG: foo: { Type: Func }
64// CHECK-TAPI-DAG: foo.var: { Type: Object, Size: 4 }
65// CHECK-SYMBOLS-DAG: foo
66// CHECK-SYMBOLS-DAG: foo.var
67#include "inline.h"