Skip to content

Commit 2a2fd48

Browse files
authored
[RemoveDIs] Update DIBuilder C API and OCaml bindings [2/2] (#86529)
Follow on from #84915 which adds the DbgRecord function variants. The C API changes were reviewed in #85657. # C API 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. # OCaml bindings Add set_is_new_dbg_info_format and is_new_dbg_info_format to the OCaml bindings. These can be used to set and query the current debug info mode. These will eventually be removed, but are useful while we're transitioning between old and new debug info formats. Add string_of_lldbgrecord, like string_of_llvalue but prints DbgRecords. In test dbginfo.ml, unconditionally set the module debug info to the new mode and update CHECK lines to check for DbgRecords. Without this change the test crashes because it attempts to insert DbgRecords (new default behaviour of llvm_dibuild_insert_declare_...) into a module that is in the old debug info mode.
1 parent 63ea5a4 commit 2a2fd48

File tree

14 files changed

+212
-78
lines changed

14 files changed

+212
-78
lines changed

llvm/bindings/ocaml/debuginfo/debuginfo_ocaml.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ value llvm_dibuild_create_parameter_variable_bytecode(value *argv, int arg) {
972972
value llvm_dibuild_insert_declare_before_native(value Builder, value Storage,
973973
value VarInfo, value Expr,
974974
value DebugLoc, value Instr) {
975-
LLVMValueRef Value = LLVMDIBuilderInsertDeclareBefore(
975+
LLVMDbgRecordRef Value = LLVMDIBuilderInsertDeclareBefore(
976976
DIBuilder_val(Builder), Value_val(Storage), Metadata_val(VarInfo),
977977
Metadata_val(Expr), Metadata_val(DebugLoc), Value_val(Instr));
978978
return to_val(Value);
@@ -992,7 +992,7 @@ value llvm_dibuild_insert_declare_before_bytecode(value *argv, int arg) {
992992
value llvm_dibuild_insert_declare_at_end_native(value Builder, value Storage,
993993
value VarInfo, value Expr,
994994
value DebugLoc, value Block) {
995-
LLVMValueRef Value = LLVMDIBuilderInsertDeclareAtEnd(
995+
LLVMDbgRecordRef Value = LLVMDIBuilderInsertDeclareAtEnd(
996996
DIBuilder_val(Builder), Value_val(Storage), Metadata_val(VarInfo),
997997
Metadata_val(Expr), Metadata_val(DebugLoc), BasicBlock_val(Block));
998998
return to_val(Value);
@@ -1012,3 +1012,14 @@ value llvm_dibuild_expression(value Builder, value Addr) {
10121012
return to_val(LLVMDIBuilderCreateExpression(
10131013
DIBuilder_val(Builder), (uint64_t *)Op_val(Addr), Wosize_val(Addr)));
10141014
}
1015+
1016+
/* llmodule -> bool */
1017+
value llvm_is_new_dbg_info_format(value Module) {
1018+
return Val_bool(LLVMIsNewDbgInfoFormat(Module_val(Module)));
1019+
}
1020+
1021+
/* llmodule -> bool -> unit */
1022+
value llvm_set_is_new_dbg_info_format(value Module, value UseNewFormat) {
1023+
LLVMSetIsNewDbgInfoFormat(Module_val(Module), Bool_val(UseNewFormat));
1024+
return Val_unit;
1025+
}

llvm/bindings/ocaml/debuginfo/llvm_debuginfo.ml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ external dibuild_insert_declare_before :
599599
expr:Llvm.llmetadata ->
600600
location:Llvm.llmetadata ->
601601
instr:Llvm.llvalue ->
602-
Llvm.llvalue
602+
Llvm.lldbgrecord
603603
= "llvm_dibuild_insert_declare_before_bytecode" "llvm_dibuild_insert_declare_before_native"
604604

605605
external dibuild_insert_declare_at_end :
@@ -609,11 +609,17 @@ external dibuild_insert_declare_at_end :
609609
expr:Llvm.llmetadata ->
610610
location:Llvm.llmetadata ->
611611
block:Llvm.llbasicblock ->
612-
Llvm.llvalue
612+
Llvm.lldbgrecord
613613
= "llvm_dibuild_insert_declare_at_end_bytecode" "llvm_dibuild_insert_declare_at_end_native"
614614

615615
external dibuild_expression :
616616
lldibuilder ->
617617
Int64.t array ->
618618
Llvm.llmetadata
619619
= "llvm_dibuild_expression"
620+
621+
external is_new_dbg_info_format : Llvm.llmodule -> bool
622+
= "llvm_is_new_dbg_info_format"
623+
624+
external set_is_new_dbg_info_format : Llvm.llmodule -> bool -> unit
625+
= "llvm_set_is_new_dbg_info_format"

llvm/bindings/ocaml/debuginfo/llvm_debuginfo.mli

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ val dibuild_insert_declare_before :
659659
expr:Llvm.llmetadata ->
660660
location:Llvm.llmetadata ->
661661
instr:Llvm.llvalue ->
662-
Llvm.llvalue
662+
Llvm.lldbgrecord
663663
(** [dibuild_insert_declare_before] Insert a new llvm.dbg.declare
664664
intrinsic call before the given instruction [instr]. *)
665665

@@ -670,7 +670,7 @@ val dibuild_insert_declare_at_end :
670670
expr:Llvm.llmetadata ->
671671
location:Llvm.llmetadata ->
672672
block:Llvm.llbasicblock ->
673-
Llvm.llvalue
673+
Llvm.lldbgrecord
674674
(** [dibuild_insert_declare_at_end] Insert a new llvm.dbg.declare
675675
intrinsic call at the end of basic block [block]. If [block]
676676
has a terminator instruction, the intrinsic is inserted
@@ -680,3 +680,9 @@ val dibuild_expression : lldibuilder -> Int64.t array -> Llvm.llmetadata
680680
(** [dibuild_expression] Create a new descriptor for the specified variable
681681
which has a complex address expression for its address.
682682
See LLVMDIBuilderCreateExpression. *)
683+
684+
val is_new_dbg_info_format : Llvm.llmodule -> bool
685+
(** [is_new_dbg_info_format] See LLVMIsNewDbgInfoFormat *)
686+
687+
val set_is_new_dbg_info_format : Llvm.llmodule -> bool -> unit
688+
(** [set_is_new_dbg_info_format] See LLVMSetIsNewDbgInfoFormat *)

llvm/bindings/ocaml/llvm/llvm.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type llmodule
1212
type llmetadata
1313
type lltype
1414
type llvalue
15+
type lldbgrecord
1516
type lluse
1617
type llbasicblock
1718
type llbuilder
@@ -528,6 +529,7 @@ external value_name : llvalue -> string = "llvm_value_name"
528529
external set_value_name : string -> llvalue -> unit = "llvm_set_value_name"
529530
external dump_value : llvalue -> unit = "llvm_dump_value"
530531
external string_of_llvalue : llvalue -> string = "llvm_string_of_llvalue"
532+
external string_of_lldbgrecord : lldbgrecord -> string = "llvm_string_of_lldbgrecord"
531533
external replace_all_uses_with : llvalue -> llvalue -> unit
532534
= "llvm_replace_all_uses_with"
533535

llvm/bindings/ocaml/llvm/llvm.mli

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ type lltype
3636
This type covers a wide range of subclasses. *)
3737
type llvalue
3838

39+
(** Non-instruction debug info record. See the [llvm::DbgRecord] class.*)
40+
type lldbgrecord
41+
3942
(** Used to store users and usees of values. See the [llvm::Use] class. *)
4043
type lluse
4144

@@ -793,6 +796,9 @@ val dump_value : llvalue -> unit
793796
(** [string_of_llvalue v] returns a string describing the value [v]. *)
794797
val string_of_llvalue : llvalue -> string
795798

799+
(** [string_of_lldbgrecord r] returns a string describing the DbgRecord [r]. *)
800+
val string_of_lldbgrecord : lldbgrecord -> string
801+
796802
(** [replace_all_uses_with old new] replaces all uses of the value [old]
797803
with the value [new]. See the method [llvm::Value::replaceAllUsesWith]. *)
798804
val replace_all_uses_with : llvalue -> llvalue -> unit

llvm/bindings/ocaml/llvm/llvm_ocaml.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,15 @@ value llvm_string_of_llvalue(value M) {
800800
return ValueStr;
801801
}
802802

803+
/* lldbgrecord -> string */
804+
value llvm_string_of_lldbgrecord(value Record) {
805+
char *ValueCStr = LLVMPrintDbgRecordToString(DbgRecord_val(Record));
806+
value ValueStr = caml_copy_string(ValueCStr);
807+
LLVMDisposeMessage(ValueCStr);
808+
809+
return ValueStr;
810+
}
811+
803812
/* llvalue -> llvalue -> unit */
804813
value llvm_replace_all_uses_with(value OldVal, value NewVal) {
805814
LLVMReplaceAllUsesWith(Value_val(OldVal), Value_val(NewVal));

llvm/bindings/ocaml/llvm/llvm_ocaml.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ void *from_val_array(value Elements);
5353
#define Metadata_val(v) ((LLVMMetadataRef)from_val(v))
5454
#define Type_val(v) ((LLVMTypeRef)from_val(v))
5555
#define Value_val(v) ((LLVMValueRef)from_val(v))
56+
#define DbgRecord_val(v) ((LLVMDbgRecordRef)from_val(v))
5657
#define Use_val(v) ((LLVMUseRef)from_val(v))
5758
#define BasicBlock_val(v) ((LLVMBasicBlockRef)from_val(v))
5859
#define MemoryBuffer_val(v) ((LLVMMemoryBufferRef)from_val(v))

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/Core.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,6 +1866,14 @@ void LLVMDumpValue(LLVMValueRef Val);
18661866
*/
18671867
char *LLVMPrintValueToString(LLVMValueRef Val);
18681868

1869+
/**
1870+
* Return a string representation of the DbgRecord. Use
1871+
* LLVMDisposeMessage to free the string.
1872+
*
1873+
* @see llvm::DbgRecord::print()
1874+
*/
1875+
char *LLVMPrintDbgRecordToString(LLVMDbgRecordRef Record);
1876+
18691877
/**
18701878
* Replace all uses of a value with another one.
18711879
*

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

llvm/lib/IR/Core.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,20 @@ char* LLVMPrintValueToString(LLVMValueRef Val) {
990990
return strdup(buf.c_str());
991991
}
992992

993+
char *LLVMPrintDbgRecordToString(LLVMDbgRecordRef Record) {
994+
std::string buf;
995+
raw_string_ostream os(buf);
996+
997+
if (unwrap(Record))
998+
unwrap(Record)->print(os);
999+
else
1000+
os << "Printing <null> DbgRecord";
1001+
1002+
os.flush();
1003+
1004+
return strdup(buf.c_str());
1005+
}
1006+
9931007
void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal) {
9941008
unwrap(OldVal)->replaceAllUsesWith(unwrap(NewVal));
9951009
}

0 commit comments

Comments
 (0)