diff options
author | Xinliang David Li <davidxl@google.com> | 2015-11-10 17:11:33 +0000 |
---|---|---|
committer | Xinliang David Li <davidxl@google.com> | 2015-11-10 17:11:33 +0000 |
commit | 6021b75a1f8fedfd4293d6c4bc850f375df19ceb (patch) | |
tree | 7b2b200a5d3d855e9b79d82c45057f901ef30e58 /llvm/lib/ProfileData/InstrProf.cpp | |
parent | 766589efdce379bd905a126180fead66760acda7 (diff) | |
download | bcm5719-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.cpp | 5 |
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(); |