Skip to content

Commit 6e9ee42

Browse files
committed
DWARFContext: use std::make_unique rather than reset+new
1 parent 6da382d commit 6e9ee42

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/DebugInfo/DWARF/DWARFContext.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static T &getAccelTable(std::unique_ptr<T> &Cache, const DWARFObject &Obj,
193193
return *Cache;
194194
DWARFDataExtractor AccelSection(Obj, Section, IsLittleEndian, 0);
195195
DataExtractor StrData(StringSection, IsLittleEndian, 0);
196-
Cache.reset(new T(AccelSection, StrData));
196+
Cache = std::make_unique<T>(AccelSection, StrData);
197197
if (Error E = Cache->extract())
198198
llvm::consumeError(std::move(E));
199199
return *Cache;
@@ -377,23 +377,23 @@ class ThreadUnsafeDWARFContextState : public DWARFContext::DWARFContextState {
377377
? DWARFDataExtractor(DObj, DObj.getLocSection(), D.isLittleEndian(),
378378
D.getUnitAtIndex(0)->getAddressByteSize())
379379
: DWARFDataExtractor("", D.isLittleEndian(), 0);
380-
Loc.reset(new DWARFDebugLoc(std::move(Data)));
380+
Loc = std::make_unique<DWARFDebugLoc>(std::move(Data));
381381
return Loc.get();
382382
}
383383

384384
const DWARFDebugAranges *getDebugAranges() override {
385385
if (Aranges)
386386
return Aranges.get();
387387

388-
Aranges.reset(new DWARFDebugAranges());
388+
Aranges = std::make_unique<DWARFDebugAranges>();
389389
Aranges->generate(&D);
390390
return Aranges.get();
391391
}
392392

393393
Expected<const DWARFDebugLine::LineTable *>
394394
getLineTableForUnit(DWARFUnit *U, function_ref<void(Error)> RecoverableErrorHandler) override {
395395
if (!Line)
396-
Line.reset(new DWARFDebugLine);
396+
Line = std::make_unique<DWARFDebugLine>();
397397

398398
auto UnitDIE = U->getUnitDIE();
399399
if (!UnitDIE)

0 commit comments

Comments
 (0)