mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-24 08:24:33 +00:00
DebugInfo: Require a DebugLoc in DIBuilder::insertDeclare()
Change `DIBuilder::insertDeclare()` and `insertDbgValueIntrinsic()` to take an `MDLocation*`/`DebugLoc` parameter which it attaches to the created intrinsic. Assert at creation time that the `scope:` field's subprogram matches the variable's. There's a matching `clang` commit to use the API. The context for this is PR22778, which is removing the `inlinedAt:` field from `MDLocalVariable`, instead deferring to the `!dbg` location attached to the debug info intrinsic. The best way to ensure we always have a `!dbg` attachment is to require one at creation time. I'll be adding verifier checks next, but this API change is the best way to shake out frontend bugs. Note: I added an `llvm_unreachable()` in `bindings/go` and passed in `nullptr` for the `DebugLoc`. The `llgo` folks will eventually need to pass a valid `DebugLoc` here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235041 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1166,10 +1166,9 @@ public:
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
Instruction *DbgVal =
|
||||
DIB.insertDbgValueIntrinsic(Arg, 0, DIVariable(DVI->getVariable()),
|
||||
DIExpression(DVI->getExpression()), Inst);
|
||||
DbgVal->setDebugLoc(DVI->getDebugLoc());
|
||||
DIB.insertDbgValueIntrinsic(Arg, 0, DIVariable(DVI->getVariable()),
|
||||
DIExpression(DVI->getExpression()),
|
||||
DVI->getDebugLoc(), Inst);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -4211,8 +4210,8 @@ bool SROA::splitAlloca(AllocaInst &AI, AllocaSlices &AS) {
|
||||
if (DbgDeclareInst *OldDDI = FindAllocaDbgDeclare(Piece.Alloca))
|
||||
OldDDI->eraseFromParent();
|
||||
|
||||
auto *NewDDI = DIB.insertDeclare(Piece.Alloca, Var, PieceExpr, &AI);
|
||||
NewDDI->setDebugLoc(DbgDecl->getDebugLoc());
|
||||
DIB.insertDeclare(Piece.Alloca, Var, PieceExpr, DbgDecl->getDebugLoc(),
|
||||
&AI);
|
||||
}
|
||||
}
|
||||
return Changed;
|
||||
|
Reference in New Issue
Block a user