[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.

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 6 13:54:13 PST 2016


rnk added a comment.

Looks pretty good, just one more thing.



================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:1530-1532
+    const CXXRecordDecl *ClassDecl =
+             cast<CXXConstructorDecl>(CGF.CurCodeDecl)->getParent();
+    if (ClassDecl != nullptr && ClassDecl->getNumVBases())
----------------
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.


Repository:
  rL LLVM

https://reviews.llvm.org/D27358





More information about the cfe-commits mailing list