forked from OSchip/llvm-project
unique_ptrify thep passing of BugReports to BugReportEquivClass
I suspect llvm::ilist should take elements by unique_ptr, since it does take ownership of the element (by stitching it into the linked list) - one day. llvm-svn: 216761
This commit is contained in:
parent
ffe5106fe6
commit
43e3717bdb
|
@ -345,9 +345,12 @@ class BugReportEquivClass : public llvm::FoldingSetNode {
|
|||
llvm::ilist<BugReport> Reports;
|
||||
|
||||
friend class BugReporter;
|
||||
void AddReport(BugReport* R) { Reports.push_back(R); }
|
||||
void AddReport(std::unique_ptr<BugReport> R) {
|
||||
Reports.push_back(R.release());
|
||||
}
|
||||
|
||||
public:
|
||||
BugReportEquivClass(BugReport* R) { Reports.push_back(R); }
|
||||
BugReportEquivClass(std::unique_ptr<BugReport> R) { AddReport(std::move(R)); }
|
||||
~BugReportEquivClass();
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID& ID) const {
|
||||
|
|
|
@ -3278,12 +3278,11 @@ void BugReporter::emitReport(BugReport* R) {
|
|||
BugReportEquivClass* EQ = EQClasses.FindNodeOrInsertPos(ID, InsertPos);
|
||||
|
||||
if (!EQ) {
|
||||
EQ = new BugReportEquivClass(UniqueR.release());
|
||||
EQ = new BugReportEquivClass(std::move(UniqueR));
|
||||
EQClasses.InsertNode(EQ, InsertPos);
|
||||
EQClassesVector.push_back(EQ);
|
||||
}
|
||||
else
|
||||
EQ->AddReport(UniqueR.release());
|
||||
} else
|
||||
EQ->AddReport(std::move(UniqueR));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue