[llvm] r253515 - Minor cleanups (from review feedback)
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 18 14:42:28 PST 2015
Author: davidxl
Date: Wed Nov 18 16:42:27 2015
New Revision: 253515
URL: http://llvm.org/viewvc/llvm-project?rev=253515&view=rev
Log:
Minor cleanups (from review feedback)
1. remove uneeded header inclusion
2. use reinterpret_cast instead of c ctyle
3. other format change
Modified:
llvm/trunk/include/llvm/ProfileData/InstrProfReader.h
llvm/trunk/lib/ProfileData/InstrProfReader.cpp
Modified: llvm/trunk/include/llvm/ProfileData/InstrProfReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProfReader.h?rev=253515&r1=253514&r2=253515&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/InstrProfReader.h (original)
+++ llvm/trunk/include/llvm/ProfileData/InstrProfReader.h Wed Nov 18 16:42:27 2015
@@ -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);
}
};
Modified: llvm/trunk/lib/ProfileData/InstrProfReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProfReader.cpp?rev=253515&r1=253514&r2=253515&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/InstrProfReader.cpp (original)
+++ llvm/trunk/lib/ProfileData/InstrProfReader.cpp Wed Nov 18 16:42:27 2015
@@ -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<IntPt
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 =
More information about the llvm-commits
mailing list