Skip to content

Commit

Permalink
Use unique_ptr for VTableBuilder::VFTableLayouts map.
Browse files Browse the repository at this point in the history
Reviewers: timshen

Subscribers: cfe-commits

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

llvm-svn: 283771
  • Loading branch information
Justin Lebar committed Oct 10, 2016
1 parent 562914e commit e920cfa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion clang/include/clang/AST/VTableBuilder.h
Expand Up @@ -480,7 +480,8 @@ class MicrosoftVTableContext : public VTableContextBase {
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;
Expand Down
3 changes: 1 addition & 2 deletions clang/lib/AST/VTableBuilder.cpp
Expand Up @@ -3389,7 +3389,6 @@ static bool rebucketPaths(VPtrInfoVector &Paths) {
}

MicrosoftVTableContext::~MicrosoftVTableContext() {
llvm::DeleteContainerSeconds(VFTableLayouts);
llvm::DeleteContainerSeconds(VBaseInfo);
}

Expand Down Expand Up @@ -3592,7 +3591,7 @@ void MicrosoftVTableContext::computeVTableRelatedInformation(
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());
Expand Down

0 comments on commit e920cfa

Please sign in to comment.