std::vector<BugReportEquivClass *> EQClassesVector;
public:
- BugReporter(BugReporterData &d) : D(d) {}
+ BugReporter(BugReporterData &d);
virtual ~BugReporter();
/// Generate and flush diagnostics for all bug reports.
ArrayRef<FixItHint> Fixits = None);
private:
- llvm::StringMap<BugType *> StrBugTypes;
+ llvm::StringMap<std::unique_ptr<BugType>> StrBugTypes;
/// Returns a BugType that is associated with the given name and
/// category.
return Eng.getStateManager();
}
+BugReporter::BugReporter(BugReporterData &d) : D(d) {}
BugReporter::~BugReporter() {
// Make sure reports are flushed.
assert(StrBugTypes.empty() &&
// EmitBasicReport.
// FIXME: There are leaks from checkers that assume that the BugTypes they
// create will be destroyed by the BugReporter.
- llvm::DeleteContainerSeconds(StrBugTypes);
+ StrBugTypes.clear();
}
//===----------------------------------------------------------------------===//
SmallString<136> fullDesc;
llvm::raw_svector_ostream(fullDesc) << CheckName.getName() << ":" << name
<< ":" << category;
- BugType *&BT = StrBugTypes[fullDesc];
+ std::unique_ptr<BugType> &BT = StrBugTypes[fullDesc];
if (!BT)
- BT = new BugType(CheckName, name, category);
- return BT;
+ BT = std::make_unique<BugType>(CheckName, name, category);
+ return BT.get();
}