forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Vector deleting destructors #3
Open
Fznamznon
wants to merge
15
commits into
main
Choose a base branch
from
vector-deleting-destructors
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2a63bcb
Add rough body emission
Fznamznon 81e7dfc
Add support for MSVC vector deleting destructors
smanna12 45151cd
Fix fiormat
smanna12 733b225
Add support for EmitDefinitionAsAlias()
smanna12 d4be529
Address review commnets
smanna12 2c388db
Tweak implementation to make the functions to appear
Fznamznon 6b6ff04
Merge branch 'main' into vector-deleting-destructors
Fznamznon 8cac3a7
VTable refers to _E (vector), emit _G (scalar), create alias from vector
Fznamznon 2f0bba9
Pass 3 to destructor for delete[]
Fznamznon 37ff3e8
Generate vector deleting dtor for new[]
Fznamznon e0fd7f7
Fix some LIT tests
Fznamznon 0bd5f61
Fix more LIT tests
Fznamznon af633d2
Some functions reordered in this test, I don't really get why
Fznamznon 4f50e81
Merge branch 'main' into vector-deleting-destructors
Fznamznon c5bb3df
Emit vector deleting dtor even if scalar dtor was emitted already
Fznamznon 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 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 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 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 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 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 | ||||
---|---|---|---|---|---|---|
|
@@ -1341,7 +1341,6 @@ void ItaniumVTableBuilder::AddMethod(const CXXMethodDecl *MD, | |||||
if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(MD)) { | ||||||
assert(ReturnAdjustment.isEmpty() && | ||||||
"Destructor can't have return adjustment!"); | ||||||
|
||||||
// Add both the complete destructor and the deleting destructor. | ||||||
Components.push_back(VTableComponent::MakeCompleteDtor(DD)); | ||||||
Components.push_back(VTableComponent::MakeDeletingDtor(DD)); | ||||||
|
@@ -1733,7 +1732,7 @@ void ItaniumVTableBuilder::LayoutPrimaryAndSecondaryVTables( | |||||
const CXXMethodDecl *MD = I.first; | ||||||
const MethodInfo &MI = I.second; | ||||||
if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(MD)) { | ||||||
MethodVTableIndices[GlobalDecl(DD, Dtor_Complete)] | ||||||
MethodVTableIndices[GlobalDecl(DD, Dtor_Complete)] | ||||||
= MI.VTableIndex - AddressPoint; | ||||||
MethodVTableIndices[GlobalDecl(DD, Dtor_Deleting)] | ||||||
= MI.VTableIndex + 1 - AddressPoint; | ||||||
|
@@ -2655,7 +2654,11 @@ class VFTableBuilder { | |||||
MethodVFTableLocation Loc(MI.VBTableIndex, WhichVFPtr.getVBaseWithVPtr(), | ||||||
WhichVFPtr.NonVirtualOffset, MI.VFTableIndex); | ||||||
if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(MD)) { | ||||||
MethodVFTableLocations[GlobalDecl(DD, Dtor_Deleting)] = Loc; | ||||||
if (!Context.getTargetInfo().getCXXABI().isMicrosoft()) { | ||||||
MethodVFTableLocations[GlobalDecl(DD, Dtor_Deleting)] = Loc; | ||||||
} else { | ||||||
MethodVFTableLocations[GlobalDecl(DD, Dtor_VectorDeleting)] = Loc; | ||||||
} | ||||||
} else { | ||||||
MethodVFTableLocations[MD] = Loc; | ||||||
} | ||||||
|
@@ -3285,7 +3288,10 @@ void VFTableBuilder::dumpLayout(raw_ostream &Out) { | |||||
const CXXDestructorDecl *DD = Component.getDestructorDecl(); | ||||||
|
||||||
DD->printQualifiedName(Out); | ||||||
Out << "() [scalar deleting]"; | ||||||
if (Context.getTargetInfo().getCXXABI().isMicrosoft()) | ||||||
Out << "() [vector deleting]"; | ||||||
else | ||||||
Out << "() [deleting]"; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
if (DD->isPureVirtual()) | ||||||
Out << " [pure]"; | ||||||
|
@@ -3756,7 +3762,7 @@ void MicrosoftVTableContext::dumpMethodLocations( | |||||
PredefinedIdentKind::PrettyFunctionNoVirtual, MD); | ||||||
|
||||||
if (isa<CXXDestructorDecl>(MD)) { | ||||||
IndicesMap[I.second] = MethodName + " [scalar deleting]"; | ||||||
IndicesMap[I.second] = MethodName + " [deleting]"; | ||||||
} else { | ||||||
IndicesMap[I.second] = MethodName; | ||||||
} | ||||||
|
@@ -3872,8 +3878,10 @@ MethodVFTableLocation | |||||
MicrosoftVTableContext::getMethodVFTableLocation(GlobalDecl GD) { | ||||||
assert(hasVtableSlot(cast<CXXMethodDecl>(GD.getDecl())) && | ||||||
"Only use this method for virtual methods or dtors"); | ||||||
if (isa<CXXDestructorDecl>(GD.getDecl())) | ||||||
assert(GD.getDtorType() == Dtor_Deleting); | ||||||
if (isa<CXXDestructorDecl>(GD.getDecl())) { | ||||||
assert(GD.getDtorType() == Dtor_Deleting || | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
GD.getDtorType() == Dtor_VectorDeleting); | ||||||
} | ||||||
|
||||||
GD = GD.getCanonicalDecl(); | ||||||
|
||||||
|
This file contains 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 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 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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See into that fixme