Minor cleanups (from review feedback)
[oota-llvm.git] / lib / ProfileData / InstrProfReader.cpp
index 8a0354dc98cf6fb2910dc44cb6f1892839745085..fe52e1312ef467d6565d7e4de9f6f07539aaa5f1 100644 (file)
@@ -255,7 +255,8 @@ template <class IntPtrT>
 std::error_code RawInstrProfReader<IntPtrT>::readName(InstrProfRecord &Record) {
   Record.Name = StringRef(getName(Data->NamePtr), swap(Data->NameSize));
   if (Record.Name.data() < NamesStart ||
-      Record.Name.data() + Record.Name.size() > (char*)ValueDataStart)
+      Record.Name.data() + Record.Name.size() >
+          reinterpret_cast<const char *>(ValueDataStart))
     return error(instrprof_error::malformed);
   return success();
 }
@@ -311,7 +312,8 @@ std::error_code RawInstrProfReader<IntPtrT>::readValueData(
   auto VDataCounts = makeArrayRef(getValueDataCounts(Data->Values), NumVSites);
   // Check bounds.
   if (VDataCounts.data() < ValueDataStart ||
-      VDataCounts.data() + VDataCounts.size() > (const uint8_t *)ProfileEnd)
+      VDataCounts.data() + VDataCounts.size() >
+          reinterpret_cast<const uint8_t *>(ProfileEnd))
     return error(instrprof_error::malformed);
 
   const InstrProfValueData *VDataPtr =