63 lines · c
1// REQUIRES: x86-registered-target2// RUN: %clang_cc1 -DINLINE=inline -triple x86_64-unknown-linux-gnu -o - \3// RUN: -emit-interface-stubs -std=gnu89 -xc %s | \4// RUN: FileCheck -check-prefix=CHECK-GNU %s5// 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 %s7 8// RUN: %clang_cc1 -DINLINE="__attribute__((always_inline))" \9// RUN: -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs -xc %s | \10// RUN: FileCheck -check-prefix=CHECK-GNU %s11// 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 %s14 15// RUN: %clang_cc1 -DINLINE=inline -triple x86_64-unknown-linux-gnu -o - \16// RUN: -emit-interface-stubs -std=c99 -xc %s | \17// RUN: FileCheck -check-prefix=CHECK-STD %s18// RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -O0 -o - -c -std=c99 \19// RUN: -xc %s | llvm-nm - 2>&1 | count 020 21// RUN: %clang_cc1 -DINLINE="__attribute__((noinline))" \22// RUN: -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs -std=c99 -xc %s | \23// RUN: FileCheck -check-prefix=CHECK-NOINLINE %s24// 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 %s27 28// RUN: %clang_cc1 -DINLINE="static" -triple x86_64-unknown-linux-gnu -o - \29// RUN: -emit-interface-stubs -std=c99 -xc %s | \30// RUN: FileCheck -check-prefix=CHECK-STATIC %s31// RUN: %clang -DINLINE="static" -target x86_64-linux-gnu -O0 -o - -c \32// RUN: -std=c99 -xc %s | llvm-nm - 2>&1 | count 033 34// CHECK-GNU-DAG: foo35// CHECK-GNU-DAG: foo.var36// CHECK-NOINLINE-DAG: foo37// CHECK-NOINLINE-DAG: foo.var38// CHECK-STATIC-NOT: foo39// CHECK-STATIC-NOT: foo.var40// CHECK-STD-NOT: foo41#pragma clang diagnostic ignored "-Wstatic-local-in-inline"42INLINE int foo(void) {43 static int var = 42;44 return var;45}46 47// RUN: %clang_cc1 -DINLINE=inline -triple x86_64-linux-gnu -o - \48// RUN: -emit-interface-stubs \49// RUN: -std=gnu89 -xc %s | FileCheck -check-prefix=CHECK-TAPI %s50 51// RUN: %clang_cc1 -DINLINE=inline -triple x86_64-linux-gnu -o - \52// RUN: -emit-interface-stubs \53// RUN: -std=gnu89 -xc %s | FileCheck -check-prefix=CHECK-SYMBOLS %s54// 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 %s57 58// CHECK-TAPI-DAG: foo", Type: Func }59// CHECK-TAPI-DAG: foo.var", Type: Object, Size: 4 }60// CHECK-SYMBOLS-DAG: foo61// CHECK-SYMBOLS-DAG: foo.var62#include "inline.h"63