r283771 - Use unique_ptr for VTableBuilder::VFTableLayouts map.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 10 09:26:33 PDT 2016


Author: jlebar
Date: Mon Oct 10 11:26:33 2016
New Revision: 283771

URL: http://llvm.org/viewvc/llvm-project?rev=283771&view=rev
Log:
Use unique_ptr for VTableBuilder::VFTableLayouts map.

Reviewers: timshen

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D25423

Modified:
    cfe/trunk/include/clang/AST/VTableBuilder.h
    cfe/trunk/lib/AST/VTableBuilder.cpp

Modified: cfe/trunk/include/clang/AST/VTableBuilder.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/VTableBuilder.h?rev=283771&r1=283770&r2=283771&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/VTableBuilder.h (original)
+++ cfe/trunk/include/clang/AST/VTableBuilder.h Mon Oct 10 11:26:33 2016
@@ -480,7 +480,8 @@ private:
   VFPtrLocationsMapTy VFPtrLocations;
 
   typedef std::pair<const CXXRecordDecl *, CharUnits> VFTableIdTy;
-  typedef llvm::DenseMap<VFTableIdTy, const VTableLayout *> VFTableLayoutMapTy;
+  typedef llvm::DenseMap<VFTableIdTy, std::unique_ptr<const VTableLayout>>
+      VFTableLayoutMapTy;
   VFTableLayoutMapTy VFTableLayouts;
 
   llvm::DenseMap<const CXXRecordDecl *, VirtualBaseInfo *> VBaseInfo;

Modified: cfe/trunk/lib/AST/VTableBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/VTableBuilder.cpp?rev=283771&r1=283770&r2=283771&view=diff
==============================================================================
--- cfe/trunk/lib/AST/VTableBuilder.cpp (original)
+++ cfe/trunk/lib/AST/VTableBuilder.cpp Mon Oct 10 11:26:33 2016
@@ -3389,7 +3389,6 @@ static bool rebucketPaths(VPtrInfoVector
 }
 
 MicrosoftVTableContext::~MicrosoftVTableContext() {
-  llvm::DeleteContainerSeconds(VFTableLayouts);
   llvm::DeleteContainerSeconds(VBaseInfo);
 }
 
@@ -3592,7 +3591,7 @@ void MicrosoftVTableContext::computeVTab
     assert(VFTableLayouts.count(id) == 0);
     SmallVector<VTableLayout::VTableThunkTy, 1> VTableThunks(
         Builder.vtable_thunks_begin(), Builder.vtable_thunks_end());
-    VFTableLayouts[id] = new VTableLayout(
+    VFTableLayouts[id] = llvm::make_unique<VTableLayout>(
         Builder.getNumVTableComponents(), Builder.vtable_component_begin(),
         VTableThunks.size(), VTableThunks.data(), EmptyAddressPointsMap, true);
     Thunks.insert(Builder.thunks_begin(), Builder.thunks_end());




More information about the cfe-commits mailing list