[llvm] r290618 - DebugInfo: add explicit casts for -Wqual-cast
Saleem Abdulrasool via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 27 10:35:25 PST 2016
Author: compnerd
Date: Tue Dec 27 12:35:24 2016
New Revision: 290618
URL: http://llvm.org/viewvc/llvm-project?rev=290618&view=rev
Log:
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]
Modified:
llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
Modified: llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.cpp?rev=290618&r1=290617&r2=290618&view=diff
==============================================================================
--- llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.cpp (original)
+++ llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.cpp Tue Dec 27 12:35:24 2016
@@ -81,8 +81,10 @@ void dwarfgen::DIE::addAttribute(uint16_
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<uint8_t *>(static_cast<const uint8_t *>(P)))[I]));
Block->ComputeSize(DG.getAsmPrinter());
Die->addValue(DG.getAllocator(), static_cast<dwarf::Attribute>(A), Form,
More information about the llvm-commits
mailing list