summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ProfileData/InstrProf.cpp
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2015-11-10 17:11:33 +0000
committerXinliang David Li <davidxl@google.com>2015-11-10 17:11:33 +0000
commit6021b75a1f8fedfd4293d6c4bc850f375df19ceb (patch)
tree7b2b200a5d3d855e9b79d82c45057f901ef30e58 /llvm/lib/ProfileData/InstrProf.cpp
parent766589efdce379bd905a126180fead66760acda7 (diff)
downloadbcm5719-llvm-6021b75a1f8fedfd4293d6c4bc850f375df19ceb.tar.gz
bcm5719-llvm-6021b75a1f8fedfd4293d6c4bc850f375df19ceb.zip
Fix asan warning (NFC)
llvm-svn: 252617
Diffstat (limited to 'llvm/lib/ProfileData/InstrProf.cpp')
-rw-r--r--llvm/lib/ProfileData/InstrProf.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp
index 22c04fbf58e..d74c51b2bbc 100644
--- a/llvm/lib/ProfileData/InstrProf.cpp
+++ b/llvm/lib/ProfileData/InstrProf.cpp
@@ -247,8 +247,9 @@ void ValueProfData::deserializeTo(InstrProfRecord &Record,
std::unique_ptr<ValueProfData>
ValueProfData::serializeFrom(const InstrProfRecord &Record) {
uint32_t TotalSize = getSize(Record);
- std::unique_ptr<ValueProfData> VPD(
- reinterpret_cast<ValueProfData *>(new char[TotalSize]));
+ void *RawMem = ::operator new(TotalSize);
+ ValueProfData *VPDMem = new (RawMem) ValueProfData();
+ std::unique_ptr<ValueProfData> VPD(VPDMem);
VPD->TotalSize = TotalSize;
VPD->NumValueKinds = Record.getNumValueKinds();
OpenPOWER on IntegriCloud