[PATCH] D27007: Remove C++ default arg side table for MS ABI ctor closures

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 23 09:05:19 PST 2016

rnk added inline comments.

Comment at: lib/Sema/SemaExprCXX.cpp:861
       // friendship or any other means).
       Context.addCopyConstructorForExceptionObject(Subobject, CD);
rsmith wrote:
> It would seem a lot more reasonable to actually form an expression to perform the copy of the exception object, and attach that to the `ThrowExpr` somehow.
> Most of this work should not be MS-ABI-specific -- we're required to check that a thrown exception object can be copied (from a non-cv-qualified lvalue) regardless of ABI mode (see [except.throw]/5). In fact, for AST consumers other than IR generation, we could argue that /none/ of this should be MS-ABI specific; those consumers might want to find the implied call to the exception type's copy constructor within the guts of the throw expression, even if we never happen to use it when targeting Itanium.
> So... how about we just unconditionally store a copy expression on the `ThrowExpr`? (With an `OpaqueValueExpr` representing the exception itself.)
Sounds like a good plan. I'm going to take a shot at that ArrayRef on FunctionDecl thing first, though.



More information about the cfe-commits mailing list