[llvm] r252617 - Fix asan warning (NFC)
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 10 09:11:33 PST 2015
Author: davidxl
Date: Tue Nov 10 11:11:33 2015
New Revision: 252617
URL: http://llvm.org/viewvc/llvm-project?rev=252617&view=rev
Log:
Fix asan warning (NFC)
Modified:
llvm/trunk/lib/ProfileData/InstrProf.cpp
Modified: llvm/trunk/lib/ProfileData/InstrProf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProf.cpp?rev=252617&r1=252616&r2=252617&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/InstrProf.cpp (original)
+++ llvm/trunk/lib/ProfileData/InstrProf.cpp Tue Nov 10 11:11:33 2015
@@ -247,8 +247,9 @@ void ValueProfData::deserializeTo(InstrP
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();
More information about the llvm-commits
mailing list