[BOLT][NFC] Refactor reset-release to move assignment

Summary:
Follow the clang-tidy suggestion to replace reset-release with move assignment.

Move assignment's effect for unique_ptr:
> Effects: Transfers ownership from `u` to `*this` as if by calling `reset(u.release())`
followed by an assignment from `std::forward<D>(u.get_deleter())`.
This commit is contained in:
Amir Ayupov 2021-06-23 15:10:47 -07:00
parent 18bc405a09
commit d914486a9a
1 changed files with 5 additions and 4 deletions

View File

@ -29,6 +29,7 @@
#include "llvm/Support/raw_ostream.h"
#include <map>
#include <unordered_map>
#include <utility>
#define DEBUG_TYPE "aggregator"
@ -286,7 +287,7 @@ void DataAggregator::processFileBuildID(StringRef FileBuildID) {
return;
}
FileBuf.reset(MB->release());
FileBuf = std::move(*MB);
ParsingBuf = FileBuf->getBuffer();
if (ParsingBuf.empty()) {
errs() << "PERF2BOLT-WARNING: build-id will not be checked because perf "
@ -347,7 +348,7 @@ void DataAggregator::parsePreAggregated() {
exit(1);
}
FileBuf.reset(MB->release());
FileBuf = std::move(*MB);
ParsingBuf = FileBuf->getBuffer();
Col = 0;
Line = 1;
@ -501,7 +502,7 @@ Error DataAggregator::preprocessProfile(BinaryContext &BC) {
exit(1);
}
FileBuf.reset(MB->release());
FileBuf = std::move(*MB);
ParsingBuf = FileBuf->getBuffer();
Col = 0;
Line = 1;
@ -585,7 +586,7 @@ Error DataAggregator::preprocessProfile(BinaryContext &BC) {
exit(1);
}
FileBuf.reset(MB->release());
FileBuf = std::move(*MB);
ParsingBuf = FileBuf->getBuffer();
Col = 0;
Line = 1;