mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-18 16:03:17 +00:00
Minor cleanups (from review feedback)
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
This commit is contained in:
parent
56da3453df
commit
2d31815e4b
@ -20,12 +20,11 @@
|
||||
#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/raw_ostream.h"
|
||||
#include <iterator>
|
||||
#include <map>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@ -186,13 +185,15 @@ private:
|
||||
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 reinterpret_cast<const InstrProfValueData*>(ValueDataStart + Offset);
|
||||
return reinterpret_cast<const InstrProfValueData *>(ValueDataStart +
|
||||
Offset);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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 =
|
||||
|
Loading…
x
Reference in New Issue
Block a user