Diagnose unhandled cases in DW_OP_deref

This commit is contained in:
Adrian Prantl 2021-02-10 15:50:52 -08:00
parent b4993cf54d
commit 585e7a359d
2 changed files with 7 additions and 1 deletions

View File

@ -1100,7 +1100,9 @@ bool DWARFExpression::Evaluate(
break;
default:
break;
if (error_ptr)
error_ptr->SetErrorString("Unhandled value type for DW_OP_deref.\n");
return false;
}
} break;

View File

@ -276,3 +276,7 @@ TEST(DWARFExpression, DW_OP_unknown) {
llvm::FailedWithMessage(
"Unhandled opcode DW_OP_unknown_ff in DWARFExpression"));
}
TEST(DWARFExpression, DW_OP_deref) {
EXPECT_THAT_EXPECTED(Evaluate({DW_OP_lit0, DW_OP_deref}), llvm::Failed());
}