Skip to content

Commit 4247cfe

Browse files
committed
[gardening] Refactor code to use getDebugVarName().
Just a thinko on my part. I think I refactored a copy of this code in the address checker into getDebugVarName() and then forgot to eliminate the object from the move value checker...
1 parent e818b25 commit 4247cfe

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

lib/SILOptimizer/Mandatory/MoveKillsCopyableValuesChecker.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -363,17 +363,7 @@ bool MoveKillsCopyableValuesChecker::check() {
363363

364364
// Before we do anything, see if we can find a name for our value. We do
365365
// this early since we need this for all of our diagnostics below.
366-
StringRef varName = "unknown";
367-
if (auto *use = getSingleDebugUse(lexicalValue)) {
368-
DebugVarCarryingInst debugVar(use->getUser());
369-
if (auto varInfo = debugVar.getVarInfo()) {
370-
varName = varInfo->Name;
371-
} else {
372-
if (auto *decl = debugVar.getDecl()) {
373-
varName = decl->getBaseName().userFacingName();
374-
}
375-
}
376-
}
366+
StringRef varName = getDebugVarName(lexicalValue);
377367

378368
// Then compute liveness.
379369
SWIFT_DEFER { livenessInfo.clear(); };

0 commit comments

Comments
 (0)