summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/microsoft-abi-try-throw.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [MS] Don't escape MS C++ names with \01Reid Kleckner2018-03-161-6/+6
| | | | | | | It is not needed after LLVM r327734. Now it will be easier to copy-paste IR symbol names from Clang. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327738 91177308-0d34-0410-b5e6-96231b3b80d8
* Bring r325915 back.Rafael Espindola2018-02-231-1/+1
| | | | | | | | | | | | | | | The tests that failed on a windows host have been fixed. Original message: Start setting dso_local for COFF. With this there are still some GVs where we don't set dso_local because setGVProperties is never called. I intend to fix that in followup commits. This is just the bare minimum to teach shouldAssumeDSOLocal what it should do for COFF. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325940 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Start setting dso_local for COFF."Rafael Espindola2018-02-231-1/+1
| | | | | | | | This reverts commit r325915. It will take some time to fix the failures on a windows host. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325929 91177308-0d34-0410-b5e6-96231b3b80d8
* Start setting dso_local for COFF.Rafael Espindola2018-02-231-1/+1
| | | | | | | | | With this there are still some GVs where we don't set dso_local because setGVProperties is never called. I intend to fix that in followup commits. This is just the bare minimum to teach shouldAssumeDSOLocal what it should do for COFF. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325915 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove -fnew-ms-ehDavid Majnemer2016-02-201-1/+1
| | | | | | This flag no longer controls any behavior inside of clang. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261423 91177308-0d34-0410-b5e6-96231b3b80d8
* Try to appease a buildbot.David Majnemer2015-12-121-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255424 91177308-0d34-0410-b5e6-96231b3b80d8
* Update clang to use the updated LLVM EH instructionsDavid Majnemer2015-12-121-2/+2
| | | | | | | | | | Depends on D15139. Reviewers: rnk Differential Revision: http://reviews.llvm.org/D15140 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255423 91177308-0d34-0410-b5e6-96231b3b80d8
* [WinEH] Pass the catch adjectives to catchpad directlyReid Kleckner2015-09-161-7/+5
| | | | | | | | | This avoids building a fake LLVM IR global variable just to ferry an i32 down into LLVM codegen. It also puts a nail in the coffin of using MS ABI C++ EH with landingpads, since now we'll assert in the lpad code when flags are present. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247843 91177308-0d34-0410-b5e6-96231b3b80d8
* Compute and preserve alignment more faithfully in IR-generation.John McCall2015-09-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce an Address type to bundle a pointer value with an alignment. Introduce APIs on CGBuilderTy to work with Address values. Change core APIs on CGF/CGM to traffic in Address where appropriate. Require alignments to be non-zero. Update a ton of code to compute and propagate alignment information. As part of this, I've promoted CGBuiltin's EmitPointerWithAlignment helper function to CGF and made use of it in a number of places in the expression emitter. The end result is that we should now be significantly more correct when performing operations on objects that are locally known to be under-aligned. Since alignment is not reliably tracked in the type system, there are inherent limits to this, but at least we are no longer confused by standard operations like derived-to-base conversions and array-to-pointer decay. I've also fixed a large number of bugs where we were applying the complete-object alignment to a pointer instead of the non-virtual alignment, although most of these were hidden by the very conservative approach we took with member alignment. Also, because IRGen now reliably asserts on zero alignments, we should no longer be subject to an absurd but frustrating recurring bug where an incomplete type would report a zero alignment and then we'd naively do a alignmentAtOffset on it and emit code using an alignment equal to the largest power-of-two factor of the offset. We should also now be emitting much more aggressive alignment attributes in the presence of over-alignment. In particular, field access now uses alignmentAtOffset instead of min. Several times in this patch, I had to change the existing code-generation pattern in order to more effectively use the Address APIs. For the most part, this seems to be a strict improvement, like doing pointer arithmetic with GEPs instead of ptrtoint. That said, I've tried very hard to not change semantics, but it is likely that I've failed in a few places, for which I apologize. ABIArgInfo now always carries the assumed alignment of indirect and indirect byval arguments. In order to cut down on what was already a dauntingly large patch, I changed the code to never set align attributes in the IR on non-byval indirect arguments. That is, we still generate code which assumes that indirect arguments have the given alignment, but we don't express this information to the backend except where it's semantically required (i.e. on byvals). This is likely a minor regression for those targets that did provide this information, but it'll be trivial to add it back in a later patch. I partially punted on applying this work to CGBuiltin. Please do not add more uses of the CreateDefaultAligned{Load,Store} APIs; they will be going away eventually. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246985 91177308-0d34-0410-b5e6-96231b3b80d8
* [WinEH] Don't create an alloca for unnamed catch parametersReid Kleckner2015-04-071-1/+1
| | | | | | | | The catch object parameter to llvm.eh.begincatch is optional, and can be null. We can save some ourselves the stack space, copy ctor, and dtor calls if we pass null. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234264 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS ABI] Rework .xdata HandlerType emissionDavid Majnemer2015-03-291-3/+3
| | | | | | | | | | Utilizing IMAGEREL relocations for synthetic IR constructs isn't valuable, just clutter. While we are here, simplify HandlerType names by making the numeric value for the 'adjective' part of the mangled name instead of appending '.const', etc. The old scheme made for very long global names and leads to wordy things like '.std_bad_alloc' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233503 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Emit HandlerMap entries for C++ catchDavid Majnemer2015-03-171-2/+4
| | | | | | | | | | | | | The HandlerMap describes, to the runtime, what sort of catches surround the try. In principle, this structure has to be emitted by the backend because only it knows the layout of the stack (the runtime needs to know where on the stack the destination of a copy lives, etc.) but there is some C++ specific information that the backend can't reason about. Stick this information in special LLVM globals with the relevant "const", "volatile", "reference" info mangled into the name. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232538 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Don't use qualified pointee types for 'catch' EH TypeDescriptorsDavid Majnemer2015-03-151-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Qualifiers are located next to the TypeDescriptor in order to properly ensure that a pointer type can only be caught by a more qualified catch handler. This means that a catch handler of type 'const int *' requires an RTTI object for 'int *'. We got this correct for 'throw' but not for 'catch'. N.B. We don't currently have the means to store the qualifiers because LLVM's EH strategy is tailored to the Itanium scheme. The Itanium ABI stores qualifiers inside the type descriptor in such a way that the manner of qualification is stored in addition to the pointee type's descriptor. Perhaps the best way of modeling this for the MS ABI is using an aggregate type to bundle the qualifiers with the descriptor? This is tricky because we want to make it clear to the optimization passes which catch handlers invalidate other handlers. My current thoughts on a design for this is along the lines of: { { TypeDescriptor* TD, i32 QualifierFlags }, i32 MiscFlags } The idea is that the inner most aggregate is all that is needed to communicate that one catch handler might supercede another. The 'MiscFlags' field would be used to hold the bitpattern for the notion that the 'catch' handler does not need to invoke a copy-constructor because we are catching by reference. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232318 91177308-0d34-0410-b5e6-96231b3b80d8
* Unbreak build botsDavid Majnemer2015-03-061-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231536 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Stick throw-related data into the .xdata sectionDavid Majnemer2015-03-061-1/+1
| | | | | | | This is a little nicer as it keeps the contents of .xdata away from normal .rdata; we expect .xdata to be far colder than .rdata. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231534 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Implement support for throwing a C++ exceptionDavid Majnemer2015-03-051-1/+8
| | | | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231328 91177308-0d34-0410-b5e6-96231b3b80d8
* Split catch IRgen into ItaniumCXXABI and MicrosoftCXXABIReid Kleckner2015-03-031-4/+3
| | | | | | | | | Use llvm.eh.begincatch for Microsoft-style catches. This moves lots of CGException code into ItaniumCXXABI. Sorry for the blame pain. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231105 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable the right RUN lineReid Kleckner2015-03-031-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231098 91177308-0d34-0410-b5e6-96231b3b80d8
* Disabled the other test from r231086 (like in r231087) since it also had ↵Filipe Cabecinhas2015-03-031-1/+1
| | | | | | problems git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231096 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable a Clang test until the begincatch change landsReid Kleckner2015-03-031-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231087 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Turn throw into std::terminate for now, make try/catch "work"David Majnemer2015-02-251-5/+8
| | | | | | | This lets us compile programs which make use of exceptional constructs statically without executing any of them dynamically. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230568 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Emit an error during IRgen on C++ exception handlingReid Kleckner2014-05-051-0/+23
Currently, users get error messages about RTTI descriptor mangling with no useful source location. This addresses that. Another approach would be to disable C++ exceptions by default in the driver when using the Microsoft C++ ABI. However, this makes it impossible to parse system headers that use exception handling constructs. By delaying the error to IRgen, we can figure out if we actually need to emit code for this construct. Additionally, users who are only interested in building refactoring tools on Windows still get a correct AST without having to add flags. Finally, this is consistent with what we do for SEH. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207999 91177308-0d34-0410-b5e6-96231b3b80d8