diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2016-05-20 09:18:37 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2016-05-20 09:18:37 +0000 |
commit | 38de59e4d9914923d4ec6a01f6049b0f682245a3 (patch) | |
tree | dba7e4df3a25f4d0e3156953e3d4758f2e933b3e /llvm/lib/ProfileData | |
parent | ac40e81987bd07620d17cfbf7ad8287bb9bd973c (diff) | |
download | bcm5719-llvm-38de59e4d9914923d4ec6a01f6049b0f682245a3.tar.gz bcm5719-llvm-38de59e4d9914923d4ec6a01f6049b0f682245a3.zip |
[ProfileData] Thread unique_ptr through the summary builder to avoid leaks.
llvm-svn: 270195
Diffstat (limited to 'llvm/lib/ProfileData')
-rw-r--r-- | llvm/lib/ProfileData/InstrProfReader.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/ProfileData/InstrProfWriter.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/ProfileData/ProfileSummaryBuilder.cpp | 16 | ||||
-rw-r--r-- | llvm/lib/ProfileData/SampleProfReader.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/ProfileData/SampleProfWriter.cpp | 2 |
5 files changed, 12 insertions, 12 deletions
diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp index 8ffdc5b8091..a7d8fcf76e1 100644 --- a/llvm/lib/ProfileData/InstrProfReader.cpp +++ b/llvm/lib/ProfileData/InstrProfReader.cpp @@ -617,7 +617,7 @@ IndexedInstrProfReader::readSummary(IndexedInstrProf::ProfVersion Version, InstrProfSummaryBuilder Builder(ProfileSummaryBuilder::DefaultCutoffs); // FIXME: This only computes an empty summary. Need to call addRecord for // all InstrProfRecords to get the correct summary. - this->Summary.reset(Builder.getSummary()); + this->Summary = Builder.getSummary(); return Cur; } } diff --git a/llvm/lib/ProfileData/InstrProfWriter.cpp b/llvm/lib/ProfileData/InstrProfWriter.cpp index e9543ceb91f..e25299ef670 100644 --- a/llvm/lib/ProfileData/InstrProfWriter.cpp +++ b/llvm/lib/ProfileData/InstrProfWriter.cpp @@ -259,7 +259,7 @@ void InstrProfWriter::writeImpl(ProfOStream &OS) { IndexedInstrProf::allocSummary(SummarySize); // Compute the Summary and copy the data to the data // structure to be serialized out (to disk or buffer). - ProfileSummary *PS = ISB.getSummary(); + std::unique_ptr<ProfileSummary> PS = ISB.getSummary(); setSummary(TheSummary.get(), *PS); InfoObj->SummaryBuilder = 0; diff --git a/llvm/lib/ProfileData/ProfileSummaryBuilder.cpp b/llvm/lib/ProfileData/ProfileSummaryBuilder.cpp index ee40d68a1a6..1e71bb99da1 100644 --- a/llvm/lib/ProfileData/ProfileSummaryBuilder.cpp +++ b/llvm/lib/ProfileData/ProfileSummaryBuilder.cpp @@ -86,18 +86,18 @@ void ProfileSummaryBuilder::computeDetailedSummary() { } } -ProfileSummary *SampleProfileSummaryBuilder::getSummary() { +std::unique_ptr<ProfileSummary> SampleProfileSummaryBuilder::getSummary() { computeDetailedSummary(); - return new ProfileSummary(ProfileSummary::PSK_Sample, DetailedSummary, - TotalCount, MaxCount, 0, MaxFunctionCount, - NumCounts, NumFunctions); + return llvm::make_unique<ProfileSummary>( + ProfileSummary::PSK_Sample, DetailedSummary, TotalCount, MaxCount, 0, + MaxFunctionCount, NumCounts, NumFunctions); } -ProfileSummary *InstrProfSummaryBuilder::getSummary() { +std::unique_ptr<ProfileSummary> InstrProfSummaryBuilder::getSummary() { computeDetailedSummary(); - return new ProfileSummary(ProfileSummary::PSK_Instr, DetailedSummary, - TotalCount, MaxCount, MaxInternalBlockCount, - MaxFunctionCount, NumCounts, NumFunctions); + return llvm::make_unique<ProfileSummary>( + ProfileSummary::PSK_Instr, DetailedSummary, TotalCount, MaxCount, + MaxInternalBlockCount, MaxFunctionCount, NumCounts, NumFunctions); } void InstrProfSummaryBuilder::addEntryCount(uint64_t Count) { diff --git a/llvm/lib/ProfileData/SampleProfReader.cpp b/llvm/lib/ProfileData/SampleProfReader.cpp index bd5aacc96f0..d3929e81ff4 100644 --- a/llvm/lib/ProfileData/SampleProfReader.cpp +++ b/llvm/lib/ProfileData/SampleProfReader.cpp @@ -798,5 +798,5 @@ void SampleProfileReader::computeSummary() { const FunctionSamples &Profile = I.second; Builder.addRecord(Profile); } - Summary.reset(Builder.getSummary()); + Summary = Builder.getSummary(); } diff --git a/llvm/lib/ProfileData/SampleProfWriter.cpp b/llvm/lib/ProfileData/SampleProfWriter.cpp index 9c58f9ed3b4..4fa71288f8d 100644 --- a/llvm/lib/ProfileData/SampleProfWriter.cpp +++ b/llvm/lib/ProfileData/SampleProfWriter.cpp @@ -260,5 +260,5 @@ void SampleProfileWriter::computeSummary( const FunctionSamples &Profile = I.second; Builder.addRecord(Profile); } - Summary.reset(Builder.getSummary()); + Summary = Builder.getSummary(); } |