blob: 06a58c4c1bea4e9dc8ede84a0f96a9f10e27be66 [file] [log] [blame]
Puyan Lotfi678e19d2019-06-20 18:28:21 +00001// REQUIRES: x86-registered-target
Puyan Lotfic382d032019-10-08 15:23:14 +00002// RUN: %clang -c -DINLINE=inline -target x86_64-unknown-linux-gnu -o - \
3// RUN: -emit-interface-stubs -std=gnu89 -xc %s | \
Puyan Lotfi68f29da2019-06-20 16:59:48 +00004// 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
Puyan Lotfic382d032019-10-08 15:23:14 +00008// RUN: %clang -c -DINLINE="__attribute__((always_inline))" \
9// RUN: -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs -xc %s | \
Puyan Lotfi68f29da2019-06-20 16:59:48 +000010// RUN: FileCheck -check-prefix=CHECK-GNU %s
11// RUN: %clang -DINLINE="__attribute__((always_inline))" \
12// RUN: -target x86_64-linux-gnu -O0 -o - -c -xc %s | \
13// RUN: llvm-nm - | FileCheck -check-prefix=CHECK-GNU %s
14
Puyan Lotfic382d032019-10-08 15:23:14 +000015// RUN: %clang -c -DINLINE=inline -target x86_64-unknown-linux-gnu -o - \
16// RUN: -emit-interface-stubs -std=c99 -xc %s | \
Puyan Lotfi68f29da2019-06-20 16:59:48 +000017// RUN: FileCheck -check-prefix=CHECK-STD %s
18// RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -O0 -o - -c -std=c99 \
19// RUN: -xc %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-STD %s
20
Puyan Lotfic382d032019-10-08 15:23:14 +000021// RUN: %clang -c -DINLINE="__attribute__((noinline))" \
22// RUN: -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs -std=c99 -xc %s | \
Puyan Lotfi68f29da2019-06-20 16:59:48 +000023// RUN: FileCheck -check-prefix=CHECK-NOINLINE %s
24// RUN: %clang -DINLINE="__attribute__((noinline))" -target x86_64-linux-gnu \
25// RUN: -O0 -o - -c -std=c99 -xc %s | llvm-nm - 2>&1 | \
26// RUN: FileCheck -check-prefix=CHECK-NOINLINE %s
27
Puyan Lotfic382d032019-10-08 15:23:14 +000028// RUN: %clang -c -DINLINE="static" -target x86_64-unknown-linux-gnu -o - \
29// RUN: -emit-interface-stubs -std=c99 -xc %s | \
Puyan Lotfi68f29da2019-06-20 16:59:48 +000030// RUN: FileCheck -check-prefix=CHECK-STATIC %s
31// RUN: %clang -DINLINE="static" -target x86_64-linux-gnu -O0 -o - -c \
32// RUN: -std=c99 -xc %s | llvm-nm - 2>&1 | \
33// RUN: FileCheck -check-prefix=CHECK-STATIC %s
34
35// CHECK-GNU-DAG: foo
36// CHECK-GNU-DAG: foo.var
37// CHECK-NOINLINE-DAG: foo
38// CHECK-NOINLINE-DAG: foo.var
39// CHECK-STATIC-NOT: foo
40// CHECK-STATIC-NOT: foo.var
41// CHECK-STD-NOT: foo
42#pragma clang diagnostic ignored "-Wstatic-local-in-inline"
43INLINE int foo() {
44 static int var = 42;
45 return var;
46}
47
Puyan Lotfic382d032019-10-08 15:23:14 +000048// RUN: %clang -c -DINLINE=inline -target x86_64-linux-gnu -o - \
49// RUN: -emit-interface-stubs \
Puyan Lotfi68f29da2019-06-20 16:59:48 +000050// RUN: -std=gnu89 -xc %s | FileCheck -check-prefix=CHECK-TAPI %s
51
Puyan Lotfic382d032019-10-08 15:23:14 +000052// RUN: %clang -c -DINLINE=inline -target x86_64-linux-gnu -o - \
53// RUN: -emit-interface-stubs \
Puyan Lotfi68f29da2019-06-20 16:59:48 +000054// RUN: -std=gnu89 -xc %s | FileCheck -check-prefix=CHECK-SYMBOLS %s
55// RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -o - \
56// RUN: -c -std=gnu89 -xc %s | llvm-nm - 2>&1 | \
57// RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
58
59// CHECK-TAPI-DAG: foo: { Type: Func }
60// CHECK-TAPI-DAG: foo.var: { Type: Object, Size: 4 }
61// CHECK-SYMBOLS-DAG: foo
62// CHECK-SYMBOLS-DAG: foo.var
63#include "inline.h"