summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2015-11-18 22:42:27 +0000
committerXinliang David Li <davidxl@google.com>2015-11-18 22:42:27 +0000
commitcfb1456572949abcbe1769c5c272ce1f397db883 (patch)
treed6a6ac8d8ff1e53047f3b8d27e981c49dbf5fcaa
parent455ea11d13a1f88d8c5c65f78ef21a81efab8f22 (diff)
downloadbcm5719-llvm-cfb1456572949abcbe1769c5c272ce1f397db883.tar.gz
bcm5719-llvm-cfb1456572949abcbe1769c5c272ce1f397db883.zip
Minor cleanups (from review feedback)
1. remove uneeded header inclusion 2. use reinterpret_cast instead of c ctyle 3. other format change llvm-svn: 253515
-rw-r--r--llvm/include/llvm/ProfileData/InstrProfReader.h9
-rw-r--r--llvm/lib/ProfileData/InstrProfReader.cpp6
2 files changed, 9 insertions, 6 deletions
diff --git a/llvm/include/llvm/ProfileData/InstrProfReader.h b/llvm/include/llvm/ProfileData/InstrProfReader.h
index c1d17c27158..f58000c3057 100644
--- a/llvm/include/llvm/ProfileData/InstrProfReader.h
+++ b/llvm/include/llvm/ProfileData/InstrProfReader.h
@@ -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);
}
};
diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp
index 8a0354dc98c..fe52e1312ef 100644
--- a/llvm/lib/ProfileData/InstrProfReader.cpp
+++ b/llvm/lib/ProfileData/InstrProfReader.cpp
@@ -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 =
OpenPOWER on IntegriCloud