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:
David Blaikie 2014-08-29 19:57:52 +00:00
parent ffe5106fe6
commit 43e3717bdb
2 changed files with 8 additions and 6 deletions

View File

@ -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 {

View File

@ -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));
}