[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / msan-param-retval.cpp
blobc4960a4702f6cd55fccceb1118d5c79c595d81fe
1 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -o - %s | \
2 // RUN: FileCheck %s --check-prefixes=CLEAN,CHECK
3 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -fno-sanitize-memory-param-retval -o - %s | \
4 // RUN: FileCheck %s --check-prefixes=NOUNDEF,NOUNDEF_ONLY,CHECK
5 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -mllvm -msan-eager-checks -o - %s | \
6 // RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER,CHECK
7 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -fsanitize-memory-param-retval -o - %s | \
8 // RUN: FileCheck %s --check-prefixes=CLEAN,CHECK
9 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -o - %s | \
10 // RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER,CHECK
12 void bar(int x) {
15 // CLEAN: define dso_local void @_Z3bari(i32 %x) #0 {
16 // NOUNDEF: define dso_local void @_Z3bari(i32 noundef %x) #0 {
17 // CLEAN: @__msan_param_tls
18 // NOUNDEF_ONLY: @__msan_param_tls
19 // EAGER-NOT: @__msan_param_tls
20 // CHECK: }
22 int foo() {
23 return 1;
26 // CLEAN: define dso_local i32 @_Z3foov() #0 {
27 // NOUNDEF: define dso_local noundef i32 @_Z3foov() #0 {
28 // CLEAN: @__msan_retval_tls
29 // NOUNDEF_ONLY: @__msan_retval_tls
30 // EAGER-NOT: @__msan_retval_tls
31 // CHECK: }
33 int noret() {
36 // CLEAN: define dso_local i32 @_Z5noretv() #0 {
37 // NOUNDEF: define dso_local noundef i32 @_Z5noretv() #0 {
38 // CHECK: unreachable
39 // CHECK: }