-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[clang][DebugInfo] Emit unified (Itanium) mangled name to structor declarations #154142
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
Merged
Michael137
merged 13 commits into
llvm:main
from
Michael137:debuginfo/mangled-structor-declarations
Sep 9, 2025
Merged
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a4ec01a
[llvm][DebugInfo] Support DW_AT_linkage_names that are different betw…
Michael137 7409931
[clang][DebugInfo] Emit unified (Itanium) mangled name to structor de…
Michael137 413acc0
fixup! switch-statement warnings
Michael137 2ee5601
fixup! add clang driver option
Michael137 baee3df
fixup! fix test
Michael137 e0efda1
fixup! fix test
Michael137 3bff525
fixup! add comment
Michael137 fabc88b
fixup! add DocBrief
Michael137 a062b76
fixup! move test
Michael137 91da739
fixup! fix test
Michael137 522f021
fixup! rename test
Michael137 2cc1297
fixup! add test for function local structors
Michael137 f76f33c
Merge branch 'main' into debuginfo/mangled-structor-declarations
Michael137 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
clang/test/DebugInfo/CXX/debug-info-structor-linkage-names.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// Tests that we emit unified constructor/destructor linkage names | ||
// for ABIs that support it. | ||
|
||
// Check that -gstructor-decl-linkage-names is the default. | ||
// RUN: %clang_cc1 -triple aarch64-apple-macosx -emit-llvm -debug-info-kind=standalone \ | ||
// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,ITANIUM | ||
// | ||
// Check with -gstructor-decl-linkage-names. | ||
// RUN: %clang_cc1 -triple aarch64-apple-macosx -emit-llvm -debug-info-kind=standalone \ | ||
// RUN: -gstructor-decl-linkage-names %s -o - | FileCheck %s --check-prefixes=CHECK,ITANIUM | ||
// | ||
// Check with -gno-structor-decl-linkage-names. | ||
// RUN: %clang_cc1 -triple aarch64-apple-macosx -emit-llvm -debug-info-kind=standalone \ | ||
// RUN: -gno-structor-decl-linkage-names %s -o - | FileCheck %s --check-prefixes=CHECK,DISABLE | ||
// | ||
// Check ABI without structor variants. | ||
// RUN: %clang_cc1 -triple x86_64-windows-msvc -emit-llvm -debug-info-kind=standalone \ | ||
// RUN: -gstructor-decl-linkage-names %s -o - | FileCheck %s --check-prefixes=CHECK,MSABI | ||
|
||
struct Base { | ||
Base(int x); | ||
~Base(); | ||
}; | ||
|
||
Base::Base(int x) {} | ||
Base::~Base() {} | ||
|
||
// Check that we emit unified ctor/dtor (C4/D4) on Itanium but not for MS-ABI. | ||
|
||
// CHECK: ![[BASE_CTOR_DECL:[0-9]+]] = !DISubprogram(name: "Base" | ||
// MSABI-NOT: linkageName: | ||
// DISABLE-NOT: linkageName: | ||
// ITANIUM-SAME: linkageName: "_ZN4BaseC4Ei" | ||
// CHECK-SAME: spFlags: 0 | ||
|
||
// CHECK: ![[BASE_DTOR_DECL:[0-9]+]] = !DISubprogram(name: "~Base" | ||
// MSABI-NOT: linkageName: | ||
// DISABLE-NOT: linkageName: | ||
// ITANIUM-SAME: linkageName: "_ZN4BaseD4Ev" | ||
// CHECK-SAME: spFlags: 0 | ||
|
||
// Check that the ctor/dtor definitions have linkage names that aren't | ||
// the ones on the declaration. | ||
|
||
// CHECK: !DISubprogram(name: "Base" | ||
// MSABI-SAME: linkageName: | ||
// ITANIUM-SAME: linkageName: "_ZN4BaseC2Ei" | ||
// CHECK-SAME: spFlags: DISPFlagDefinition | ||
// CHECK-SAME: declaration: ![[BASE_CTOR_DECL]] | ||
|
||
// ITANIUM: !DISubprogram(name: "Base" | ||
// ITANIUM-SAME: linkageName: "_ZN4BaseC1Ei" | ||
// ITANIUM-SAME: spFlags: DISPFlagDefinition | ||
// ITANIUM-SAME: declaration: ![[BASE_CTOR_DECL]] | ||
|
||
// CHECK: !DISubprogram(name: "~Base" | ||
// MSABI-SAME: linkageName: | ||
// ITANIUM-SAME: linkageName: "_ZN4BaseD2Ev" | ||
// CHECK-SAME: spFlags: DISPFlagDefinition | ||
// CHECK-SAME: declaration: ![[BASE_DTOR_DECL]] | ||
|
||
// ITANIUM: !DISubprogram(name: "~Base" | ||
// ITANIUM-SAME: linkageName: "_ZN4BaseD1Ev" | ||
// ITANIUM-SAME: spFlags: DISPFlagDefinition | ||
// ITANIUM-SAME: declaration: ![[BASE_DTOR_DECL]] | ||
|
||
struct Derived : public Base { | ||
using Base::Base; | ||
} d(5); | ||
|
||
// CHECK: !DISubprogram(name: "Base" | ||
// MSABI-SAME: linkageName: | ||
// ITANIUM-SAME: linkageName: "_ZN7DerivedCI14BaseEi" | ||
// CHECK-SAME: spFlags: {{.*}}DISPFlagDefinition | ||
// CHECK-SAME: declaration: ![[BASE_INHERIT_CTOR_DECL:[0-9]+]] | ||
|
||
// CHECK: [[BASE_INHERIT_CTOR_DECL]] = !DISubprogram(name: "Base" | ||
// MSABI-NOT: linkageName: | ||
// DISABLE-NOT: linkageName: | ||
// ITANIUM-SAME: linkageName: "_ZN7DerivedCI44BaseEi" | ||
// CHECK-SAME spFlags: 0 | ||
|
||
// ITANIUM: !DISubprogram(name: "Base" | ||
// ITANIUM-SAME: linkageName: "_ZN7DerivedCI24BaseEi" | ||
// ITANIUM-SAME: spFlags: DISPFlagDefinition | ||
// ITANIUM-SAME: declaration: ![[BASE_INHERIT_CTOR_DECL:[0-9]+]] | ||
|
||
// MSABI: !DISubprogram(name: "~Derived" | ||
// DISABLE: !DISubprogram(name: "~Derived" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.