blob: 1dec4ae677d76cee3554c1b87e47b4a2e0197409 [file] [log] [blame]
Puyan Lotfi678e19d2019-06-20 18:28:21 +00001// REQUIRES: x86-registered-target
Puyan Lotfie7821922019-11-13 23:58:09 -05002// RUN: %clang_cc1 -DINLINE=inline -triple x86_64-unknown-linux-gnu -o - \
Puyan Lotfic382d032019-10-08 15:23:14 +00003// 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 Lotfie7821922019-11-13 23:58:09 -05008// RUN: %clang_cc1 -DINLINE="__attribute__((always_inline))" \
9// RUN: -triple 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 Lotfie7821922019-11-13 23:58:09 -050015// RUN: %clang_cc1 -DINLINE=inline -triple x86_64-unknown-linux-gnu -o - \
Puyan Lotfic382d032019-10-08 15:23:14 +000016// 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 \
Fangrui Song932b5d62020-01-17 10:00:17 -080019// RUN: -xc %s | llvm-nm - 2>&1 | count 0
Puyan Lotfi68f29da2019-06-20 16:59:48 +000020
Puyan Lotfie7821922019-11-13 23:58:09 -050021// RUN: %clang_cc1 -DINLINE="__attribute__((noinline))" \
22// RUN: -triple 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 Lotfie7821922019-11-13 23:58:09 -050028// RUN: %clang_cc1 -DINLINE="static" -triple x86_64-unknown-linux-gnu -o - \
Puyan Lotfic382d032019-10-08 15:23:14 +000029// 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 \
Fangrui Song932b5d62020-01-17 10:00:17 -080032// RUN: -std=c99 -xc %s | llvm-nm - 2>&1 | count 0
Puyan Lotfi68f29da2019-06-20 16:59:48 +000033
34// CHECK-GNU-DAG: foo
35// CHECK-GNU-DAG: foo.var
36// CHECK-NOINLINE-DAG: foo
37// CHECK-NOINLINE-DAG: foo.var
38// CHECK-STATIC-NOT: foo
39// CHECK-STATIC-NOT: foo.var
40// CHECK-STD-NOT: foo
41#pragma clang diagnostic ignored "-Wstatic-local-in-inline"
42INLINE int foo() {
43 static int var = 42;
44 return var;
45}
46
Puyan Lotfie7821922019-11-13 23:58:09 -050047// RUN: %clang_cc1 -DINLINE=inline -triple x86_64-linux-gnu -o - \
Puyan Lotfic382d032019-10-08 15:23:14 +000048// RUN: -emit-interface-stubs \
Puyan Lotfi68f29da2019-06-20 16:59:48 +000049// RUN: -std=gnu89 -xc %s | FileCheck -check-prefix=CHECK-TAPI %s
50
Puyan Lotfie7821922019-11-13 23:58:09 -050051// RUN: %clang_cc1 -DINLINE=inline -triple x86_64-linux-gnu -o - \
Puyan Lotfic382d032019-10-08 15:23:14 +000052// RUN: -emit-interface-stubs \
Puyan Lotfi68f29da2019-06-20 16:59:48 +000053// RUN: -std=gnu89 -xc %s | FileCheck -check-prefix=CHECK-SYMBOLS %s
54// RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -o - \
55// RUN: -c -std=gnu89 -xc %s | llvm-nm - 2>&1 | \
56// RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
57
Puyan Lotfie3033c02020-03-28 04:08:27 -040058// CHECK-TAPI-DAG: foo", Type: Func }
59// CHECK-TAPI-DAG: foo.var", Type: Object, Size: 4 }
Puyan Lotfi68f29da2019-06-20 16:59:48 +000060// CHECK-SYMBOLS-DAG: foo
61// CHECK-SYMBOLS-DAG: foo.var
62#include "inline.h"