xref: /llvm-project/clang/test/CodeGen/ubsan-debuglog-return.c (revision 12f78e740c5419f7d1fbcf8f2106e7a40cd1d6f7)
1 // RUN: %clang_cc1 -Wno-error=return-type -x c -debug-info-kind=line-tables-only -emit-llvm -fsanitize=returns-nonnull-attribute -o - %s | FileCheck %s
2 // The UBSAN function call in the epilogue needs to have a debug location.
3 
4 __attribute__((returns_nonnull)) void *allocate(void) {}
5 
6 // CHECK: define {{.*}}nonnull ptr @allocate(){{.*}} !dbg
7 // CHECK: call void @__ubsan_handle_nonnull_return_v1_abort
8 // CHECK-SAME:  !dbg ![[LOC:[0-9]+]]
9 // CHECK: ret ptr
10 // CHECK-SAME:  !dbg ![[LOC]]
11