Skip to content

[debug-utils] Split deleteAllDebugUses(ValueBase *) into SILValue and… #27439

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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions include/swift/SIL/DebugUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,22 @@
namespace swift {

class SILInstruction;

/// Deletes all of the debug instructions that use \p Inst.
inline void deleteAllDebugUses(ValueBase *Inst) {
for (auto UI = Inst->use_begin(), E = Inst->use_end(); UI != E;) {
auto *Inst = UI->getUser();
UI++;
if (Inst->isDebugInstruction())
Inst->eraseFromParent();

/// Deletes all of the debug instructions that use \p value.
inline void deleteAllDebugUses(SILValue value) {
for (auto ui = value->use_begin(), ue = value->use_end(); ui != ue;) {
auto *inst = ui->getUser();
++ui;
if (inst->isDebugInstruction()) {
inst->eraseFromParent();
}
}
}

/// Deletes all of the debug uses of any result of \p inst.
inline void deleteAllDebugUses(SILInstruction *inst) {
for (SILValue v : inst->getResults()) {
deleteAllDebugUses(v);
}
}

Expand Down