1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm -o - | FileCheck %s 2f4a2713aSLionel Sambuc 3f4a2713aSLionel Sambuc void t1() __attribute__((naked)); 4f4a2713aSLionel Sambuc 5f4a2713aSLionel Sambuc // Basic functionality check 6f4a2713aSLionel Sambuc // (Note that naked needs to imply noinline to work properly.) 7f4a2713aSLionel Sambuc // CHECK: define void @t1() [[NAKED:#[0-9]+]] { t1()8f4a2713aSLionel Sambucvoid t1() 9f4a2713aSLionel Sambuc { 10f4a2713aSLionel Sambuc } 11f4a2713aSLionel Sambuc 12f4a2713aSLionel Sambuc // Make sure this doesn't explode in the verifier. 13f4a2713aSLionel Sambuc // (It doesn't really make sense, but it isn't invalid.) 14f4a2713aSLionel Sambuc // CHECK: define void @t2() [[NAKED]] { t2()15f4a2713aSLionel Sambuc__attribute((naked, always_inline)) void t2() { 16*0a6a1f1dSLionel Sambuc } 17*0a6a1f1dSLionel Sambuc 18*0a6a1f1dSLionel Sambuc // Make sure not to generate prolog or epilog for naked functions. t3(int x)19*0a6a1f1dSLionel Sambuc__attribute((naked)) void t3(int x) { 20*0a6a1f1dSLionel Sambuc // CHECK: define void @t3(i32) 21*0a6a1f1dSLionel Sambuc // CHECK-NOT: alloca 22*0a6a1f1dSLionel Sambuc // CHECK-NOT: store 23*0a6a1f1dSLionel Sambuc // CHECK: unreachable 24f4a2713aSLionel Sambuc } 25f4a2713aSLionel Sambuc 26f4a2713aSLionel Sambuc // CHECK: attributes [[NAKED]] = { naked noinline nounwind{{.*}} } 27