Skip to content

Commit 2091c74

Browse files
authored
[RemoveDIs] Update DIBuilder C API with DbgRecord functions [2/2] (#85657)
Follow on from #84915 which adds the DbgRecord function variants. Update the LLVMDIBuilderInsert... functions to insert DbgRecords instead of debug intrinsics. LLVMDIBuilderInsertDeclareBefore LLVMDIBuilderInsertDeclareAtEnd LLVMDIBuilderInsertDbgValueBefore LLVMDIBuilderInsertDbgValueAtEnd Calling these functions will now cause an assertion if the module is in the wrong debug info format. They should only be used when the module is in "new debug format". Use LLVMIsNewDbgInfoFormat to query and LLVMSetIsNewDbgInfoFormat to change the debug info format of a module. Please see https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-change (RemoveDIsDebugInfo.md) for more info.
1 parent ceba3a3 commit 2091c74

File tree

4 files changed

+137
-68
lines changed

4 files changed

+137
-68
lines changed

llvm/docs/RemoveDIsDebugInfo.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,22 @@ New functions (all to be deprecated)
4040
LLVMIsNewDbgInfoFormat # Returns true if the module is in the new non-instruction mode.
4141
LLVMSetIsNewDbgInfoFormat # Convert to the requested debug info format.
4242
43-
LLVMDIBuilderInsertDeclareIntrinsicBefore # Insert a debug intrinsic (old debug info format).
43+
LLVMDIBuilderInsertDeclareIntrinsicBefore # Insert a debug intrinsic (old debug info format).
4444
LLVMDIBuilderInsertDeclareIntrinsicAtEnd # Same as above.
4545
LLVMDIBuilderInsertDbgValueIntrinsicBefore # Same as above.
4646
LLVMDIBuilderInsertDbgValueIntrinsicAtEnd # Same as above.
4747
48-
LLVMDIBuilderInsertDeclareRecordBefore # Insert a debug record (new debug info format).
48+
LLVMDIBuilderInsertDeclareRecordBefore # Insert a debug record (new debug info format).
4949
LLVMDIBuilderInsertDeclareRecordAtEnd # Same as above.
5050
LLVMDIBuilderInsertDbgValueRecordBefore # Same as above.
5151
LLVMDIBuilderInsertDbgValueRecordAtEnd # Same as above.
52+
53+
Existing functions (behaviour change)
54+
-------------------------------------
55+
LLVMDIBuilderInsertDeclareBefore # Insert a debug record (new debug info format) instead of a debug intrinsic (old debug info format).
56+
LLVMDIBuilderInsertDeclareAtEnd # Same as above.
57+
LLVMDIBuilderInsertDbgValueBefore # Same as above.
58+
LLVMDIBuilderInsertDbgValueAtEnd # Same as above.
5259
```
5360

5461
# Anything else?

llvm/include/llvm-c/DebugInfo.h

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,21 +1249,26 @@ LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl(
12491249
LLVMMetadataRef Decl, uint32_t AlignInBits);
12501250

12511251
/*
1252-
* Insert a new llvm.dbg.declare intrinsic call before the given instruction.
1252+
* Insert a new Declare DbgRecord before the given instruction.
1253+
*
1254+
* Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
1255+
* Use LLVMSetIsNewDbgInfoFormat(LLVMBool) to convert between formats.
1256+
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
1257+
*
12531258
* \param Builder The DIBuilder.
12541259
* \param Storage The storage of the variable to declare.
12551260
* \param VarInfo The variable's debug info descriptor.
12561261
* \param Expr A complex location expression for the variable.
12571262
* \param DebugLoc Debug info location.
12581263
* \param Instr Instruction acting as a location for the new intrinsic.
12591264
*/
1260-
LLVMValueRef
1265+
LLVMDbgRecordRef
12611266
LLVMDIBuilderInsertDeclareBefore(LLVMDIBuilderRef Builder, LLVMValueRef Storage,
12621267
LLVMMetadataRef VarInfo, LLVMMetadataRef Expr,
12631268
LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
12641269
/**
12651270
* Soon to be deprecated.
1266-
* Only use in "old debug mode" (LLVMIsNewDbgFormat() is false).
1271+
* Only use in "old debug mode" (LLVMIsNewDbgInfoFormat() is false).
12671272
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
12681273
*
12691274
* Insert a new llvm.dbg.declare intrinsic call before the given instruction.
@@ -1279,7 +1284,7 @@ LLVMValueRef LLVMDIBuilderInsertDeclareIntrinsicBefore(
12791284
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
12801285
/**
12811286
* Soon to be deprecated.
1282-
* Only use in "new debug mode" (LLVMIsNewDbgFormat() is true).
1287+
* Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
12831288
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
12841289
*
12851290
* Insert a Declare DbgRecord before the given instruction.
@@ -1295,22 +1300,27 @@ LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordBefore(
12951300
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
12961301

12971302
/**
1298-
* Insert a new llvm.dbg.declare intrinsic call at the end of the given basic
1299-
* block. If the basic block has a terminator instruction, the intrinsic is
1300-
* inserted before that terminator instruction.
1303+
* Insert a new Declare DbgRecord at the end of the given basic block. If the
1304+
* basic block has a terminator instruction, the intrinsic is inserted before
1305+
* that terminator instruction.
1306+
*
1307+
* Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
1308+
* Use LLVMSetIsNewDbgInfoFormat(LLVMBool) to convert between formats.
1309+
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
1310+
*
13011311
* \param Builder The DIBuilder.
13021312
* \param Storage The storage of the variable to declare.
13031313
* \param VarInfo The variable's debug info descriptor.
13041314
* \param Expr A complex location expression for the variable.
13051315
* \param DebugLoc Debug info location.
13061316
* \param Block Basic block acting as a location for the new intrinsic.
13071317
*/
1308-
LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(
1318+
LLVMDbgRecordRef LLVMDIBuilderInsertDeclareAtEnd(
13091319
LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
13101320
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
13111321
/**
13121322
* Soon to be deprecated.
1313-
* Only use in "old debug mode" (LLVMIsNewDbgFormat() is false).
1323+
* Only use in "old debug mode" (LLVMIsNewDbgInfoFormat() is false).
13141324
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
13151325
*
13161326
* Insert a new llvm.dbg.declare intrinsic call at the end of the given basic
@@ -1328,7 +1338,7 @@ LLVMValueRef LLVMDIBuilderInsertDeclareIntrinsicAtEnd(
13281338
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
13291339
/**
13301340
* Soon to be deprecated.
1331-
* Only use in "new debug mode" (LLVMIsNewDbgFormat() is true).
1341+
* Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
13321342
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
13331343
*
13341344
* Insert a Declare DbgRecord at the end of the given basic block. If the basic
@@ -1346,21 +1356,26 @@ LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordAtEnd(
13461356
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
13471357

13481358
/**
1349-
* Insert a new llvm.dbg.value intrinsic call before the given instruction.
1359+
* Insert a new Value DbgRecord before the given instruction.
1360+
*
1361+
* Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
1362+
* Use LLVMSetIsNewDbgInfoFormat(LLVMBool) to convert between formats.
1363+
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
1364+
*
13501365
* \param Builder The DIBuilder.
13511366
* \param Val The value of the variable.
13521367
* \param VarInfo The variable's debug info descriptor.
13531368
* \param Expr A complex location expression for the variable.
13541369
* \param DebugLoc Debug info location.
13551370
* \param Instr Instruction acting as a location for the new intrinsic.
13561371
*/
1357-
LLVMValueRef
1372+
LLVMDbgRecordRef
13581373
LLVMDIBuilderInsertDbgValueBefore(LLVMDIBuilderRef Builder, LLVMValueRef Val,
13591374
LLVMMetadataRef VarInfo, LLVMMetadataRef Expr,
13601375
LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
13611376
/**
13621377
* Soon to be deprecated.
1363-
* Only use in "old debug mode" (Module::IsNewDbgInfoFormat is false).
1378+
* Only use in "old debug mode" (LLVMIsNewDbgInfoFormat() is false).
13641379
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
13651380
*
13661381
* Insert a new llvm.dbg.value intrinsic call before the given instruction.
@@ -1376,7 +1391,7 @@ LLVMValueRef LLVMDIBuilderInsertDbgValueIntrinsicBefore(
13761391
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
13771392
/**
13781393
* Soon to be deprecated.
1379-
* Only use in "new debug mode" (Module::IsNewDbgInfoFormat is true).
1394+
* Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
13801395
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
13811396
*
13821397
* Insert a new llvm.dbg.value intrinsic call before the given instruction.
@@ -1392,22 +1407,27 @@ LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordBefore(
13921407
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
13931408

13941409
/**
1395-
* Insert a new llvm.dbg.value intrinsic call at the end of the given basic
1396-
* block. If the basic block has a terminator instruction, the intrinsic is
1397-
* inserted before that terminator instruction.
1410+
* Insert a new Value DbgRecord at the end of the given basic block. If the
1411+
* basic block has a terminator instruction, the intrinsic is inserted before
1412+
* that terminator instruction.
1413+
*
1414+
* Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
1415+
* Use LLVMSetIsNewDbgInfoFormat(LLVMBool) to convert between formats.
1416+
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
1417+
*
13981418
* \param Builder The DIBuilder.
13991419
* \param Val The value of the variable.
14001420
* \param VarInfo The variable's debug info descriptor.
14011421
* \param Expr A complex location expression for the variable.
14021422
* \param DebugLoc Debug info location.
14031423
* \param Block Basic block acting as a location for the new intrinsic.
14041424
*/
1405-
LLVMValueRef LLVMDIBuilderInsertDbgValueAtEnd(
1425+
LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueAtEnd(
14061426
LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
14071427
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
14081428
/**
14091429
* Soon to be deprecated.
1410-
* Only use in "old debug mode" (Module::IsNewDbgInfoFormat is false).
1430+
* Only use in "old debug mode" (LLVMIsNewDbgInfoFormat() is false).
14111431
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
14121432
*
14131433
* Insert a new llvm.dbg.value intrinsic call at the end of the given basic
@@ -1425,7 +1445,7 @@ LLVMValueRef LLVMDIBuilderInsertDbgValueIntrinsicAtEnd(
14251445
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
14261446
/**
14271447
* Soon to be deprecated.
1428-
* Only use in "new debug mode" (Module::IsNewDbgInfoFormat is true).
1448+
* Only use in "new debug mode" (LLVMIsNewDbgInfoFormat() is true).
14291449
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
14301450
*
14311451
* Insert a new llvm.dbg.value intrinsic call at the end of the given basic

0 commit comments

Comments
 (0)