mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-22 10:24:26 +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:
@ -234,10 +234,14 @@ LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef Dref,
|
||||
LLVMMetadataRef VarInfo,
|
||||
LLVMMetadataRef Expr,
|
||||
LLVMBasicBlockRef Block) {
|
||||
// Fail immediately here until the llgo folks update their bindings. The
|
||||
// called function is going to assert out anyway.
|
||||
llvm_unreachable("DIBuilder API change requires a DebugLoc");
|
||||
|
||||
DIBuilder *D = unwrap(Dref);
|
||||
Instruction *Instr =
|
||||
D->insertDeclare(unwrap(Storage), unwrap<MDLocalVariable>(VarInfo),
|
||||
unwrap<MDExpression>(Expr), unwrap(Block));
|
||||
Instruction *Instr = D->insertDeclare(
|
||||
unwrap(Storage), unwrap<MDLocalVariable>(VarInfo),
|
||||
unwrap<MDExpression>(Expr), /* DebugLoc */ nullptr, unwrap(Block));
|
||||
return wrap(Instr);
|
||||
}
|
||||
|
||||
@ -246,9 +250,13 @@ LLVMValueRef LLVMDIBuilderInsertValueAtEnd(LLVMDIBuilderRef Dref,
|
||||
LLVMMetadataRef VarInfo,
|
||||
LLVMMetadataRef Expr,
|
||||
LLVMBasicBlockRef Block) {
|
||||
// Fail immediately here until the llgo folks update their bindings. The
|
||||
// called function is going to assert out anyway.
|
||||
llvm_unreachable("DIBuilder API change requires a DebugLoc");
|
||||
|
||||
DIBuilder *D = unwrap(Dref);
|
||||
Instruction *Instr = D->insertDbgValueIntrinsic(
|
||||
unwrap(Val), Offset, unwrap<MDLocalVariable>(VarInfo),
|
||||
unwrap<MDExpression>(Expr), unwrap(Block));
|
||||
unwrap<MDExpression>(Expr), /* DebugLoc */ nullptr, unwrap(Block));
|
||||
return wrap(Instr);
|
||||
}
|
||||
|
Reference in New Issue
Block a user