From 69323c693cb85a17eddf3af4e6050f8aef7afff9 Mon Sep 17 00:00:00 2001 From: Xinliang David Li Date: Tue, 10 Nov 2015 17:11:33 +0000 Subject: [PATCH] Fix asan warning (NFC) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252617 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ProfileData/InstrProf.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ProfileData/InstrProf.cpp b/lib/ProfileData/InstrProf.cpp index 22c04fbf58e..d74c51b2bbc 100644 --- a/lib/ProfileData/InstrProf.cpp +++ b/lib/ProfileData/InstrProf.cpp @@ -247,8 +247,9 @@ void ValueProfData::deserializeTo(InstrProfRecord &Record, std::unique_ptr ValueProfData::serializeFrom(const InstrProfRecord &Record) { uint32_t TotalSize = getSize(Record); - std::unique_ptr VPD( - reinterpret_cast(new char[TotalSize])); + void *RawMem = ::operator new(TotalSize); + ValueProfData *VPDMem = new (RawMem) ValueProfData(); + std::unique_ptr VPD(VPDMem); VPD->TotalSize = TotalSize; VPD->NumValueKinds = Record.getNumValueKinds(); -- 2.34.1