llvm-project/clang/test/CodeGenCXX/debug-info-object-pointer.cpp
Michael Buch 10fdd09c3b
[clang][DebugInfo] Emit DW_AT_object_pointer on function declarations with explicit this (#122928)
In https://github.com/llvm/llvm-project/pull/122897 we started attaching
`DW_AT_object_pointer` to function definitions. This patch does the same
but for function declarations (which we do for implicit object pointers
already).

Fixes https://github.com/llvm/llvm-project/issues/120974
2025-01-17 19:51:14 +00:00

29 lines
866 B
C++

// RUN: %clang_cc1 -x c++ -std=c++23 -debug-info-kind=limited -emit-llvm < %s | FileCheck %s
// CHECK: !DISubprogram(name: "bar",
// CHECK-SAME: flags: DIFlagPrototyped
// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
// CHECK-SAME: flags: DIFlagArtificial | DIFlagObjectPointer
//
// CHECK: !DISubprogram(name: "explicit_this",
// flags: DIFlagPrototyped
//
// CHECK: !DIDerivedType(tag: DW_TAG_rvalue_reference_type
// CHECK-SAME: flags: DIFlagObjectPointer)
//
// CHECK: !DILocalVariable(name: "this", arg: 1
// CHECK-SAME: flags: DIFlagArtificial | DIFlagObjectPointer
//
// CHECK-NOT: DIFlagArtificial
// CHECK: !DILocalVariable(arg: 1, {{.*}}, flags: DIFlagObjectPointer)
struct Foo {
void bar() {}
void explicit_this(this Foo &&) {}
};
void f() {
Foo{}.bar();
Foo{}.explicit_this();
}