-
Notifications
You must be signed in to change notification settings - Fork 13.4k
"vtt" missing in SubroutineType #104765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-clang-codegen Author: None (mgschossmann)
When compiling following source, clang creates a virtual destructor for `A` with an artificial `vtt` argument. The `DILocalVariable` for `vtt` correctly has `arg: 2`.
However, the field `types` of the `DISubroutineType` for this virtual destructor seems to miss the additional parameter, as it only has two members and thus represents a function with only one parameter.
Source: struct B {
virtual ~B() {}
};
struct A : virtual B {
};
A a; LLVM-IR: [...]
!5 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !3, line: 5, size: 64, flags: DIFlagTypePassByReference | DIFlagNonTrivial, elements: !6, vtableHolder: !8, identifier: "_ZTS1A")
[...]
!34 = !DISubroutineType(types: !35)
!35 = !{null, !36}
!36 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !5, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
[...]
!70 = distinct !DISubprogram(name: "~A", linkageName: "_ZN1AD2Ev", scope: !5, file: !3, line: 5, type: !34, scopeLine: 5, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, declaration: !44, retainedNodes: !38)
!71 = !DILocalVariable(name: "this", arg: 1, scope: !70, type: !40, flags: DIFlagArtificial | DIFlagObjectPointer)
!72 = !DILocation(line: 0, scope: !70)
!73 = !DILocalVariable(name: "vtt", arg: 2, scope: !70, type: !74, flags: DIFlagArtificial)
!74 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !75, size: 64)
!75 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
[...] I generated the IR using clang 19.1.0-rc2 on The issue seems to be that in llvm-project/clang/lib/CodeGen/ItaniumCXXABI.cpp Lines 1870 to 1890 in d033ae1
llvm-project/clang/lib/CodeGen/CGDebugInfo.cpp Lines 1938 to 1946 in d033ae1
|
@llvm/issue-subscribers-debuginfo Author: None (mgschossmann)
When compiling following source, clang creates a virtual destructor for `A` with an artificial `vtt` argument. The `DILocalVariable` for `vtt` correctly has `arg: 2`.
However, the field `types` of the `DISubroutineType` for this virtual destructor seems to miss the additional parameter, as it only has two members and thus represents a function with only one parameter.
Source: struct B {
virtual ~B() {}
};
struct A : virtual B {
};
A a; LLVM-IR: [...]
!5 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !3, line: 5, size: 64, flags: DIFlagTypePassByReference | DIFlagNonTrivial, elements: !6, vtableHolder: !8, identifier: "_ZTS1A")
[...]
!34 = !DISubroutineType(types: !35)
!35 = !{null, !36}
!36 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !5, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
[...]
!70 = distinct !DISubprogram(name: "~A", linkageName: "_ZN1AD2Ev", scope: !5, file: !3, line: 5, type: !34, scopeLine: 5, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, declaration: !44, retainedNodes: !38)
!71 = !DILocalVariable(name: "this", arg: 1, scope: !70, type: !40, flags: DIFlagArtificial | DIFlagObjectPointer)
!72 = !DILocation(line: 0, scope: !70)
!73 = !DILocalVariable(name: "vtt", arg: 2, scope: !70, type: !74, flags: DIFlagArtificial)
!74 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !75, size: 64)
!75 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
[...] I generated the IR using clang 19.1.0-rc2 on The issue seems to be that in llvm-project/clang/lib/CodeGen/ItaniumCXXABI.cpp Lines 1870 to 1890 in d033ae1
llvm-project/clang/lib/CodeGen/CGDebugInfo.cpp Lines 1938 to 1946 in d033ae1
|
…lvm#130674) Fixes issue llvm#104765: When creating a virtual destructor with an artificial "vtt" argument, the type of "vtt" was previously missing in the `DISubroutineType` `types` array. This commit fixes this behavior and adds a regression test.
When compiling following source, clang creates a virtual destructor for
A
with an artificialvtt
argument. TheDILocalVariable
forvtt
correctly hasarg: 2
.However, the field
types
of theDISubroutineType
for this virtual destructor seems to miss the additional parameter, as it only has two members and thus represents a function with only one parameter.Source:
LLVM-IR:
I generated the IR using clang 19.1.0-rc2 on
x86_64-unknown-linux-gnu
.DWARF generated from this IR is not affected and includes all formal parameters.
The issue seems to be that in
ItaniumCXXABI::addImplicitStructorParams
, the parameter is added, but inCGDebugInfo::getOrCreateMethodType
another type array is read to create theDISubroutineType
.llvm-project/clang/lib/CodeGen/ItaniumCXXABI.cpp
Lines 1870 to 1890 in d033ae1
llvm-project/clang/lib/CodeGen/CGDebugInfo.cpp
Lines 1938 to 1946 in d033ae1
The text was updated successfully, but these errors were encountered: