[PATCH] D27358: [MS-ABI]V-base dtor called more than needed when throw happens in v-base ctor in window. Need add "complete object flag" check in eh cleanup code.

Jennifer Yu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 6 14:33:49 PST 2016


jyu2 added a comment.

I changed!  Thank you do much.  Upload new patch.



================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:1530-1532
+    const CXXRecordDecl *ClassDecl =
+             cast<CXXConstructorDecl>(CGF.CurCodeDecl)->getParent();
+    if (ClassDecl != nullptr && ClassDecl->getNumVBases())
----------------
rnk wrote:
> jyu2 wrote:
> > rnk wrote:
> > > These checks seem unnecessary. ForVirtualBase should never be true if there are no vbases, and the IsMostDerivedClass assert will catch it if not.
> > Yes, you are right.  I can either check here, or check if IsMostDerivedClass is nullptr return instead assertion inside EmitDtorCompleteObjectHandler.
> > 
> > As you know ForVirutalBase is set also for destructor.  But we only need this for ctor.  
> > 
> > 
> Yes, the first if check is necessary, but the second check for `ClassDecl != nullptr && ClassDecl->getNumVBases()` should never be false when ForVirtualBase is true.
Yes, make sense!! I don't know what I was think.  Changed.   


Repository:
  rL LLVM

https://reviews.llvm.org/D27358





More information about the cfe-commits mailing list