@@ -454,38 +454,38 @@ SILValue VariableNameInferrer::findDebugInfoProvidingValueHelper(
454454 }
455455
456456 if (auto *sei = dyn_cast<StructExtractInst>(searchValue)) {
457- variableNamePath.push_back (sei);
457+ variableNamePath.push_back (getNameFromDecl ( sei-> getField ()) );
458458 searchValue = sei->getOperand ();
459459 continue ;
460460 }
461461
462462 if (auto *uedi = dyn_cast<UncheckedEnumDataInst>(searchValue)) {
463- variableNamePath.push_back (uedi);
463+ variableNamePath.push_back (getNameFromDecl ( uedi-> getElement ()) );
464464 searchValue = uedi->getOperand ();
465465 continue ;
466466 }
467467
468468 if (auto *tei = dyn_cast<TupleExtractInst>(searchValue)) {
469- variableNamePath.push_back (tei);
469+ variableNamePath.push_back (getStringRefForIndex ( tei-> getFieldIndex ()) );
470470 searchValue = tei->getOperand ();
471471 continue ;
472472 }
473473
474474 if (auto *sei = dyn_cast<StructElementAddrInst>(searchValue)) {
475- variableNamePath.push_back (sei);
475+ variableNamePath.push_back (getNameFromDecl ( sei-> getField ()) );
476476 searchValue = sei->getOperand ();
477477 continue ;
478478 }
479479
480480 if (auto *tei = dyn_cast<TupleElementAddrInst>(searchValue)) {
481- variableNamePath.push_back (tei);
481+ variableNamePath.push_back (getStringRefForIndex ( tei-> getFieldIndex ()) );
482482 searchValue = tei->getOperand ();
483483 continue ;
484484 }
485485
486- if (auto *e = dyn_cast<UncheckedTakeEnumDataAddrInst>(searchValue)) {
487- variableNamePath.push_back (e );
488- searchValue = e ->getOperand ();
486+ if (auto *utedai = dyn_cast<UncheckedTakeEnumDataAddrInst>(searchValue)) {
487+ variableNamePath.push_back (getNameFromDecl (utedai-> getElement ()) );
488+ searchValue = utedai ->getOperand ();
489489 continue ;
490490 }
491491
@@ -494,7 +494,7 @@ SILValue VariableNameInferrer::findDebugInfoProvidingValueHelper(
494494 // them and add the case to the variableNamePath.
495495 if (auto *e = dyn_cast<EnumInst>(searchValue)) {
496496 if (e->hasOperand ()) {
497- variableNamePath.push_back (e );
497+ variableNamePath.push_back (getNameFromDecl (e-> getElement ()) );
498498 searchValue = e->getOperand ();
499499 continue ;
500500 }
@@ -687,43 +687,6 @@ void VariableNameInferrer::popSingleVariableName() {
687687 return ;
688688 }
689689
690- if (auto *sei = dyn_cast<StructExtractInst>(inst)) {
691- resultingString += getNameFromDecl (sei->getField ());
692- return ;
693- }
694-
695- if (auto *tei = dyn_cast<TupleExtractInst>(inst)) {
696- llvm::raw_svector_ostream stream (resultingString);
697- stream << tei->getFieldIndex ();
698- return ;
699- }
700-
701- if (auto *uedi = dyn_cast<UncheckedEnumDataInst>(inst)) {
702- resultingString += getNameFromDecl (uedi->getElement ());
703- return ;
704- }
705-
706- if (auto *sei = dyn_cast<StructElementAddrInst>(inst)) {
707- resultingString += getNameFromDecl (sei->getField ());
708- return ;
709- }
710-
711- if (auto *tei = dyn_cast<TupleElementAddrInst>(inst)) {
712- llvm::raw_svector_ostream stream (resultingString);
713- stream << tei->getFieldIndex ();
714- return ;
715- }
716-
717- if (auto *uedi = dyn_cast<UncheckedTakeEnumDataAddrInst>(inst)) {
718- resultingString += getNameFromDecl (uedi->getElement ());
719- return ;
720- }
721-
722- if (auto *ei = dyn_cast<EnumInst>(inst)) {
723- resultingString += getNameFromDecl (ei->getElement ());
724- return ;
725- }
726-
727690 resultingString += " <unknown decl>" ;
728691 return ;
729692 }
0 commit comments