Skip to content

Commit 5835e5b

Browse files
committed
Debug info: Get variable names from the VarInfo instead of the Decl.
1 parent e9a2e1e commit 5835e5b

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

lib/IRGen/IRGenSIL.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2943,7 +2943,7 @@ void IRGenSILFunction::visitDebugValueInst(DebugValueInst *i) {
29432943
if (isa<SILUndef>(SILVal))
29442944
return;
29452945

2946-
StringRef Name = Decl->getNameStr();
2946+
StringRef Name = i->getVarInfo().Name;
29472947
Explosion e = getLoweredExplosion(SILVal);
29482948
DebugTypeInfo DbgTy(Decl, Decl->getType(), getTypeInfo(SILVal.getType()));
29492949
// An inout/lvalue type that is described by a debug value has been
@@ -2968,7 +2968,7 @@ void IRGenSILFunction::visitDebugValueAddrInst(DebugValueAddrInst *i) {
29682968
if (isa<SILUndef>(SILVal))
29692969
return;
29702970

2971-
StringRef Name = Decl->getName().str();
2971+
StringRef Name = i->getVarInfo().Name;
29722972
auto Addr = getLoweredAddress(SILVal).getAddress();
29732973
DebugTypeInfo DbgTy(Decl, Decl->getType(), getTypeInfo(SILVal.getType()));
29742974
// Put the value into a stack slot at -Onone and emit a debug intrinsic.
@@ -3229,7 +3229,7 @@ static void emitDebugDeclarationForAllocStack(IRGenSILFunction &IGF,
32293229
// is stored in the alloca, emitting it as a reference type would
32303230
// be wrong.
32313231
DbgTy.unwrapLValueOrInOutType();
3232-
auto Name = Decl->getName().empty() ? "_" : Decl->getName().str();
3232+
auto Name = i->getVarInfo().Name.empty() ? "_" : i->getVarInfo().Name;
32333233
auto DS = i->getDebugScope();
32343234
if (DS) {
32353235
assert(DS->SILFn == IGF.CurSILFn || DS->InlinedCallSite);
@@ -3245,12 +3245,11 @@ void IRGenSILFunction::visitAllocStackInst(swift::AllocStackInst *i) {
32453245

32463246
// Derive name from SIL location.
32473247
VarDecl *Decl = i->getDecl();
3248-
StringRef dbgname =
3248+
StringRef dbgname;
32493249
# ifndef NDEBUG
3250-
// If this is a DEBUG build, use pretty names for the LLVM IR.
3251-
Decl ? Decl->getNameStr() :
3250+
// If this is a DEBUG build, use pretty names for the LLVM IR.
3251+
dbgname = i->getVarInfo().Name;
32523252
# endif
3253-
"";
32543253

32553254
(void) Decl;
32563255
// If a dynamic alloc_stack is immediately initialized by a copy_addr
@@ -3363,7 +3362,7 @@ void IRGenSILFunction::visitAllocBoxInst(swift::AllocBoxInst *i) {
33633362

33643363
// Derive name from SIL location.
33653364
VarDecl *Decl = i->getDecl();
3366-
StringRef Name = Decl ? Decl->getName().str() : "";
3365+
StringRef Name = i->getVarInfo().Name;
33673366
StringRef DbgName =
33683367
# ifndef NDEBUG
33693368
// If this is a DEBUG build, use pretty names for the LLVM IR.

0 commit comments

Comments
 (0)