rsmith accepted this revision.
rsmith added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/Sema/SemaExprCXX.cpp:861
       // friendship or any other means).
       Context.addCopyConstructorForExceptionObject(Subobject, CD);
 
----------------
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.)


https://reviews.llvm.org/D27007



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to