36 lines · c
1// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm -o - | FileCheck %s2 3void t1(void) __attribute__((naked));4 5// Basic functionality check6// (Note that naked needs to imply noinline to work properly.)7// CHECK: define{{.*}} void @t1() [[NAKED_OPTNONE:#[0-9]+]] {8void t1(void)9{10}11 12// Make sure this doesn't explode in the verifier.13// (It doesn't really make sense, but it isn't invalid.)14// CHECK: define{{.*}} void @t2() [[NAKED:#[0-9]+]] {15__attribute((naked, always_inline)) void t2(void) {16}17 18// Make sure not to generate prolog or epilog for naked functions.19__attribute((naked)) void t3(int x) {20// CHECK: define{{.*}} void @t3(i32 noundef %0)21// CHECK-NOT: alloca22// CHECK-NOT: store23// CHECK: unreachable24}25 26// Make sure naked functions do not attempt to evaluate parameters with a27// variably-modified type. Naked functions get no prolog, so this evaluation28// should not take place.29__attribute__((naked)) void t4(int len, char x[len]) {30 // CHECK: define{{.*}} void @t4(i32 noundef{{.*}}, ptr noundef{{.*}})31 // CHECK: unreachable32}33 34// CHECK: attributes [[NAKED_OPTNONE]] = { naked noinline nounwind optnone{{.*}} }35// CHECK: attributes [[NAKED]] = { naked noinline nounwind{{.*}} }36