MS ABI: Implement support for throwing a C++ exception
authorDavid Majnemer <david.majnemer@gmail.com>
Thu, 5 Mar 2015 00:46:22 +0000 (00:46 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Thu, 5 Mar 2015 00:46:22 +0000 (00:46 +0000)
commit7c23707174fccfca88ae252f45409810c495af7c
tree0228475da8e2a65a52c130de8dd8b873e67070e9
parent7e6424ba5a6d64040346f775e10c7d4e3cb0c92c
MS ABI: Implement support for throwing a C++ exception

Throwing a C++ exception, under the MS ABI, is implemented using three
components:
- ThrowInfo structure which contains information like CV qualifiers,
  what destructor to call and a pointer to the CatchableTypeArray.
- In a significant departure from the Itanium ABI, copying by-value
  occurs in the runtime and not at the catch site.  This means we need
  to enumerate all possible types that this exception could be caught as
  and encode the necessary information to convert from the exception
  object's type to the catch handler's type.  This includes complicated
  derived to base conversions and the execution of copy-constructors.

N.B. This implementation doesn't support the execution of a
copy-constructor from within the runtime for now.  Adding support for
that functionality is quite difficult due to things like default
argument expressions which may evaluate arbitrary code hiding in the
copy-constructor's parameters.

Differential Revision: http://reviews.llvm.org/D8066

llvm-svn: 231328
clang/include/clang/AST/Mangle.h
clang/lib/AST/MicrosoftMangle.cpp
clang/lib/CodeGen/CGCXXABI.h
clang/lib/CodeGen/CGException.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/lib/CodeGen/MicrosoftCXXABI.cpp
clang/test/CodeGenCXX/microsoft-abi-throw.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/microsoft-abi-try-throw.cpp