blob: 50b96ea883a1a6ee5d3e9d8daf109e4f0f215c1f [file] [log] [blame]
Fangrui Songa44c4342020-01-04 15:39:19 -08001// RUN: %clang_cc1 -triple aarch64 -emit-llvm %s -o - | FileCheck %s
Fangrui Songf17ae662020-01-04 16:58:11 -08002// RUN: %clang_cc1 -triple x86_64 -emit-llvm %s -fpatchable-function-entry=1 -o - | FileCheck --check-prefixes=CHECK,OPT %s
Fangrui Songa44c4342020-01-04 15:39:19 -08003
4// CHECK: define void @f0() #0
5__attribute__((patchable_function_entry(0))) void f0() {}
6
7// CHECK: define void @f00() #0
8__attribute__((patchable_function_entry(0, 0))) void f00() {}
9
10// CHECK: define void @f2() #1
11__attribute__((patchable_function_entry(2))) void f2() {}
12
13// CHECK: define void @f20() #1
14__attribute__((patchable_function_entry(2, 0))) void f20() {}
15
16// CHECK: define void @f20decl() #1
17__attribute__((patchable_function_entry(2, 0))) void f20decl();
18void f20decl() {}
19
Fangrui Songf17ae662020-01-04 16:58:11 -080020// OPT: define void @f() #2
21void f() {}
22
Fangrui Songa44c4342020-01-04 15:39:19 -080023/// M in patchable_function_entry(N,M) is currently ignored.
24// CHECK: attributes #0 = { {{.*}} "patchable-function-entry"="0"
25// CHECK: attributes #1 = { {{.*}} "patchable-function-entry"="2"
Fangrui Songf17ae662020-01-04 16:58:11 -080026// OPT: attributes #2 = { {{.*}} "patchable-function-entry"="1"