Puyan Lotfi | 678e19d | 2019-06-20 18:28:21 +0000 | [diff] [blame] | 1 | // REQUIRES: x86-registered-target |
Puyan Lotfi | e782192 | 2019-11-13 23:58:09 -0500 | [diff] [blame] | 2 | // RUN: %clang_cc1 -DINLINE=inline -triple x86_64-unknown-linux-gnu -o - \ |
Puyan Lotfi | c382d03 | 2019-10-08 15:23:14 +0000 | [diff] [blame] | 3 | // RUN: -emit-interface-stubs -std=gnu89 -xc %s | \ |
Puyan Lotfi | 68f29da | 2019-06-20 16:59:48 +0000 | [diff] [blame] | 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 | |
Puyan Lotfi | e782192 | 2019-11-13 23:58:09 -0500 | [diff] [blame] | 8 | // RUN: %clang_cc1 -DINLINE="__attribute__((always_inline))" \ |
| 9 | // RUN: -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs -xc %s | \ |
Puyan Lotfi | 68f29da | 2019-06-20 16:59:48 +0000 | [diff] [blame] | 10 | // 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 Lotfi | e782192 | 2019-11-13 23:58:09 -0500 | [diff] [blame] | 15 | // RUN: %clang_cc1 -DINLINE=inline -triple x86_64-unknown-linux-gnu -o - \ |
Puyan Lotfi | c382d03 | 2019-10-08 15:23:14 +0000 | [diff] [blame] | 16 | // RUN: -emit-interface-stubs -std=c99 -xc %s | \ |
Puyan Lotfi | 68f29da | 2019-06-20 16:59:48 +0000 | [diff] [blame] | 17 | // RUN: FileCheck -check-prefix=CHECK-STD %s |
| 18 | // RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -O0 -o - -c -std=c99 \ |
Fangrui Song | 932b5d6 | 2020-01-17 10:00:17 -0800 | [diff] [blame] | 19 | // RUN: -xc %s | llvm-nm - 2>&1 | count 0 |
Puyan Lotfi | 68f29da | 2019-06-20 16:59:48 +0000 | [diff] [blame] | 20 | |
Puyan Lotfi | e782192 | 2019-11-13 23:58:09 -0500 | [diff] [blame] | 21 | // RUN: %clang_cc1 -DINLINE="__attribute__((noinline))" \ |
| 22 | // RUN: -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs -std=c99 -xc %s | \ |
Puyan Lotfi | 68f29da | 2019-06-20 16:59:48 +0000 | [diff] [blame] | 23 | // 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 Lotfi | e782192 | 2019-11-13 23:58:09 -0500 | [diff] [blame] | 28 | // RUN: %clang_cc1 -DINLINE="static" -triple x86_64-unknown-linux-gnu -o - \ |
Puyan Lotfi | c382d03 | 2019-10-08 15:23:14 +0000 | [diff] [blame] | 29 | // RUN: -emit-interface-stubs -std=c99 -xc %s | \ |
Puyan Lotfi | 68f29da | 2019-06-20 16:59:48 +0000 | [diff] [blame] | 30 | // RUN: FileCheck -check-prefix=CHECK-STATIC %s |
| 31 | // RUN: %clang -DINLINE="static" -target x86_64-linux-gnu -O0 -o - -c \ |
Fangrui Song | 932b5d6 | 2020-01-17 10:00:17 -0800 | [diff] [blame] | 32 | // RUN: -std=c99 -xc %s | llvm-nm - 2>&1 | count 0 |
Puyan Lotfi | 68f29da | 2019-06-20 16:59:48 +0000 | [diff] [blame] | 33 | |
| 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" |
| 42 | INLINE int foo() { |
| 43 | static int var = 42; |
| 44 | return var; |
| 45 | } |
| 46 | |
Puyan Lotfi | e782192 | 2019-11-13 23:58:09 -0500 | [diff] [blame] | 47 | // RUN: %clang_cc1 -DINLINE=inline -triple x86_64-linux-gnu -o - \ |
Puyan Lotfi | c382d03 | 2019-10-08 15:23:14 +0000 | [diff] [blame] | 48 | // RUN: -emit-interface-stubs \ |
Puyan Lotfi | 68f29da | 2019-06-20 16:59:48 +0000 | [diff] [blame] | 49 | // RUN: -std=gnu89 -xc %s | FileCheck -check-prefix=CHECK-TAPI %s |
| 50 | |
Puyan Lotfi | e782192 | 2019-11-13 23:58:09 -0500 | [diff] [blame] | 51 | // RUN: %clang_cc1 -DINLINE=inline -triple x86_64-linux-gnu -o - \ |
Puyan Lotfi | c382d03 | 2019-10-08 15:23:14 +0000 | [diff] [blame] | 52 | // RUN: -emit-interface-stubs \ |
Puyan Lotfi | 68f29da | 2019-06-20 16:59:48 +0000 | [diff] [blame] | 53 | // 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 Lotfi | e3033c0 | 2020-03-28 04:08:27 -0400 | [diff] [blame] | 58 | // CHECK-TAPI-DAG: foo", Type: Func } |
| 59 | // CHECK-TAPI-DAG: foo.var", Type: Object, Size: 4 } |
Puyan Lotfi | 68f29da | 2019-06-20 16:59:48 +0000 | [diff] [blame] | 60 | // CHECK-SYMBOLS-DAG: foo |
| 61 | // CHECK-SYMBOLS-DAG: foo.var |
| 62 | #include "inline.h" |