@@ -1799,6 +1799,47 @@ void LLVMInstructionSetDebugLoc(LLVMValueRef Inst, LLVMMetadataRef Loc) {
17991799 unwrap<Instruction>(Inst)->setDebugLoc (DebugLoc ());
18001800}
18011801
1802+ LLVMMetadataRef LLVMDIBuilderCreateLabel (
1803+ LLVMDIBuilderRef Builder,
1804+ LLVMMetadataRef Context, const char *Name, size_t NameLen,
1805+ LLVMMetadataRef File, unsigned LineNo, LLVMBool AlwaysPreserve) {
1806+ return wrap (unwrap (Builder)->createLabel (
1807+ unwrapDI<DIScope>(Context), StringRef (Name, NameLen),
1808+ unwrapDI<DIFile>(File), LineNo, AlwaysPreserve));
1809+ }
1810+
1811+ LLVMDbgRecordRef LLVMDIBuilderInsertLabelBefore (
1812+ LLVMDIBuilderRef Builder, LLVMMetadataRef LabelInfo,
1813+ LLVMMetadataRef Location, LLVMValueRef InsertBefore) {
1814+ DbgInstPtr DbgInst = unwrap (Builder)->insertLabel (
1815+ unwrapDI<DILabel>(LabelInfo), unwrapDI<DILocation>(Location),
1816+ unwrap<Instruction>(InsertBefore));
1817+ // This assert will fail if the module is in the old debug info format.
1818+ // This function should only be called if the module is in the new
1819+ // debug info format.
1820+ // See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes,
1821+ // LLVMIsNewDbgInfoFormat, and LLVMSetIsNewDbgInfoFormat for more info.
1822+ assert (isa<DbgRecord *>(DbgInst) &&
1823+ " Function unexpectedly in old debug info format" );
1824+ return wrap (cast<DbgRecord *>(DbgInst));
1825+ }
1826+
1827+ LLVMDbgRecordRef LLVMDIBuilderInsertLabelAtEnd (
1828+ LLVMDIBuilderRef Builder, LLVMMetadataRef LabelInfo,
1829+ LLVMMetadataRef Location, LLVMBasicBlockRef InsertAtEnd) {
1830+ DbgInstPtr DbgInst = unwrap (Builder)->insertLabel (
1831+ unwrapDI<DILabel>(LabelInfo), unwrapDI<DILocation>(Location),
1832+ unwrap (InsertAtEnd));
1833+ // This assert will fail if the module is in the old debug info format.
1834+ // This function should only be called if the module is in the new
1835+ // debug info format.
1836+ // See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes,
1837+ // LLVMIsNewDbgInfoFormat, and LLVMSetIsNewDbgInfoFormat for more info.
1838+ assert (isa<DbgRecord *>(DbgInst) &&
1839+ " Function unexpectedly in old debug info format" );
1840+ return wrap (cast<DbgRecord *>(DbgInst));
1841+ }
1842+
18021843LLVMMetadataKind LLVMGetMetadataKind (LLVMMetadataRef Metadata) {
18031844 switch (unwrap (Metadata)->getMetadataID ()) {
18041845#define HANDLE_METADATA_LEAF (CLASS ) \
0 commit comments