summaryrefslogtreecommitdiff
path: root/libcxxabi/src
Commit message (Collapse)AuthorAgeFilesLines
* [libcxxabi] define _LIBCPP_VERBOSE_ABORTNick Desaulniers2023-05-172-0/+6
| | | | | | | | | | | | | | | libc++ may be built with or without assertions. This causes definitions of various methods of std::string_view to contain assertions and calls to __libcpp_verbose_abort which libcxxabi does not provide. libcxxabi does provide abort_message with the same interface, so define _LIBCPP_VERBOSE_ABORT to use that. Otherwise D148566 will trigger linkage failures for the missing symbol __libcpp_verbose_abort. Link: https://libcxx.llvm.org/UsingLibcxx.html#enabling-the-safe-libc-mode Reviewed By: #libc_abi, philnik, ldionne Differential Revision: https://reviews.llvm.org/D149092
* [libc++][PSTL] Remove current integrationNikolas Klauser2023-04-211-10/+0
| | | | | | | | | | We decided to go a different route. To make the switch easier, rip out the old integration first and build on a clean base. Reviewed By: ldionne, #libc, #libc_abi Spies: arichardson, libcxx-commits Differential Revision: https://reviews.llvm.org/D148480
* [libcxxabi][demangle] create helper for std::string_view::starts_withNick Desaulniers2023-04-202-1/+35
| | | | | | | | | | | | | Add C++ 20 style starts_with to replace StringView::startsWith in LLVMDemangle. Due to library layering (LLVMSupport depends on LLVMDemangle), we add the utility header under llvm/Demangle, instead of llvm/ADT or llvm/Support. Modify this in libcxxabi, then copy this over to llvm. Reviewed By: MaskRay, #libc_abi, phosek Differential Revision: https://reviews.llvm.org/D148556
* [libc++abi] Make the error message for recursive initialization of ↵Louis Dionne2023-04-191-3/+3
| | | | | | | | | | | function-local statics more explicit The new message is a bit verbose, but it makes it clearer that this isn't a problem in libc++abi, but instead a problem in the user's code. Otherwise, we get bugs sent down to libc++abi because people see this message in their crash logs. Differential Revision: https://reviews.llvm.org/D148630
* [libcxxabi] Fix for c9d36bd80760db14f14b33789e6cbc6cb8c64830Dmitry Chernenkov2023-03-201-0/+1
| | | | Otherwise fails with LIBCPP_REMOVE_TRANSITIVE_INCLUDES
* [libcxxabi][Demangle] Don't drop ctor/dtor name for abi-tagged structuresMichael Buch2023-03-191-0/+2
| | | | | | | | | | | | | | | | | | | | Before this patch we would demangle abi-tagged structures as follows: ``` $ c++filt -n _ZN1SB5OuterC2Ev S[abi:Outer]:() $ c++filt -n _ZN1SB5OuterD2Ev S[abi:Outer]::~() ``` This is because `Node::getBaseName` was unimplemented for the `AbiTagAttr` node, which meant that when we tried printing `CtorDtorName` where its `Basename` `Node` was an `AbiTagAttr`, we'd drop the name. Addresses https://github.com/llvm/llvm-project/issues/61213 Differential Revision: https://reviews.llvm.org/D145492
* [libc++abi] Improve performance of __dynamic_castSirui Mu2023-03-191-62/+124
| | | | | | | | | | The original `__dynamic_cast` implementation does not use the ABI-provided `src2dst_offset` parameter which helps improve performance on the hot paths. This patch improves the performance on the hot paths in `__dynamic_cast` by leveraging hints provided by the `src2dst_offset` parameter. This patch also includes a performance benchmark suite for the `__dynamic_cast` implementation. Reviewed By: philnik, ldionne, #libc, #libc_abi, avogelsgesang Spies: mikhail.ramalho, avogelsgesang, xingxue, libcxx-commits Differential Revision: https://reviews.llvm.org/D138005
* [runtimes] Synchronize warnings flags between libc++/libc++abi/libunwindNikolas Klauser2023-03-172-0/+14
| | | | | | | | | | This mostly keeps the same warning flags. The most important exceptions are `-Wpedantic` and `-Wconversion`, which are now removed from libc++abi and libunwind. Reviewed By: ldionne, #libunwind, #libc, #libc_abi Spies: mikhail.ramalho, phosek, libcxx-commits Differential Revision: https://reviews.llvm.org/D144252
* [libc++] Granularize <type_traits> includesNikolas Klauser2023-03-081-0/+1
| | | | | | | | Reviewed By: ldionne, #libc, #libc_abi Spies: #libc_vendors, smeenai, libcxx-commits Differential Revision: https://reviews.llvm.org/D145320
* [libc++] Enable -Wunused-templateNikolas Klauser2023-03-081-0/+11
| | | | | | | | | | Clang wants to enable this flag by default, but libc++ isn't working with it yet. Reviewed By: Mordante, #libc, #libc_abi, EricWF Spies: libcxx-commits, arichardson Differential Revision: https://reviews.llvm.org/D144667
* [libc++abi][AIX] Skip non-C++ EH aware frames when retrieving exception objectXing Xue2023-02-151-29/+56
| | | | | | | | | Summary: The personality routine for the legacy AIX xlclang++ compiler uses the stack slot reserved for compilers to pass the exception object to the landing pad. The landing pad retrieves the exception object with a call to the runtime function __xlc_exception_handle(). The current implementation incorrectly assumes that __xlc_exception_handle() should go up one stack frame to get to the stack frame of the caller of __xlc_exception_handle(), which is supposedly the stack frame of the function containing the landing pad. However, this does not always work, e.g., the xlclang++ compiler sometimes generates a wrapper of __xlc_exception_handle() and calls the wrapper from the landing pad for optimization purposes. This patch changes the implementation to unwind the stack from __xlc_exception_handle() and skip frames not associated with functions that are C++ EH-aware until a frame associated with a C++ EH-aware function is found and then retrieving the exception object with the expectation that the located frame is the one that the personality routine installed as it transferred control to the landing pad. Reviewed by: cebowleratibm, hubert.reinterpretcast, daltenty Differential Revision: https://reviews.llvm.org/D143010
* [libc++] Move the definition of aligned allocation helpers outside of <new>Louis Dionne2023-01-262-2/+3
| | | | | | | | | They are not needed in <new> -- in fact they are only needed in .cpp files. Getting those out of the way makes the headers smaller and also makes it easier to use the library on platforms where aligned allocation is not available. Differential Revision: https://reviews.llvm.org/D139231
* [libc++] Granularize <type_traits> includes in <utility>Nikolas Klauser2022-12-221-0/+1
| | | | | | | | Reviewed By: Mordante, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D140426
* [demangler][LoongArch] Correct the mangled_size for long doubleWeining Lu2022-12-081-1/+1
| | | | | | | | | | | The size of long double in LoongArch (both LA32 and LA64) is 16 bytes, thus the mangled_size should be 32. This is same as RISCV's change in D126480. Reviewed By: xen0n Differential Revision: https://reviews.llvm.org/D138981
* [libc++][NFC] Consistently use newline between license and include guardLouis Dionne2022-11-251-0/+1
|
* Revert "[libcxxabi] Always use thread_local for cxa_exception_storage"Louis Dionne2022-11-243-2/+78
| | | | | | This reverts commit 8271aa5335668a1dc62168a4e90b4554bd3a0ca7 since it broke some downstream builds. See https://reviews.llvm.org/D138461 for details.
* [libcxxabi] Always use thread_local for cxa_exception_storageShoaib Meenai2022-11-223-78/+2
| | | | | | | | | | | | | | | This was previously guarded by HAS_THREAD_LOCAL, which was never set by CMake and had to be specified manually. Android has been setting this to solve https://github.com/android/ndk/issues/1200 [1], but every compiler and platform libc++abi supports should have thread_local by now, so we can just get rid of the fallback implementation and simplify things significantly (including removing the now unused fallback calloc). [1] https://android-review.googlesource.com/c/toolchain/llvm-project/+/1285596 Reviewed By: #libc_abi, MaskRay, ldionne Differential Revision: https://reviews.llvm.org/D138461
* [libc++abi][AIX] Use reserved slot in stack to pass the address of exception ↵Xing Xue2022-10-271-1/+1
| | | | | | | | | | | | | | object Summary: The existing implementation of the personality for legacy IBM xlclang++ compiler generated code passes the address of exception object in r14 for the landing pad to retrieve with a call to __xlc_exception_handle(). This clobbers the content of r14 in user code (and potentially, when running cleanup actions, the address of another exception object being passed). This patch changes to use the stack slot reserved for compilers to pass the address. It has been confirmed that xlclang++-generated code does not use this slot. This is a follow-on of the origibal patch below with a change in comments. https://reviews.llvm.org/rGa499051f10a2d0150b60c14493558476039f701a Reviewed by: hubert.reinterpretcast, cebowleratibm Differential Revision: https://reviews.llvm.org/D136257
* [libc++abi][AIX] Use reserved slot in stack to pass the address of exception ↵Xing Xue2022-10-271-8/+42
| | | | | | | | | object Summary: The existing implementation of the personality for legacy IBM xlclang++ compiler generated code passes the address of exception object in r14 for the landing pad to retrieve with a call to __xlc_exception_handle(). This clobbers the content of r14 in user code (and potentially, when running cleanup actions, the address of another exception object being passed). This patch changes to use the stack slot reserved for compilers to pass the address. It has been confirmed that xlclang++-generated code does not use this slot. Reviewed by: hubert.reinterpretcast, cebowleratibm
* libcxxabi [PR58117][NFC]: Open code lower boundNathan Sidwell2022-10-201-5/+12
| | | | | | | | | | | This open codes the use of lower-bound when looking for an operator encoding. Using std::lower_bound can result in symbol references to the C++ library and that breaks the ABI demangler, which mandates no such dependency. Differential Revision: https://reviews.llvm.org/D135799 Fixes: https://github.com/llvm/llvm-project/issues/58117
* [demangler] Simplify OutputBuffer initializationNathan Sidwell2022-10-172-26/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Every non-testcase use of OutputBuffer contains code to allocate an initial buffer (using either 128 or 1024 as initial guesses). There's now no need to do that, given recent changes to the buffer extension heuristics -- it allocates a 1k(ish) buffer on first need. Just pass in a buffer (if any) to the constructor. Thus the OutputBuffer's ownership of the buffer starts at its own lifetime start. We can reduce the lifetime of this object in several cases. That new constructor takes a 'size_t *' for the size argument, as all uses with a non-null buffer are passing through a malloc'd buffer from their own caller in this manner. The buffer reset member function is never used, and is deleted. Some adjustment to a couple of uses is needed, due to the lazy buffer creation of this patch. a) the Microsoft demangler can demangle empty strings to nothing, which it then memoizes. We need to avoid the UB of passing nullptr to memcpy. b) a unit test checks insertion of no characters into an empty buffer. We need to avoid UB when converting that to std::string. The original buffer initialization code would return a failure code if that first malloc failed. Existing code either ignored that, called std::terminate with a FIXME, or returned an error code. But that's not foolproof anyway, as a subsequent buffer extension failure ends up calling std::terminate. I am working on addressing that unfortunate failure mode in a manner more consistent with the C++ ABI design. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D122604
* Revert "[runtimes] Always define cxx_shared, cxx_static & other targets"Haowei Wu2022-10-121-67/+68
| | | | | This reverts commit 79ee0342dbf025bc70f237bdfe9ccb4e10a592ce which breaks the LLVM TSan bots.
* [libcxxabi]: Resync llvm & libcxxabi's demanglerNathan Sidwell2022-10-121-0/+12
| | | | | | | | | | | | | Sadly the demangler copies have diverged. This resyncs them by a) pulling the meaningful llvm changes into libcxxabi's gold copy. b) rerunning the sync script. I notice uses of placement new, which assume the allocator succeeds -- that's incorrect in general, but an orthogonal problem. Reviewed By: bader Differential Revision: https://reviews.llvm.org/D135446
* [runtimes] Always define cxx_shared, cxx_static & other targetsLouis Dionne2022-10-121-68/+67
| | | | | | | | | | | | | | | However, mark them as EXCLUDE_FROM_ALL when we don't want to build them. Simply declaring the targets should be of no harm, and it allows other projects to mention these targets regardless of whether they end up being built or not. While the diff may not make that obvious, this patch basically moves the definition of e.g. `cxx_shared` out of the `if (LIBCXX_ENABLE_SHARED)` and instead marks it as `EXCLUDE_FROM_ALL` conditionally on whether LIBCXX_ENABLE_SHARED is passed. It then does the same for libunwind and libc++abi targets. Differential Revision: https://reviews.llvm.org/D134221
* [runtimes] Add the ability to customize the output name of libc++, libc++abi ↵Louis Dionne2022-10-111-2/+2
| | | | | | | | | | and libunwind We already had the ability to do that for libc++.dylib, so this only adds consistency for all the runtime libraries. This should allow working around difficulties on AIX as described in https://llvm.org/D134221. Differential Revision: https://reviews.llvm.org/D135669
* [SystemZ][z/OS] Add ASCII and 32-bit variants for libc++.Zibi Sarbinowski2022-10-031-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | This patch enables libc++ build as shared library in all combinations of ASCII/EBCDIC and 32-bit/64-bit variants. In particular it introduces: # ASCII version of libc++ named as libc++_a.so # Script to rename DLL name inside the generated side deck # Various names for dataset members where DLL libraries and their side decks will reside # Add the following options: - LIBCXX_SHARED_OUTPUT_NAME - LIBCXX_ADDITIONAL_COMPILE_FLAGS - LIBCXX_ADDITIONAL_LIBRARIES - LIBCXXABI_ADDITIONAL_COMPILE_FLAGS - LIBCXXABI_ADDITIONAL_LIBRARIES **Background and rational of this patch** The linker on z/OS creates a list of exported symbols in a file called side deck. The list contains the symbol name as well as the name of the DLL which implements the symbol. The name of the DLL depends on what is specified in the -o command line option. If it points to a USS file, than the DLL name in the side deck will be the USS file name. If it points to a member of a dataset then the DLL name in the side deck is the member name. If CMake could deal with z/OS datasets we could use -o that points to a dataset member name, but this does not seem to work so we have to produce a USS file as the DLL and then copy the content of the produced side deck to a dataset as well as rename the USS file name in the side deck to a dataset member name that corresponds to that DLL. Reviewed By: muiez, SeanP, ldionne, #libc, #libc_abi Differential Revision: https://reviews.llvm.org/D118503
* [libc++] Granularize the rest of memoryNikolas Klauser2022-09-052-1/+4
| | | | | | | | Reviewed By: ldionne, #libc Spies: vitalybuka, paulkirth, libcxx-commits, mgorny Differential Revision: https://reviews.llvm.org/D132790
* [libcxxabi] Fix alignment of pointers returned by fallback_mallocSimon Tatham2022-08-191-9/+61
| | | | | | | | | | | | | | | This aligns the ``heap[]`` array in ``fallback_malloc.cpp`` to ensure that it can be safely cast to ``heap_node*``, and also adjusts the allocation algorithm to ensure that every allocated block has the alignment requested by ``__attribute__((aligned))``, by putting the block's ``heap_node`` header 4 bytes before an aligned address. Patch originally by Eric Fiselier: this is an updated version of D12669, which was never landed. Reviewed By: ldionne, #libc_abi Differential Revision: https://reviews.llvm.org/D129842
* [libcxxabi][CMake] Set --unwindlib=none when using LLVM libunwindPetr Hosek2022-07-141-0/+7
| | | | | | | | We already link libunwind explicitly so avoid trying to link toolchain's default libunwind which may be missing. This matches what we already do for libcxx. Differential Revision: https://reviews.llvm.org/D129469
* [SystemZ][z/OS] Modify cxxabi to be compatible with existing z/OS runtimeMuiez Ahmed2022-06-282-2/+12
| | | | | | | | This patch is to enable exception handling on the z/OS platform that is compatible with the existing z/OS runtime. No functionality of libcxxabi has been changed for other platforms. With this patch the hope is we can add z/OS as a platform to perform testing on any C++ ABI changes. There is a primary difference for the z/OS implementation. On z/OS the thrown object is added to a linked list of caught and uncaught exceptions. The unwinder uses the top one as the current exception it is trying to find the landing pad for. We have to pop the top exception after we get it’s landing pad for our unwinder to correctly get any subsequent rethrows or nested exception calls. Differential Revision: https://reviews.llvm.org/D99913
* [libc++abi][AIX] Use _LIBCXXABI_FUNC_VIS for exported routinesXing Xue2022-06-211-10/+13
| | | | | | | | | Summary: This patch adds _LIBCXXABI_FUNC_VIS to the definitions of the personality and helper routines for the state table based EH, now that the support of the visibility attribute is being added to AIX Clang. Currently an export list is generated in the absence of the visibility attribute support downstream. Reviewed by: MaskRay, daltenty Differential Revision: https://reviews.llvm.org/D126915
* [libc++abi][AIX] add personality and helper functions for the state table EHXing Xue2022-05-312-0/+687
| | | | | | | | | | | | | | | | | | | Summary: This patch adds the personality and helper functions for the state table based EH used by IBM legacy compilers xlC and xlclang++ on AIX. * A high level description of the state table based EH is provided in the code comments. * Function scan_state_tab() is added to scan the state table. It is invoked by the state table personality routine __xlcxx_personality_v0() and returns scan_results like scan_eh_tab() does. * A couple of EH helper functions used by xlC and xlclang++ generated code are also added, e.g., __xlc_catch_matchv2() which checks whether the thrown object matches the catch handler's exception type. * Debugging macros _LIBCXXABI_TRACE_STATETAB, _LIBCXXABI_TRACE_STATETAB0, and _LIBCXXABI_TRACING_STATETAB are added to dump state table scanning traces if environment variable LIBCXXABI_PRINT_STATTAB is set. * The state variable and state table data is the LSDA found from the traceback table of the function during unwinding. Reviewed by: MaskRay, cebowleratibm, libc++abi Differential Revision: https://reviews.llvm.org/D100504
* [demangler][RISCV] Fix for long doublePiggy NL2022-05-271-1/+1
| | | | | | | | | | | | | | | | Summary: The size of long double in RISCV (both RV32 and RV64) is 16 bytes, thus the mangled_size shouble be 32. This patch will fix test case "_ZN5test01hIfEEvRAcvjplstT_Le4001a000000000000000E_c" in test_demangle.pass.cpp, which is expected to be invalid but demangler returned "void test0::h<float>(char (&) [(unsigned int)((sizeof (float)) + (0x0.000000004001ap-16382L))])" in RISCV environment without this patch. Reviewed By: urnathan Differential Revision: https://reviews.llvm.org/D126480
* [runtimes] Fix the build of merged ABI/unwinder librariesLouis Dionne2022-05-191-0/+2
| | | | | | | | Also, add a CI job that tests this configuration. The exact configuration is that we build a shared libc++ and merge objects for the ABI library and the unwinder library into it. Differential Revision: https://reviews.llvm.org/D125903
* [runtimes] Default LIB*_HERMETIC_STATIC_LIBRARY to ON on WindowsMartin Storsjö2022-05-181-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (In the case of libunwind, the cmake option is called LIBUNWIND_HIDE_SYMBOLS, but it has the same effect as LIBCXX_HERMETIC_STATIC_LIBRARY and LIBCXXABI_HERMETIC_STATIC_LIBRARY.) Previously, the same issue was dealt with by setting a project wide define (_LIBUNWIND_HIDE_SYMBOLS, _LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS and _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) if only building a static library. If building both static and shared at the same time, this wasn't set, and the static library would contain dllexport directives. The LIB*_HERMETIC_STATIC_LIBRARY and LIBUNWIND_HIDE_SYMBOLS cmake options only apply the defines to the static library in the build, even if building both static and shared at the same time. (This could only be done use after the object libraries were enabled, as a shared libcxx needs libcxxabi object files built with dllexports included.) This allows removing inelegant code for deciding how to build the libcxxabi static library and a TODO comment that suggested that users should need to start setting an option, which they shouldn't need to. Finally, this gets rid of two XFAILs in tests. Differential Revision: https://reviews.llvm.org/D125715
* [runtimes] Introduce object librariesLouis Dionne2022-05-161-81/+70
| | | | | | | | | This is a variant of D116689 rebased on top of the new (proposed) ABI refactoring in D120727. It should conserve the basic properties of the original patch by @phosek, except it also allows cleaning up the merging of libc++abi into libc++ from the libc++ side. Differential Revision: https://reviews.llvm.org/D125393
* [libc++abi][NFCI] Refactor demangling_terminate_handler to reduce nestingLouis Dionne2022-05-131-40/+41
| | | | | | | This keeps the same logic, but uses early return to avoid multiple layers of nested ifs and make the code simpler to follow. Differential Revision: https://reviews.llvm.org/D125476
* [demangler] Avoid special-subst code duplicationNathan Sidwell2022-05-131-73/+37
| | | | | | | | | | | | | | | | | | | | We need to expand special substitutions in four different ways. This refactors to only have one conversion from enum to string, and derive the other 3 needs off that. The SpecialSubstitution node is derived from the ExpandedSpecialSubstitution. While this may seem unintuitive, it works out quite well, as SpecialSubstitution can then use the former's getBaseName and remove an unneeded 'basic_' prefix, for those substitutions that are instantiations (to known typedef). Similarly all those instantiations use the same set of template arguments (with 'basic_string', getting an additional 'allocator' arg). Expansion tests were added in D123134, and remain unchanged. Reviewed By: MaskRay, dblaikie Differential Revision: https://reviews.llvm.org/D125257
* [libc++abi][NFC] Add comment on long reaching #ifLouis Dionne2022-05-121-2/+2
|
* [libc++abi] Refactor exception type demangling into a separate functionLouis Dionne2022-05-121-13/+16
| | | | | | | As a fly-by fix, also let `__cxa_demangle` allocate its buffer alone, since we are not allowed to pass a non-malloc'd buffer to it. Differential Revision: https://reviews.llvm.org/D125268
* [libc++abi][NFC] Fix typo in commentLouis Dionne2022-05-101-3/+3
|
* [libc++abi] Reword uncaught exception termination messageLouis Dionne2022-05-101-5/+5
| | | | | | | | | | When we terminate due to an exception being uncaught, libc++abi prints a message saying "terminating with uncaught exception [...]". This patch changes that to say "terminating due to uncaught exception [...]" instead, which is a bit clearer. Indeed, I've seen some people being confused and thinking that libc++abi was the component throwing the exception. Differential Revision: https://reviews.llvm.org/D125245
* [demangler] No need to space adjacent template closingsNathan Sidwell2022-05-091-8/+4
| | | | | | | | | | | With the demangler parenthesizing 'a >> b' inside template parameters, because C++11 parsing of >> there, we don't really need to add spaces between adjacent template arg closing '>' chars. In 2022, that just looks odd. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D123134
* [demangler] Buffer peeking needs bufferNathan Sidwell2022-05-091-1/+2
| | | | | | | | | | | | The output buffer has a 'back' member, which returns NUL when you try it with an empty buffer. But there are no use cases that need that additional functionality. This makes the 'back' member behave more like STL containers' back members. (It still returns a value, not a reference.) Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D123201
* [libcxxabi] Use the right calling convention for exception destructors on ↵Martin Storsjö2022-05-052-3/+3
| | | | | | | | | | | | | | | | i386 Windows On Windows on i386, C++ member functions use a different calling convention (`__thiscall`) than the default one for regular functions (`__cdecl`). (On Windows on architectures other than i386, both calling convention attributes are no-ops.) This matches how libstdc++ declares these types. This fixes the std/thread/futures/futures.{shared,unique}_future/dtor.pass.cpp tests on i386 mingw. Differential Revision: https://reviews.llvm.org/D124990
* [demangler] Fold expressions of .* and ->*Nathan Sidwell2022-05-031-1/+5
| | | | | | | | | | (Exitingly) a fold expression's operators include .* and ->*, but we failed to demangle them as we categorize those as MemberExprs, not BinaryExprs. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D123305
* [demangler] Fix demangling a template argument which happens to be a null ↵gbreynoo2022-04-281-1/+1
| | | | | | | | | | | pointer As seen in https://github.com/llvm/llvm-project/issues/51854 llvm-cxxfilt was having trouble demangling the case "_Z1fIDnLDn0EEvv". We handled the "LDNE" case and "LPi0E" but not "LDn0E". This change adds that handling. Differential Revision: https://reviews.llvm.org/D124010
* Revert "[demangler] Simplify OutputBuffer initialization"Kirill Stoimenov2022-04-262-4/+26
| | | | | | | Reverting due to a bot failure: https://lab.llvm.org/buildbot/#/builders/5/builds/22738 This reverts commit 5b3ca24a35e91bf9c19af856e7f92c69b17f989e.
* [demangler] Simplify OutputBuffer initializationNathan Sidwell2022-04-262-26/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Every non-testcase use of OutputBuffer contains code to allocate an initial buffer (using either 128 or 1024 as initial guesses). There's now no need to do that, given recent changes to the buffer extension heuristics -- it allocates a 1k(ish) buffer on first need. Just pass in a buffer (if any) to the constructor. Thus the OutputBuffer's ownership of the buffer starts at its own lifetime start. We can reduce the lifetime of this object in several cases. That new constructor takes a 'size_t *' for the size argument, as all uses with a non-null buffer are passing through a malloc'd buffer from their own caller in this manner. The buffer reset member function is never used, and is deleted. The original buffer initialization code would return a failure code if that first malloc failed. Existing code either ignored that, called std::terminate with a FIXME, or returned an error code. But that's not foolproof anyway, as a subsequent buffer extension failure ends up calling std::terminate. I am working on addressing that unfortunate failure mode in a manner more consistent with the C++ ABI design. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D122604
* [demangler][NFC] OperatorInfo table unit testNathan Sidwell2022-04-251-100/+88
| | | | | | | | | | | | Placing a run-once test inside the operator lookup function caused problems with the thread sanitizer. See D122975. Break out the operator table into a member variable, and move the test to the unit test machinery. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D123390