Skip to content

Commit 4006de2

Browse files
committed
- Call extra functions to initialise function
- Simplify test on the assumption that other tests already test the functionaly of the called functions.
1 parent 67d6147 commit 4006de2

File tree

2 files changed

+8
-60
lines changed

2 files changed

+8
-60
lines changed

clang/lib/CodeGen/CGDeclCXX.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,11 @@ llvm::Function *CodeGenModule::CreateGlobalInitOrCleanUpFunction(
447447

448448
if (Linkage == llvm::GlobalVariable::InternalLinkage)
449449
SetInternalFunctionAttributes(GlobalDecl(), Fn, FI);
450-
else
450+
else {
451+
SetLLVMFunctionAttributes(GlobalDecl(), FI, Fn, false);
452+
SetLLVMFunctionAttributesForDefinition(nullptr, Fn);
451453
getTargetCodeGenInfo().setTargetAttributes(nullptr, Fn, *this);
454+
}
452455

453456
Fn->setCallingConv(getRuntimeCC());
454457

clang/test/CodeGenCXX/cxx20-module-initializer-pacbti.cpp

Lines changed: 4 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,14 @@
1-
// RUN: %clang_cc1 -triple thumbv8.1m.main-unknown-none-eabi -emit-module-interface -target-feature +pacbti -mbranch-target-enforce -std=c++20 %s -o %t.pcm
2-
// RUN: %clang_cc1 -triple thumbv8.1m.main-unknown-none-eabi -std=c++20 %t.pcm -emit-llvm -o - | \
3-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-BTI %s
4-
5-
// RUN: %clang_cc1 -triple thumbv8.1m.main-unknown-none-eabi -emit-module-interface -target-feature +pacbti -msign-return-address=non-leaf -std=c++20 %s -o %t.pcm
6-
// RUN: %clang_cc1 -triple thumbv8.1m.main-unknown-none-eabi -std=c++20 %t.pcm -emit-llvm -o - | \
7-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-PAC %s
8-
9-
// RUN: %clang_cc1 -triple thumbv8.1m.main-unknown-none-eabi -emit-module-interface -target-feature +pacbti -msign-return-address=all -std=c++20 %s -o %t.pcm
10-
// RUN: %clang_cc1 -triple thumbv8.1m.main-unknown-none-eabi -std=c++20 %t.pcm -emit-llvm -o - | \
11-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-PAC-ALL %s
12-
13-
// RUN: %clang_cc1 -triple thumbv8.1m.main-unknown-none-eabi -emit-module-interface -target-feature +pacbti -msign-return-address=non-leaf -mbranch-target-enforce -std=c++20 %s -o %t.pcm
14-
// RUN: %clang_cc1 -triple thumbv8.1m.main-unknown-none-eabi -std=c++20 %t.pcm -emit-llvm -o - | \
15-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-PAC-BTI %s
16-
171
// RUN: %clang_cc1 -triple thumbv8.1m.main-unknown-none-eabi -emit-module-interface -target-feature +pacbti -msign-return-address=all -mbranch-target-enforce -std=c++20 %s -o %t.pcm
182
// RUN: %clang_cc1 -triple thumbv8.1m.main-unknown-none-eabi -std=c++20 %t.pcm -emit-llvm -o - | \
19-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-PAC-BTI-ALL %s
20-
21-
// RUN: %clang_cc1 -triple aarch64-unknown-none-elf -emit-module-interface -target-feature +pacbti -mbranch-target-enforce -std=c++20 %s -o %t.pcm
22-
// RUN: %clang_cc1 -triple aarch64-unknown-none-elf -std=c++20 %t.pcm -emit-llvm -o - | \
23-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-BTI %s
24-
25-
// RUN: %clang_cc1 -triple aarch64-unknown-none-elf -emit-module-interface -target-feature +pacbti -msign-return-address=non-leaf -std=c++20 %s -o %t.pcm
26-
// RUN: %clang_cc1 -triple aarch64-unknown-none-elf -std=c++20 %t.pcm -emit-llvm -o - | \
27-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-PAC %s
28-
29-
// RUN: %clang_cc1 -triple aarch64-unknown-none-elf -emit-module-interface -target-feature +pacbti -msign-return-address=non-leaf -msign-return-address-key=b_key -std=c++20 %s -o %t.pcm
30-
// RUN: %clang_cc1 -triple aarch64-unknown-none-elf -std=c++20 %t.pcm -emit-llvm -o - | \
31-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-PAC-BKEY %s
32-
33-
// RUN: %clang_cc1 -triple aarch64-unknown-none-elf -emit-module-interface -target-feature +pacbti -msign-return-address=all -std=c++20 %s -o %t.pcm
34-
// RUN: %clang_cc1 -triple aarch64-unknown-none-elf -std=c++20 %t.pcm -emit-llvm -o - | \
35-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-PAC-ALL %s
36-
37-
// RUN: %clang_cc1 -triple aarch64-unknown-none-elf -emit-module-interface -target-feature +pacbti -msign-return-address=all -msign-return-address-key=b_key -std=c++20 %s -o %t.pcm
38-
// RUN: %clang_cc1 -triple aarch64-unknown-none-elf -std=c++20 %t.pcm -emit-llvm -o - | \
39-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-PAC-ALL-BKEY %s
40-
41-
// RUN: %clang_cc1 -triple aarch64-unknown-none-elf -emit-module-interface -target-feature +pacbti -msign-return-address=non-leaf -mbranch-target-enforce -std=c++20 %s -o %t.pcm
42-
// RUN: %clang_cc1 -triple aarch64-unknown-none-elf -std=c++20 %t.pcm -emit-llvm -o - | \
43-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-PAC-BTI %s
44-
45-
// RUN: %clang_cc1 -triple aarch64-unknown-none-elf -emit-module-interface -target-feature +pacbti -msign-return-address=non-leaf -msign-return-address-key=b_key -mbranch-target-enforce -std=c++20 %s -o %t.pcm
46-
// RUN: %clang_cc1 -triple aarch64-unknown-none-elf -std=c++20 %t.pcm -emit-llvm -o - | \
47-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-PAC-BKEY-BTI %s
48-
49-
// RUN: %clang_cc1 -triple aarch64-unknown-none-elf -emit-module-interface -target-feature +pacbti -msign-return-address=all -mbranch-target-enforce -std=c++20 %s -o %t.pcm
50-
// RUN: %clang_cc1 -triple aarch64-unknown-none-elf -std=c++20 %t.pcm -emit-llvm -o - | \
51-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-PAC-BTI-ALL %s
3+
// RUN: FileCheck --check-prefixes=CHECK,CHECK-PAC-ARM %s
524

535
// RUN: %clang_cc1 -triple aarch64-unknown-none-elf -emit-module-interface -target-feature +pacbti -msign-return-address=all -msign-return-address-key=b_key -mbranch-target-enforce -std=c++20 %s -o %t.pcm
546
// RUN: %clang_cc1 -triple aarch64-unknown-none-elf -std=c++20 %t.pcm -emit-llvm -o - | \
55-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-PAC-BKEY-BTI-ALL %s
7+
// RUN: FileCheck --check-prefixes=CHECK,CHECK-PAC-AARCH64 %s
568

579
// CHECK: define void @_ZGIW3foo() #0
58-
// CHECK-BTI: attributes #0 = { nounwind "branch-target-enforcement" }
59-
// CHECK-PAC: attributes #0 = { nounwind "sign-return-address"="non-leaf" "sign-return-address-key"="a_key" }
60-
// CHECK-PAC-BKEY: attributes #0 = { nounwind "sign-return-address"="non-leaf" "sign-return-address-key"="b_key" }
61-
// CHECK-PAC-ALL: attributes #0 = { nounwind "sign-return-address"="all" "sign-return-address-key"="a_key" }
62-
// CHECK-PAC-ALL-BKEY: attributes #0 = { nounwind "sign-return-address"="all" "sign-return-address-key"="b_key" }
63-
// CHECK-PAC-BTI: attributes #0 = { nounwind "branch-target-enforcement" "sign-return-address"="non-leaf" "sign-return-address-key"="a_key" }
64-
// CHECK-PAC-BKEY-BTI: attributes #0 = { nounwind "branch-target-enforcement" "sign-return-address"="non-leaf" "sign-return-address-key"="b_key" }
65-
// CHECK-PAC-BTI-ALL: attributes #0 = { nounwind "branch-target-enforcement" "sign-return-address"="all" "sign-return-address-key"="a_key" }
66-
// CHECK-PAC-BKEY-BTI-ALL: attributes #0 = { nounwind "branch-target-enforcement" "sign-return-address"="all" "sign-return-address-key"="b_key" }
10+
// CHECK-PAC-ARM: attributes #0 = { noinline nounwind "branch-target-enforcement" "no-trapping-math"="true" "sign-return-address"="all" "sign-return-address-key"="a_key" "stack-protector-buffer-size"="8" "target-features"="+armv8.1-m.main,+pacbti,+thumb-mode" }
11+
// CHECK-PAC-AARCH64: attributes #0 = { noinline nounwind "branch-target-enforcement" "no-trapping-math"="true" "sign-return-address"="all" "sign-return-address-key"="b_key" "stack-protector-buffer-size"="8" "target-features"="+pacbti" }
6712

6813
module;
6914

0 commit comments

Comments
 (0)