blob: 270fc7959f4437ef76de339d489bbcf5cfbc7ee1 [file] [log] [blame]
Eli Friedman2873aee2011-08-22 23:55:33 +00001// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm -o - | FileCheck %s
Daniel Dunbardd0cb222010-09-29 18:20:25 +00002
3void t1() __attribute__((naked));
4
Eli Friedman2873aee2011-08-22 23:55:33 +00005// Basic functionality check
6// (Note that naked needs to imply noinline to work properly.)
Bill Wendlingc3af6792013-02-26 23:08:48 +00007// CHECK: define void @t1() [[NAKED:#[0-9]+]] {
Daniel Dunbardd0cb222010-09-29 18:20:25 +00008void t1()
9{
10}
11
Eli Friedman2873aee2011-08-22 23:55:33 +000012// Make sure this doesn't explode in the verifier.
13// (It doesn't really make sense, but it isn't invalid.)
Bill Wendlingc3af6792013-02-26 23:08:48 +000014// CHECK: define void @t2() [[NAKED]] {
Stephen Hines176edba2014-12-01 14:53:08 -080015__attribute((naked, always_inline)) void t2() {
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)
21// CHECK-NOT: alloca
22// CHECK-NOT: store
23// CHECK: unreachable
Eli Friedman2873aee2011-08-22 23:55:33 +000024}
Bill Wendlingf7a9da02013-02-20 07:22:19 +000025
Bill Wendlingc3af6792013-02-26 23:08:48 +000026// CHECK: attributes [[NAKED]] = { naked noinline nounwind{{.*}} }