mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 21:16:05 +00:00

Currently we would unconditionally add an implicit `this` parameter when creating an instance method type. However, when we have an explicit 'this', we shouldn't generate one. This patch only passes a valid `ThisPtr` type to `getOrCreateInstanceMethodType` if one wasn't explicitly specified. There's no way to get a pointer to a member function with an explicit `this` parameter (those are treated as regular function pointers instead). So there's no need to account for that case in `CGDebugInfo::CreateType`. Fixes https://github.com/llvm/llvm-project/issues/99744
17 lines
696 B
C++
17 lines
696 B
C++
// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -std=c++2b %s -o - | FileCheck %s
|
|
|
|
struct Foo {
|
|
void Bar(this Foo&& self) {}
|
|
};
|
|
|
|
void fn() {
|
|
Foo{}.Bar();
|
|
}
|
|
|
|
// CHECK: distinct !DISubprogram(name: "Bar", {{.*}}, type: ![[BAR_TYPE:[0-9]+]], {{.*}}, declaration: ![[BAR_DECL:[0-9]+]], {{.*}}
|
|
// CHECK: ![[FOO:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo"
|
|
// CHECK: ![[BAR_DECL]] = !DISubprogram(name: "Bar", {{.*}}, type: ![[BAR_TYPE]], {{.*}},
|
|
// CHECK: ![[BAR_TYPE]] = !DISubroutineType(types: ![[PARAMS:[0-9]+]])
|
|
// CHECK: ![[PARAMS]] = !{null, ![[SELF:[0-9]+]]}
|
|
// CHECK: ![[SELF]] = !DIDerivedType(tag: DW_TAG_rvalue_reference_type, baseType: ![[FOO]]
|