@@ -454,38 +454,38 @@ SILValue VariableNameInferrer::findDebugInfoProvidingValueHelper(
454
454
}
455
455
456
456
if (auto *sei = dyn_cast<StructExtractInst>(searchValue)) {
457
- variableNamePath.push_back (sei);
457
+ variableNamePath.push_back (getNameFromDecl ( sei-> getField ()) );
458
458
searchValue = sei->getOperand ();
459
459
continue ;
460
460
}
461
461
462
462
if (auto *uedi = dyn_cast<UncheckedEnumDataInst>(searchValue)) {
463
- variableNamePath.push_back (uedi);
463
+ variableNamePath.push_back (getNameFromDecl ( uedi-> getElement ()) );
464
464
searchValue = uedi->getOperand ();
465
465
continue ;
466
466
}
467
467
468
468
if (auto *tei = dyn_cast<TupleExtractInst>(searchValue)) {
469
- variableNamePath.push_back (tei);
469
+ variableNamePath.push_back (getStringRefForIndex ( tei-> getFieldIndex ()) );
470
470
searchValue = tei->getOperand ();
471
471
continue ;
472
472
}
473
473
474
474
if (auto *sei = dyn_cast<StructElementAddrInst>(searchValue)) {
475
- variableNamePath.push_back (sei);
475
+ variableNamePath.push_back (getNameFromDecl ( sei-> getField ()) );
476
476
searchValue = sei->getOperand ();
477
477
continue ;
478
478
}
479
479
480
480
if (auto *tei = dyn_cast<TupleElementAddrInst>(searchValue)) {
481
- variableNamePath.push_back (tei);
481
+ variableNamePath.push_back (getStringRefForIndex ( tei-> getFieldIndex ()) );
482
482
searchValue = tei->getOperand ();
483
483
continue ;
484
484
}
485
485
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 ();
489
489
continue ;
490
490
}
491
491
@@ -494,7 +494,7 @@ SILValue VariableNameInferrer::findDebugInfoProvidingValueHelper(
494
494
// them and add the case to the variableNamePath.
495
495
if (auto *e = dyn_cast<EnumInst>(searchValue)) {
496
496
if (e->hasOperand ()) {
497
- variableNamePath.push_back (e );
497
+ variableNamePath.push_back (getNameFromDecl (e-> getElement ()) );
498
498
searchValue = e->getOperand ();
499
499
continue ;
500
500
}
@@ -687,43 +687,6 @@ void VariableNameInferrer::popSingleVariableName() {
687
687
return ;
688
688
}
689
689
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
-
727
690
resultingString += " <unknown decl>" ;
728
691
return ;
729
692
}
0 commit comments