DebugInfo: add explicit casts for -Wqual-cast

Fix a warning detected by gcc 6:
  warning: cast from type 'const void*' to type 'uint8_t* {aka unsigned char*}' casts away qualifiers [-Wcast-qual]

llvm-svn: 290618
This commit is contained in:
Saleem Abdulrasool 2016-12-27 18:35:24 +00:00
parent 1799567f12
commit ecf13bbd84
1 changed files with 4 additions and 2 deletions

View File

@ -81,8 +81,10 @@ void dwarfgen::DIE::addAttribute(uint16_t A, dwarf::Form Form, const void *P,
auto &DG = CU->getGenerator(); auto &DG = CU->getGenerator();
DIEBlock *Block = new (DG.getAllocator()) DIEBlock; DIEBlock *Block = new (DG.getAllocator()) DIEBlock;
for (size_t I = 0; I < S; ++I) for (size_t I = 0; I < S; ++I)
Block->addValue(DG.getAllocator(), (dwarf::Attribute)0, Block->addValue(
dwarf::DW_FORM_data1, DIEInteger(((uint8_t *)P)[I])); DG.getAllocator(), (dwarf::Attribute)0, dwarf::DW_FORM_data1,
DIEInteger(
(const_cast<uint8_t *>(static_cast<const uint8_t *>(P)))[I]));
Block->ComputeSize(DG.getAsmPrinter()); Block->ComputeSize(DG.getAsmPrinter());
Die->addValue(DG.getAllocator(), static_cast<dwarf::Attribute>(A), Form, Die->addValue(DG.getAllocator(), static_cast<dwarf::Attribute>(A), Form,