@@ -426,10 +426,15 @@ SILValue VariableNameInferrer::findDebugInfoProvidingValueHelper(
426426 return SILValue ();
427427 }
428428
429- variableNamePath.push_back (allocInst);
429+ variableNamePath.push_back (DebugVarCarryingInst ( allocInst). getName () );
430430 return allocInst;
431431 }
432432
433+ if (auto *abi = dyn_cast<AllocBoxInst>(searchValue)) {
434+ variableNamePath.push_back (DebugVarCarryingInst (abi).getName ());
435+ return abi;
436+ }
437+
433438 // If we have a store_borrow, always look at the dest. We are going to see
434439 // if we can determine if dest is a temporary alloc_stack.
435440 if (auto *sbi = dyn_cast<StoreBorrowInst>(searchValue)) {
@@ -438,7 +443,7 @@ SILValue VariableNameInferrer::findDebugInfoProvidingValueHelper(
438443 }
439444
440445 if (auto *globalAddrInst = dyn_cast<GlobalAddrInst>(searchValue)) {
441- variableNamePath.push_back (globalAddrInst);
446+ variableNamePath.push_back (VarDeclCarryingInst ( globalAddrInst). getName () );
442447 return globalAddrInst;
443448 }
444449
@@ -448,7 +453,7 @@ SILValue VariableNameInferrer::findDebugInfoProvidingValueHelper(
448453 }
449454
450455 if (auto *rei = dyn_cast<RefElementAddrInst>(searchValue)) {
451- variableNamePath.push_back (rei);
456+ variableNamePath.push_back (VarDeclCarryingInst ( rei). getName () );
452457 searchValue = rei->getOperand ();
453458 continue ;
454459 }
@@ -662,15 +667,6 @@ void VariableNameInferrer::popSingleVariableName() {
662667
663668 if (std::holds_alternative<SILInstruction *>(next)) {
664669 auto *inst = std::get<SILInstruction *>(next);
665- if (auto i = DebugVarCarryingInst (inst)) {
666- resultingString += i.getName ();
667- return ;
668- }
669-
670- if (auto i = VarDeclCarryingInst (inst)) {
671- resultingString += i.getName ();
672- return ;
673- }
674670
675671 if (auto f = dyn_cast<FunctionRefBaseInst>(inst)) {
676672 if (auto dc = f->getInitiallyReferencedFunction ()->getDeclContext ()) {
0 commit comments