diff --git a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp index 4378ba886a24..9a72f70a0f21 100644 --- a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp @@ -81,8 +81,10 @@ void dwarfgen::DIE::addAttribute(uint16_t A, dwarf::Form Form, const void *P, auto &DG = CU->getGenerator(); DIEBlock *Block = new (DG.getAllocator()) DIEBlock; for (size_t I = 0; I < S; ++I) - Block->addValue(DG.getAllocator(), (dwarf::Attribute)0, - dwarf::DW_FORM_data1, DIEInteger(((uint8_t *)P)[I])); + Block->addValue( + DG.getAllocator(), (dwarf::Attribute)0, dwarf::DW_FORM_data1, + DIEInteger( + (const_cast(static_cast(P)))[I])); Block->ComputeSize(DG.getAsmPrinter()); Die->addValue(DG.getAllocator(), static_cast(A), Form,