1. remove uneeded header inclusion
2. use reinterpret_cast instead of c ctyle
3. other format change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253515
91177308-0d34-0410-b5e6-
96231b3b80d8
#include "llvm/ProfileData/InstrProf.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/ProfileData/InstrProf.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/ErrorOr.h"
-#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/LineIterator.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/OnDiskHashTable.h"
#include "llvm/Support/LineIterator.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/OnDiskHashTable.h"
+#include "llvm/Support/raw_ostream.h"
return NamesStart + Offset;
}
const uint8_t *getValueDataCounts(IntPtrT ValueCountsPtr) const {
return NamesStart + Offset;
}
const uint8_t *getValueDataCounts(IntPtrT ValueCountsPtr) const {
- ptrdiff_t Offset = (swap(ValueCountsPtr) - ValueDataDelta) / sizeof(uint8_t);
+ ptrdiff_t Offset =
+ (swap(ValueCountsPtr) - ValueDataDelta) / sizeof(uint8_t);
return ValueDataStart + Offset;
}
// This accepts an already byte-swapped ValueDataPtr argument.
const InstrProfValueData *getValueData(IntPtrT ValueDataPtr) const {
ptrdiff_t Offset = (ValueDataPtr - ValueDataDelta) / sizeof(uint8_t);
return ValueDataStart + Offset;
}
// This accepts an already byte-swapped ValueDataPtr argument.
const InstrProfValueData *getValueData(IntPtrT ValueDataPtr) const {
ptrdiff_t Offset = (ValueDataPtr - ValueDataDelta) / sizeof(uint8_t);
- return reinterpret_cast<const InstrProfValueData*>(ValueDataStart + Offset);
+ return reinterpret_cast<const InstrProfValueData *>(ValueDataStart +
+ Offset);
std::error_code RawInstrProfReader<IntPtrT>::readName(InstrProfRecord &Record) {
Record.Name = StringRef(getName(Data->NamePtr), swap(Data->NameSize));
if (Record.Name.data() < NamesStart ||
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();
}
return error(instrprof_error::malformed);
return success();
}
auto VDataCounts = makeArrayRef(getValueDataCounts(Data->Values), NumVSites);
// Check bounds.
if (VDataCounts.data() < ValueDataStart ||
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 =
return error(instrprof_error::malformed);
const InstrProfValueData *VDataPtr =