summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/cxx1y-sized-deallocation.cpp
Commit message (Collapse)AuthorAgeFilesLines
* C++14: Disable sized deallocation by default due to ABI breakageReid Kleckner2015-03-201-18/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are no widely deployed standard libraries providing sized deallocation functions, so we have to punt and ask the user if they want us to use sized deallocation. In the future, when such libraries are deployed, we can teach the driver to detect them and enable this feature. N3536 claimed that a weak thunk from sized to unsized deallocation could be emitted to avoid breaking backwards compatibility with standard libraries not providing sized deallocation. However, this approach and other variations don't work in practice. With the weak function approach, the thunk has to have default visibility in order to ensure that it is overridden by other DSOs providing sized deallocation. Weak, default visibility symbols are particularly expensive on MachO, so John McCall was considering disabling this feature by default on Darwin. It also changes behavior ELF linking behavior, causing certain otherwise unreferenced object files from an archive to be pulled into the link. Our second approach was to use an extern_weak function declaration and do an inline conditional branch at the deletion call site. This doesn't work because extern_weak only works on MachO if you have some archive providing the default value of the extern_weak symbol. Arranging to provide such an archive has the same challenges as providing the symbol in the standard library. Not to mention that extern_weak doesn't really work on COFF. Reviewers: rsmith, rjmccall Differential Revision: http://reviews.llvm.org/D8467 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232788 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Improvement on sized deallocation from r230160"Reid Kleckner2015-03-191-34/+12
| | | | | | | | | This reverts commit r230580. extern_weak functions don't appear to work on Darwin (PR22951), so we'll need to come up with a new approach. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232731 91177308-0d34-0410-b5e6-96231b3b80d8
* Improvement on sized deallocation from r230160:Larisse Voufo2015-02-251-12/+34
| | | | | | Do not declare sized deallocation functions dependently on whether it is found in global scope. Instead, enforce the branching in emitted code by (1) declaring the functions extern_weak and (2) emitting sized delete expressions as a branching between both forms delete. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230580 91177308-0d34-0410-b5e6-96231b3b80d8
* Relax the requirement on sized deallocation a bit: Default on unsized delete ↵Larisse Voufo2015-02-221-2/+9
| | | | | | if sized delete is not provided in global scope, and -fdefine-sized-deallocation option is disabled. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230160 91177308-0d34-0410-b5e6-96231b3b80d8
* Add -fno-sized-deallocation option for completeness of fix in r229241 in ↵Larisse Voufo2015-02-201-0/+1
| | | | | | documentation in r229818. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229950 91177308-0d34-0410-b5e6-96231b3b80d8
* Put the implicit weak sized deallocation funciton in C++14 in a comdatReid Kleckner2015-02-191-2/+2
| | | | | | Fixes PR22635. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229913 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename flags and options to match current naming: from -fdef-sized-delete to ↵Larisse Voufo2015-02-181-2/+2
| | | | | | -fdefine-sized-deallocation, and from DefaultSizedDelete to DefineSizedDeallocation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229597 91177308-0d34-0410-b5e6-96231b3b80d8
* Revise the implementation logic of sized deallocation: Do not automatically ↵Larisse Voufo2015-02-141-6/+10
| | | | | | | | generate weak definitions of the sized operator delete (in terms of unsized operator delete). Instead, provide the funcitonality via a new compiler flag, -fdef-sized-delete. The current implementation causes link-time ODR violations when the delete symbols are exported into the dynamic table. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229241 91177308-0d34-0410-b5e6-96231b3b80d8
* PR17983: Fix crasher bug in C++1y mode when performing a non-global arrayRichard Smith2013-12-051-8/+28
| | | | | | | | delete on a class which has no array cookie and has no class-specific operator new. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196488 91177308-0d34-0410-b5e6-96231b3b80d8
* C++1y sized deallocation: if we have a use, but not a definition, of a sizedRichard Smith2013-11-051-2/+9
| | | | | | | | | | | | | | deallocation function (and the corresponding unsized deallocation function has been declared), emit a weak discardable definition of the function that forwards to the corresponding unsized deallocation. This allows a C++ standard library implementation to provide both a sized and an unsized deallocation function, where the unsized one does not just call the sized one, for instance by putting both in the same object file within an archive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194055 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement C++1y sized deallocation (n3778). This is not enabled by -std=c++1y;Richard Smith2013-09-291-0/+83
instead, it's enabled by the -cc1 flag -fsized-deallocation, until we sort out the backward-compatibility issues. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191629 91177308-0d34-0410-b5e6-96231b3b80d8