@@ -1735,8 +1735,8 @@ void ItaniumVTableBuilder::LayoutPrimaryAndSecondaryVTables(
17351735 const CXXMethodDecl *MD = I.first ;
17361736 const MethodInfo &MI = I.second ;
17371737 if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(MD)) {
1738- MethodVTableIndices[GlobalDecl (DD, Dtor_Complete)]
1739- = MI.VTableIndex - AddressPoint;
1738+ MethodVTableIndices[GlobalDecl (DD, Dtor_Complete)] =
1739+ MI.VTableIndex - AddressPoint;
17401740 MethodVTableIndices[GlobalDecl (DD, Dtor_Deleting)]
17411741 = MI.VTableIndex + 1 - AddressPoint;
17421742 } else {
@@ -2657,7 +2657,11 @@ class VFTableBuilder {
26572657 MethodVFTableLocation Loc (MI.VBTableIndex , WhichVFPtr.getVBaseWithVPtr (),
26582658 WhichVFPtr.NonVirtualOffset , MI.VFTableIndex );
26592659 if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(MD)) {
2660- MethodVFTableLocations[GlobalDecl (DD, Dtor_Deleting)] = Loc;
2660+ // In Microsoft ABI vftable always references vector deleting dtor.
2661+ CXXDtorType DtorTy = Context.getTargetInfo ().getCXXABI ().isMicrosoft ()
2662+ ? Dtor_VectorDeleting
2663+ : Dtor_Deleting;
2664+ MethodVFTableLocations[GlobalDecl (DD, DtorTy)] = Loc;
26612665 } else {
26622666 MethodVFTableLocations[MD] = Loc;
26632667 }
@@ -3287,7 +3291,10 @@ void VFTableBuilder::dumpLayout(raw_ostream &Out) {
32873291 const CXXDestructorDecl *DD = Component.getDestructorDecl ();
32883292
32893293 DD->printQualifiedName (Out);
3290- Out << " () [scalar deleting]" ;
3294+ if (Context.getTargetInfo ().getCXXABI ().isMicrosoft ())
3295+ Out << " () [vector deleting]" ;
3296+ else
3297+ Out << " () [scalar deleting]" ;
32913298
32923299 if (DD->isPureVirtual ())
32933300 Out << " [pure]" ;
@@ -3736,8 +3743,7 @@ void MicrosoftVTableContext::computeVTableRelatedInformation(
37363743 }
37373744 }
37383745
3739- MethodVFTableLocations.insert (NewMethodLocations.begin (),
3740- NewMethodLocations.end ());
3746+ MethodVFTableLocations.insert_range (NewMethodLocations);
37413747 if (Context.getLangOpts ().DumpVTableLayouts )
37423748 dumpMethodLocations (RD, NewMethodLocations, llvm::outs ());
37433749}
@@ -3758,7 +3764,7 @@ void MicrosoftVTableContext::dumpMethodLocations(
37583764 PredefinedIdentKind::PrettyFunctionNoVirtual, MD);
37593765
37603766 if (isa<CXXDestructorDecl>(MD)) {
3761- IndicesMap[I.second ] = MethodName + " [scalar deleting]" ;
3767+ IndicesMap[I.second ] = MethodName + " [vector deleting]" ;
37623768 } else {
37633769 IndicesMap[I.second ] = MethodName;
37643770 }
@@ -3824,8 +3830,7 @@ const VirtualBaseInfo &MicrosoftVTableContext::computeVBTableRelatedInformation(
38243830 // virtual bases come first so that the layout is the same.
38253831 const VirtualBaseInfo &BaseInfo =
38263832 computeVBTableRelatedInformation (VBPtrBase);
3827- VBI->VBTableIndices .insert (BaseInfo.VBTableIndices .begin (),
3828- BaseInfo.VBTableIndices .end ());
3833+ VBI->VBTableIndices .insert_range (BaseInfo.VBTableIndices );
38293834 }
38303835
38313836 // New vbases are added to the end of the vbtable.
@@ -3875,7 +3880,7 @@ MicrosoftVTableContext::getMethodVFTableLocation(GlobalDecl GD) {
38753880 assert (hasVtableSlot (cast<CXXMethodDecl>(GD.getDecl ())) &&
38763881 " Only use this method for virtual methods or dtors" );
38773882 if (isa<CXXDestructorDecl>(GD.getDecl ()))
3878- assert (GD.getDtorType () == Dtor_Deleting );
3883+ assert (GD.getDtorType () == Dtor_VectorDeleting );
38793884
38803885 GD = GD.getCanonicalDecl ();
38813886
0 commit comments