File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -556,13 +556,26 @@ inline DebugVarCarryingInst DebugVarCarryingInst::getFromValue(SILValue value) {
556
556
return DebugVarCarryingInst ();
557
557
}
558
558
559
+ static_assert (sizeof (DebugVarCarryingInst) == sizeof(VarDeclCarryingInst) &&
560
+ alignof(DebugVarCarryingInst) == alignof(VarDeclCarryingInst),
561
+ "Expected debug var carrying inst to have the same "
562
+ "size/alignment/layout as VarDeclCarryingInst!");
563
+
559
564
// / Attempt to discover a StringRef varName for the value \p value based only
560
565
// / off of debug var information. If we fail, we return the name "unknown".
561
566
inline StringRef getDebugVarName (SILValue value) {
562
567
auto inst = DebugVarCarryingInst::getFromValue (value);
563
568
return DebugVarCarryingInst::getName (inst);
564
569
}
565
570
571
+ inline StringRef getDiagnosticName (SILValue value) {
572
+ if (auto inst = DebugVarCarryingInst::getFromValue (value))
573
+ return inst.getName ();
574
+ if (auto inst = VarDeclCarryingInst::getFromValue (value))
575
+ return inst.getName ();
576
+ return " unknown" ;
577
+ }
578
+
566
579
} // end namespace swift
567
580
568
581
#endif // SWIFT_SIL_DEBUGUTILS_H
You can’t perform that action at this time.
0 commit comments