aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/DebugInfo.cpp
diff options
context:
space:
mode:
authorOrlando Cazalet-Hyams <orlando.hyams@sony.com>2024-03-22 16:21:50 +0000
committerOrlando Cazalet-Hyams <orlando.hyams@sony.com>2024-03-22 16:21:50 +0000
commit26857582e5ee7980a71133ef8f8f579bcd90bdc8 (patch)
treed5421eaf6b509ac3f2d7e58eb3d4581490be806d /llvm/lib/IR/DebugInfo.cpp
parentab8ace3bfd5165a8532f710f9c2d8dd40c3fac39 (diff)
downloadllvm-26857582e5ee7980a71133ef8f8f579bcd90bdc8.zip
llvm-26857582e5ee7980a71133ef8f8f579bcd90bdc8.tar.gz
llvm-26857582e5ee7980a71133ef8f8f579bcd90bdc8.tar.bz2
Revert "[RemoveDIs] Update DIBuilder C API with DbgRecord functions [2/2] (#85657)"
This reverts commit 2091c74796b1dac68e622284c63a870b88b7554f. Builtbot failure: https://lab.llvm.org/buildbot/#/builders/16/builds/63080
Diffstat (limited to 'llvm/lib/IR/DebugInfo.cpp')
-rw-r--r--llvm/lib/IR/DebugInfo.cpp121
1 files changed, 40 insertions, 81 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 4206162..09bce9d 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -1665,12 +1665,12 @@ LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl(
unwrapDI<MDNode>(Decl), nullptr, AlignInBits));
}
-LLVMDbgRecordRef
+LLVMValueRef
LLVMDIBuilderInsertDeclareBefore(LLVMDIBuilderRef Builder, LLVMValueRef Storage,
LLVMMetadataRef VarInfo, LLVMMetadataRef Expr,
LLVMMetadataRef DL, LLVMValueRef Instr) {
- return LLVMDIBuilderInsertDeclareRecordBefore(Builder, Storage, VarInfo, Expr,
- DL, Instr);
+ return LLVMDIBuilderInsertDeclareIntrinsicBefore(Builder, Storage, VarInfo,
+ Expr, DL, Instr);
}
LLVMValueRef LLVMDIBuilderInsertDeclareIntrinsicBefore(
LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
@@ -1679,38 +1679,27 @@ LLVMValueRef LLVMDIBuilderInsertDeclareIntrinsicBefore(
unwrap(Storage), unwrap<DILocalVariable>(VarInfo),
unwrap<DIExpression>(Expr), unwrap<DILocation>(DL),
unwrap<Instruction>(Instr));
- // This assert will fail if the module is in the new debug info format.
- // This function should only be called if the module is in the old
- // debug info format.
- // See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes,
- // LLVMIsNewDbgInfoFormat, and LLVMSetIsNewDbgInfoFormat for more info.
assert(isa<Instruction *>(DbgInst) &&
- "Function unexpectedly in new debug info format");
+ "Inserted a DbgRecord into function using old debug info mode");
return wrap(cast<Instruction *>(DbgInst));
}
LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordBefore(
LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
LLVMMetadataRef Expr, LLVMMetadataRef DL, LLVMValueRef Instr) {
- DbgInstPtr DbgInst = unwrap(Builder)->insertDeclare(
- unwrap(Storage), unwrap<DILocalVariable>(VarInfo),
- unwrap<DIExpression>(Expr), unwrap<DILocation>(DL),
- unwrap<Instruction>(Instr));
- // This assert will fail if the module is in the old debug info format.
- // This function should only be called if the module is in the new
- // debug info format.
- // See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes,
- // LLVMIsNewDbgInfoFormat, and LLVMSetIsNewDbgInfoFormat for more info.
- assert(isa<DbgRecord *>(DbgInst) &&
- "Function unexpectedly in old debug info format");
- return wrap(cast<DbgRecord *>(DbgInst));
+ return wrap(
+ unwrap(Builder)
+ ->insertDeclare(unwrap(Storage), unwrap<DILocalVariable>(VarInfo),
+ unwrap<DIExpression>(Expr), unwrap<DILocation>(DL),
+ unwrap<Instruction>(Instr))
+ .get<DbgRecord *>());
}
-LLVMDbgRecordRef
+LLVMValueRef
LLVMDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef Builder, LLVMValueRef Storage,
LLVMMetadataRef VarInfo, LLVMMetadataRef Expr,
LLVMMetadataRef DL, LLVMBasicBlockRef Block) {
- return LLVMDIBuilderInsertDeclareRecordAtEnd(Builder, Storage, VarInfo, Expr,
- DL, Block);
+ return LLVMDIBuilderInsertDeclareIntrinsicAtEnd(Builder, Storage, VarInfo,
+ Expr, DL, Block);
}
LLVMValueRef LLVMDIBuilderInsertDeclareIntrinsicAtEnd(
LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
@@ -1718,36 +1707,26 @@ LLVMValueRef LLVMDIBuilderInsertDeclareIntrinsicAtEnd(
DbgInstPtr DbgInst = unwrap(Builder)->insertDeclare(
unwrap(Storage), unwrap<DILocalVariable>(VarInfo),
unwrap<DIExpression>(Expr), unwrap<DILocation>(DL), unwrap(Block));
- // This assert will fail if the module is in the new debug info format.
- // This function should only be called if the module is in the old
- // debug info format.
- // See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes,
- // LLVMIsNewDbgInfoFormat, and LLVMSetIsNewDbgInfoFormat for more info.
assert(isa<Instruction *>(DbgInst) &&
- "Function unexpectedly in new debug info format");
+ "Inserted a DbgRecord into function using old debug info mode");
return wrap(cast<Instruction *>(DbgInst));
}
LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordAtEnd(
LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
LLVMMetadataRef Expr, LLVMMetadataRef DL, LLVMBasicBlockRef Block) {
- DbgInstPtr DbgInst = unwrap(Builder)->insertDeclare(
- unwrap(Storage), unwrap<DILocalVariable>(VarInfo),
- unwrap<DIExpression>(Expr), unwrap<DILocation>(DL), unwrap(Block));
- // This assert will fail if the module is in the old debug info format.
- // This function should only be called if the module is in the new
- // debug info format.
- // See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes,
- // LLVMIsNewDbgInfoFormat, and LLVMSetIsNewDbgInfoFormat for more info.
- assert(isa<DbgRecord *>(DbgInst) &&
- "Function unexpectedly in old debug info format");
- return wrap(cast<DbgRecord *>(DbgInst));
+ return wrap(unwrap(Builder)
+ ->insertDeclare(unwrap(Storage),
+ unwrap<DILocalVariable>(VarInfo),
+ unwrap<DIExpression>(Expr),
+ unwrap<DILocation>(DL), unwrap(Block))
+ .get<DbgRecord *>());
}
-LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueBefore(
+LLVMValueRef LLVMDIBuilderInsertDbgValueBefore(
LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr) {
- return LLVMDIBuilderInsertDbgValueRecordBefore(Builder, Val, VarInfo, Expr,
- DebugLoc, Instr);
+ return LLVMDIBuilderInsertDbgValueIntrinsicBefore(Builder, Val, VarInfo, Expr,
+ DebugLoc, Instr);
}
LLVMValueRef LLVMDIBuilderInsertDbgValueIntrinsicBefore(
LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
@@ -1755,36 +1734,26 @@ LLVMValueRef LLVMDIBuilderInsertDbgValueIntrinsicBefore(
DbgInstPtr DbgInst = unwrap(Builder)->insertDbgValueIntrinsic(
unwrap(Val), unwrap<DILocalVariable>(VarInfo), unwrap<DIExpression>(Expr),
unwrap<DILocation>(DebugLoc), unwrap<Instruction>(Instr));
- // This assert will fail if the module is in the new debug info format.
- // This function should only be called if the module is in the old
- // debug info format.
- // See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes,
- // LLVMIsNewDbgInfoFormat, and LLVMSetIsNewDbgInfoFormat for more info.
assert(isa<Instruction *>(DbgInst) &&
- "Function unexpectedly in new debug info format");
+ "Inserted a DbgRecord into function using old debug info mode");
return wrap(cast<Instruction *>(DbgInst));
}
LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordBefore(
LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr) {
- DbgInstPtr DbgInst = unwrap(Builder)->insertDbgValueIntrinsic(
- unwrap(Val), unwrap<DILocalVariable>(VarInfo), unwrap<DIExpression>(Expr),
- unwrap<DILocation>(DebugLoc), unwrap<Instruction>(Instr));
- // This assert will fail if the module is in the old debug info format.
- // This function should only be called if the module is in the new
- // debug info format.
- // See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes,
- // LLVMIsNewDbgInfoFormat, and LLVMSetIsNewDbgInfoFormat for more info.
- assert(isa<DbgRecord *>(DbgInst) &&
- "Function unexpectedly in old debug info format");
- return wrap(cast<DbgRecord *>(DbgInst));
+ return wrap(unwrap(Builder)
+ ->insertDbgValueIntrinsic(
+ unwrap(Val), unwrap<DILocalVariable>(VarInfo),
+ unwrap<DIExpression>(Expr), unwrap<DILocation>(DebugLoc),
+ unwrap<Instruction>(Instr))
+ .get<DbgRecord *>());
}
-LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueAtEnd(
+LLVMValueRef LLVMDIBuilderInsertDbgValueAtEnd(
LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block) {
- return LLVMDIBuilderInsertDbgValueRecordAtEnd(Builder, Val, VarInfo, Expr,
- DebugLoc, Block);
+ return LLVMDIBuilderInsertDbgValueIntrinsicAtEnd(Builder, Val, VarInfo, Expr,
+ DebugLoc, Block);
}
LLVMValueRef LLVMDIBuilderInsertDbgValueIntrinsicAtEnd(
LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
@@ -1792,29 +1761,19 @@ LLVMValueRef LLVMDIBuilderInsertDbgValueIntrinsicAtEnd(
DbgInstPtr DbgInst = unwrap(Builder)->insertDbgValueIntrinsic(
unwrap(Val), unwrap<DILocalVariable>(VarInfo), unwrap<DIExpression>(Expr),
unwrap<DILocation>(DebugLoc), unwrap(Block));
- // This assert will fail if the module is in the new debug info format.
- // This function should only be called if the module is in the old
- // debug info format.
- // See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes,
- // LLVMIsNewDbgInfoFormat, and LLVMSetIsNewDbgInfoFormat for more info.
assert(isa<Instruction *>(DbgInst) &&
- "Function unexpectedly in new debug info format");
+ "Inserted a DbgRecord into function using old debug info mode");
return wrap(cast<Instruction *>(DbgInst));
}
LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordAtEnd(
LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block) {
- DbgInstPtr DbgInst = unwrap(Builder)->insertDbgValueIntrinsic(
- unwrap(Val), unwrap<DILocalVariable>(VarInfo), unwrap<DIExpression>(Expr),
- unwrap<DILocation>(DebugLoc), unwrap(Block));
- // This assert will fail if the module is in the old debug info format.
- // This function should only be called if the module is in the new
- // debug info format.
- // See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes,
- // LLVMIsNewDbgInfoFormat, and LLVMSetIsNewDbgInfoFormat for more info.
- assert(isa<DbgRecord *>(DbgInst) &&
- "Function unexpectedly in old debug info format");
- return wrap(cast<DbgRecord *>(DbgInst));
+ return wrap(unwrap(Builder)
+ ->insertDbgValueIntrinsic(
+ unwrap(Val), unwrap<DILocalVariable>(VarInfo),
+ unwrap<DIExpression>(Expr), unwrap<DILocation>(DebugLoc),
+ unwrap(Block))
+ .get<DbgRecord *>());
}
LLVMMetadataRef LLVMDIBuilderCreateAutoVariable(