Files
clang-p2996/clang/test/CodeGen/attr-nodebug2.c
Bruno De Fraine 4d8871a898 PR50767: clear non-distinct debuginfo for function with nodebug definition after undecorated declaration
Fix suggested by Yuanfang Chen:

Non-distinct debuginfo is attached to the function due to the undecorated declaration. Later, when seeing the function definition and `nodebug` attribute, the non-distinct debuginfo should be cleared.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D104777
2021-06-29 10:26:45 +02:00

35 lines
845 B
C

// RUN: %clang_cc1 -x c -debug-info-kind=limited -debugger-tuning=gdb -dwarf-version=4 -O -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -x c++ -debug-info-kind=limited -debugger-tuning=gdb -dwarf-version=4 -O -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s
#ifdef __cplusplus
extern "C" {
#endif
void t1();
void use() { t1(); }
__attribute__((nodebug)) void t1() {
int a = 10;
a++;
}
#ifdef __cplusplus
}
#endif
// CHECK-LABEL: define{{.*}} void @use()
// CHECK-SAME: !dbg
// CHECK-SAME: {
// CHECK: !dbg
// CHECK: }
// PR50767 Function __attribute__((nodebug)) inconsistency causes crash
// illegal (non-distinct) !dbg metadata was being added to _Z2t1v definition
// CHECK-LABEL: define{{.*}} void @t1()
// CHECK-NOT: !dbg
// CHECK-SAME: {
// CHECK-NOT: !dbg
// CHECK: }