[llvm] 6e9ee42 - DWARFContext: use std::make_unique rather than reset+new

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 4 16:00:15 PDT 2023


Author: David Blaikie
Date: 2023-10-04T23:00:07Z
New Revision: 6e9ee42a5161081dcada4c2d187eb8e1bbff633a

URL: https://github.com/llvm/llvm-project/commit/6e9ee42a5161081dcada4c2d187eb8e1bbff633a
DIFF: https://github.com/llvm/llvm-project/commit/6e9ee42a5161081dcada4c2d187eb8e1bbff633a.diff

LOG: DWARFContext: use std::make_unique rather than reset+new

Added: 
    

Modified: 
    llvm/lib/DebugInfo/DWARF/DWARFContext.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 5345f146c1d9e0d..3d943a04da2c226 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -193,7 +193,7 @@ static T &getAccelTable(std::unique_ptr<T> &Cache, const DWARFObject &Obj,
     return *Cache;
   DWARFDataExtractor AccelSection(Obj, Section, IsLittleEndian, 0);
   DataExtractor StrData(StringSection, IsLittleEndian, 0);
-  Cache.reset(new T(AccelSection, StrData));
+  Cache = std::make_unique<T>(AccelSection, StrData);
   if (Error E = Cache->extract())
     llvm::consumeError(std::move(E));
   return *Cache;
@@ -377,7 +377,7 @@ class ThreadUnsafeDWARFContextState : public DWARFContext::DWARFContextState {
             ? DWARFDataExtractor(DObj, DObj.getLocSection(), D.isLittleEndian(),
                                  D.getUnitAtIndex(0)->getAddressByteSize())
             : DWARFDataExtractor("", D.isLittleEndian(), 0);
-    Loc.reset(new DWARFDebugLoc(std::move(Data)));
+    Loc = std::make_unique<DWARFDebugLoc>(std::move(Data));
     return Loc.get();
   }
 
@@ -385,7 +385,7 @@ class ThreadUnsafeDWARFContextState : public DWARFContext::DWARFContextState {
     if (Aranges)
       return Aranges.get();
 
-    Aranges.reset(new DWARFDebugAranges());
+    Aranges = std::make_unique<DWARFDebugAranges>();
     Aranges->generate(&D);
     return Aranges.get();
   }
@@ -393,7 +393,7 @@ class ThreadUnsafeDWARFContextState : public DWARFContext::DWARFContextState {
   Expected<const DWARFDebugLine::LineTable *>
   getLineTableForUnit(DWARFUnit *U, function_ref<void(Error)> RecoverableErrorHandler) override {
     if (!Line)
-      Line.reset(new DWARFDebugLine);
+      Line = std::make_unique<DWARFDebugLine>();
 
     auto UnitDIE = U->getUnitDIE();
     if (!UnitDIE)


        


More information about the llvm-commits mailing list