[llvm] [RemoveDIs][DebugInfo] Add DPValue checks to the verifier, prepare DPValue for parsing support (PR #79810)
Jeremy Morse via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 22 04:48:47 PST 2024
================
@@ -6152,6 +6175,80 @@ static DISubprogram *getSubprogram(Metadata *LocalScope) {
return nullptr;
}
+void Verifier::visit(DPValue &DPV) {
+ CheckDI(DPV.getType() == DPValue::LocationType::Value ||
+ DPV.getType() == DPValue::LocationType::Declare ||
+ DPV.getType() == DPValue::LocationType::Assign,
+ "invalid #dbg record type", &DPV, DPV.getType());
+ StringRef Kind;
+ switch (DPV.getType()) {
+ case DPValue::LocationType::Value:
+ Kind = "value";
+ break;
+ case DPValue::LocationType::Declare:
+ Kind = "declare";
+ break;
+ case DPValue::LocationType::Assign:
+ Kind = "assign";
+ break;
+ default:
+ llvm_unreachable("Tried to print a DPValue with an invalid LocationType!");
----------------
jmorse wrote:
Will CheckDI cause this function to return if there's an error? If it doesn't, and the earlier CheckDI falls down to here then we'll have a verifier error that's always an assertion failure too, which seems too brittle.
https://github.com/llvm/llvm-project/pull/79810
More information about the llvm-commits
mailing list