Commit Graph

266 Commits

Author SHA1 Message Date
Eric Fiselier
27fd2f60ee Work around GCC test failure.
llvm-svn: 359065
2019-04-24 02:21:13 +00:00
Eric Fiselier
70ebeabfb8 Rewrite cxa guard implementation.
This patch does three main things:
  (1) It re-writes the cxa guard implementation to make it testable.
  (2) Adds support for recursive init detection on non-apple platforms.
  (3) It adds a futex based implementation.

The futex based implementation locks and notifies on a per-object basis, unlike the
current implementation which uses a global lock for all objects. Once this patch settles
I'll turn it on by default when supported.

llvm-svn: 359060
2019-04-24 01:47:30 +00:00
Louis Dionne
c86011f5bc [libc++abi] Don't use a .sh.cpp test for uncaught_exception
Otherwise, we don't seem to get the DYLD_LIBRARY_PATH set up correctly
and the tests are run against the system libc++abi dylib.

llvm-svn: 358937
2019-04-23 00:03:34 +00:00
Louis Dionne
549048f390 [libc++] Make sure we re-export some missing libc++abi symbols from libc++
Summary:
Ensure we re-export __cxa_throw_bad_array_new_length and
__cxa_uncaught_exceptions from libc++, since they are now
provided by libc++abi.

Doing this allows us to stop linking explicitly against libc++abi in
the libc++abi tests, since libc++ re-exports all the necessary symbols.
However, there is one caveat to that. We don't want libc++ to re-export
__cxa_uncaught_exception (the singular form), since it's only provided
for backwards compatibility. Hence, for the single test where we check
this backwards compatibility, we explicitly link against libc++abi.

PR27405
PR22654

Reviewers: EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D60424

llvm-svn: 358690
2019-04-18 17:18:15 +00:00
Louis Dionne
2b0da3d63e [NFC] Correct outdated links to the Itanium C++ ABI documentation
Those are now hosted on GitHub.

rdar://problem/36557462

llvm-svn: 358191
2019-04-11 16:37:07 +00:00
Eric Fiselier
c4225e124f Fix PR41395 - __cxa_vec_new may overflow in allocation size calculation.
llvm-svn: 357814
2019-04-05 20:38:43 +00:00
Nico Weber
c2b8725493 llvm-cxxfilt: Demangle gcc "old-style unified" ctors and dtors
These are variant 4, cf
https://github.com/gcc-mirror/gcc/blob/master/gcc/cp/mangle.c#L1851
https://github.com/gcc-mirror/gcc/blob/master/gcc/cp/mangle.c#L1880
and gcc seems to sometimes emit them still.

Differential Revision: https://reviews.llvm.org/D60229

llvm-svn: 357645
2019-04-03 23:14:33 +00:00
Petr Hosek
97bc08ae02 [CMake] Support compiler-rt builtins library in tests
We're building tests with -nostdlib which means that we need to
explicitly include the builtins library. When using libgcc (default)
we can simply include -lgcc_s on the link line, but when using
compiler-rt builtins we need a complete path to the builtins library.

This path is already available in CMake as <PROJECT>_BUILTINS_LIBRARY,
so we just need to pass that path to lit and if config.compiler_rt is
true, link it to the test.

Prior to this patch, running tests when compiler-rt is being used as
the builtins library was broken as all tests would fail to link, but
with this change running tests when compiler-rt bultins library is
being used should be supported.

Differential Revision: https://reviews.llvm.org/D56701

llvm-svn: 353208
2019-02-05 19:50:47 +00:00
Petr Hosek
3ad50fed48 [CMake] Update lit test configuration
There are several changes:
- Don't stringify Pythonized bools (that's why we're Pythonizing them)
- Support specifying target and sysroot via CMake variables
- Use consistent spelling for --target, --sysroot, --gcc-toolchain

llvm-svn: 353137
2019-02-05 04:44:03 +00:00
Petr Hosek
6fd4e7fe02 [CMake] Support CMake variables for setting target, sysroot and toolchain
CMake has a standard way of setting target triple, sysroot and external
toolchain through CMAKE_<LANG>_COMPILER_TARGET, CMAKE_SYSROOT and
CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN. These are turned into
corresponding --target=, --sysroot= and --gcc-toolchain= variables add
included appended to CMAKE_<LANG>_FLAGS.

libunwind, libc++abi, libc++ provides their own mechanism through
<PROJECT>_TARGET_TRIPLE, <PROJECT>_SYSROOT and <PROJECT>_GCC_TOOLCHAIN
variables. These are also passed to lit via lit.site.cfg, and lit config
uses these to set the corresponding compiler flags when building tessts.

This means that there are two different ways of setting target, sysroot
and toolchain, but only one is properly supported in lit. This change
extends CMake build for libunwind, libc++abi and libc++ to also support
the CMake variables in addition to project specific ones in lit.

Differential Revision: https://reviews.llvm.org/D57670

llvm-svn: 353084
2019-02-04 20:02:26 +00:00
Chandler Carruth
57b08b0944 Update more file headers across all of the LLVM projects in the monorepo
to reflect the new license. These used slightly different spellings that
defeated my regular expressions.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351648
2019-01-19 10:56:40 +00:00
Chandler Carruth
2946cd7010 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
2019-01-19 08:50:56 +00:00
Chandler Carruth
d6317d22a9 Remove unnecesasry comment markers.
llvm-svn: 351635
2019-01-19 07:02:23 +00:00
Erik Pilkington
b2d6c298af [demangler] Support for block literals.
llvm-svn: 351482
2019-01-17 21:37:51 +00:00
Erik Pilkington
75a4d7644e [demangler] Ignore leading underscores if present
On MacOS, symbols start with a leading underscore, so just parse and
ignore it if present.

llvm-svn: 351481
2019-01-17 21:37:36 +00:00
Louis Dionne
336db68378 [libcxxabi] Allow building with sanitizers enabled
Summary:
I copied the sanitizer-related logic in libcxx/lib/CMakeLists.txt. In
the future, it would be great to avoid duplicating this logic in the
compiler, libc++ and libc++abi.

Reviewers: EricWF

Subscribers: mgorny, christof, dexonsmith, libcxx-commits, davide

Differential Revision: https://reviews.llvm.org/D53028

llvm-svn: 344191
2018-10-10 22:00:58 +00:00
Yvan Roux
d8f100a6f5 [libcxxabi] Fix test_exception_address_alignment test for ARM
Check _LIBCXXABI_ARM_EHABI macro instead of libunwind version.

Fixes PR34182

Differential revision: https://reviews.llvm.org/D50170

llvm-svn: 339865
2018-08-16 11:38:09 +00:00
Erik Pilkington
90dc82e955 [itanium demangler] Support dot suffixes on block invocation functions
rdar://32378759

llvm-svn: 338747
2018-08-02 17:45:01 +00:00
Erik Pilkington
3a6fed4a7b [demangler] Support for reference collapsing
llvm.org/PR38323

llvm-svn: 338138
2018-07-27 17:27:40 +00:00
Eric Fiselier
a596ea5842 Fix dangling reference in test
llvm-svn: 337906
2018-07-25 11:19:13 +00:00
Eric Fiselier
6fa95b8787 Add GCC 9 to XFAILs list for test
llvm-svn: 337662
2018-07-22 21:58:46 +00:00
Vitaly Buka
e26d5f4b12 Fix libcxxabi tests after clang r334924
llvm-svn: 334926
2018-06-18 06:43:55 +00:00
Vitaly Buka
db666a44e7 Fix libcxx tests after clang r334677.
llvm-svn: 334924
2018-06-18 06:24:29 +00:00
Eric Fiselier
29e0265732 private_typeinfo: limit is_dst_type_derived_from_static_type optimization
Patch by Ryan Prichard

If the destination type does not derive from the static type, we can skip
the search_above_dst call, but we still need to run the
!does_dst_type_point_to_our_static_type block of code. That block of code
will increment info->number_to_dst_ptr to 2, and because dest isn't derived
from static, the cast will ultimately fail.

Fixes PR33439

Reviewed as https://reviews.llvm.org/D36447

llvm-svn: 332767
2018-05-18 20:51:38 +00:00
Eric Fiselier
4938d48f09 private_typeinfo: propagate static flags in vmi search_above_dst method
This adds the test which was mistakenly not committed in r332763.

Patch by Ryan Prichard

Propagate the found_our_static_ptr and found_any_static_type flags from
__vmi_class_type_info::search_above_dst to its caller.

Fixes PR33425 and PR33487

Reviewed as https://reviews.llvm.org/D36446

llvm-svn: 332764
2018-05-18 20:42:53 +00:00
Nico Weber
377d68fd2c Fix test failure for missing _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
This is a follow-up change to r331150. The CL moved the macro from individual
file to build file, but the macro is missed in a test config file.

https://reviews.llvm.org/D46385
Patch from Taiju Tsuiki <tzik@chromium.org>!

llvm-svn: 331450
2018-05-03 12:44:27 +00:00
Nico Weber
297ec32b86 Move _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS macro to build system
_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS is currently used to
bring back std::unexpected, which is removed in C++17, but still needed
for libc++abi for backward compatibility.

This macro used to define in cxa_exception.cpp only, but actually
needed for all sources that touches exceptions.
So, a build-system-level macro is better fit to define this macro.

https://reviews.llvm.org/D46056
Patch from Taiju Tsuiku <tzik@chromium.org>!

llvm-svn: 331150
2018-04-29 23:05:11 +00:00
Erik Pilkington
d43931dcb8 [demangler] Support for fold expressions.
llvm-svn: 329601
2018-04-09 18:33:01 +00:00
Erik Pilkington
452e2ef996 [demangler] Support for <data-member-prefix>.
llvm-svn: 329600
2018-04-09 18:32:25 +00:00
Erik Pilkington
650130ac04 [demangler] Support for partially substituted sizeof....
llvm-svn: 329599
2018-04-09 18:31:50 +00:00
Erik Pilkington
8a1cb33ba5 [demangler] Use a back-patching scheme to resolve forward references.
Strictly in a conversion operator's type, a <template-param> refers to a
<template-arg> that is further ahead in the mangled name. Instead of
doing a second parse to resolve these, introduce a
ForwardTemplateReference Node and back-patch the referenced
<template-arg> when we're in the right context.

This is also a correctness fix, previously we would only do a second
parse if the <template-param> was out of bounds in the current set of
<template-args>. This lead to misdemangles (gasp!) when the conversion
operator was a member of a templated struct, for instance.

llvm-svn: 328464
2018-03-25 22:50:33 +00:00
Erik Pilkington
8c7013d4ca [demangler] Tweak how parameter pack sizes are determined.
Rather than eagerly propagating up parameter pack sizes in Node ctors,
find the parameter pack size during printing. This is being done to
support back-patching forward referencing <template-param>s.

llvm-svn: 328463
2018-03-25 22:49:57 +00:00
Erik Pilkington
c728786b1d [demangler] Support for clang's enable_if attribute.
Fixes PR33569.

llvm-svn: 328462
2018-03-25 22:49:16 +00:00
Erik Pilkington
e9c2a3c565 [demangler] Support for <template-param>s in generic lambdas.
These <template-param>s refer to "artifical" <template-arg>s that don't appear
in the mangled name, so we just print them as "auto".

llvm-svn: 327690
2018-03-16 03:06:30 +00:00
Erik Pilkington
4fb6f8189f [demangler] Simplify printing of structured bindings.
Thanks to Richard Smith for the post-commit review!

llvm-svn: 327228
2018-03-10 22:33:49 +00:00
Erik Pilkington
fcc9a80241 [demangler] Support for sequence numbers on lifetime extended temporaries.
llvm-svn: 327227
2018-03-10 21:31:22 +00:00
Erik Pilkington
b1a7f3c741 [demangler] Support for structured bindings.
llvm-svn: 327226
2018-03-10 21:31:15 +00:00
Erik Pilkington
bec42c848d [demangler] Fix a mistake in r326797.
Thanks to Nico Weber for pointing this out!

llvm-svn: 326871
2018-03-07 04:29:33 +00:00
Erik Pilkington
98e7036587 [demangler] Modernize the rest of the demangler.
llvm-svn: 326797
2018-03-06 14:21:10 +00:00
Erik Pilkington
3402e876ef [demangler] Modernize parse_name.
llvm-svn: 326717
2018-03-05 16:35:06 +00:00
Erik Pilkington
0bae6d8c14 [demangler] Support for exception specifications on function types.
llvm-svn: 325093
2018-02-14 01:08:20 +00:00
Erik Pilkington
b39094e39e [demangler] Support for inheriting constructors.
Fixes PR33223.

llvm-svn: 325023
2018-02-13 17:09:07 +00:00
Erik Pilkington
8b15f1f272 [demangler] Support for initializer lists and designated initializers.
llvm-svn: 324970
2018-02-13 00:15:56 +00:00
Erik Pilkington
8d2aca0697 [demangler] Support for dependent elaborate type specifiers.
llvm-svn: 324969
2018-02-13 00:15:53 +00:00
Erik Pilkington
94bd832518 [demangler] All <qualifiers> on one type should share one entry in the substitution table.
Previously, both <extended-qualifier>s and <CV-qualifiers> got their own entries.

llvm-svn: 324968
2018-02-13 00:15:46 +00:00
Erik Pilkington
4f052d075c [demangler] Clean up the expression parser
This commit cleans up the expression parser, using a new style:
  - parse* functions now return Node pointers.
  - The mangled name is now held in Db and accessed with look() and consume()
  - LLVM coding style

This style is meant to avoid the 2 most common types of bugs in the
old demanger, namely misusing the Names stack (ie, calling back() on
empty) and going out of bounds on the mangled name. I also think it
makes the demangler a lot cleaner.

Differential revision: https://reviews.llvm.org/D41887

llvm-svn: 324111
2018-02-02 18:04:32 +00:00
Erik Pilkington
862987abe7 [demangler] Improve variadic template support
This commit changes how variadic templates are represented in the
demangler, in order to fix some longstanding bugs. Now instead of
expanding variadic templates during parsing, the expansion is done
during printing by reusing the unexpanded AST. This allows the
demangler to handle cases where multiple packs contribute to a single
production, and correctly handle "Dp" and "sp" productions, which
corrispond to pack expansions in type and expression contexts.

Differential revision: https://reviews.llvm.org/D41885

llvm-svn: 323906
2018-01-31 20:17:06 +00:00
Eric Fiselier
6ae8abf241 Fix standalone test-suite run.
This patch updates libc++abi's HandleOutOfTreeLLVM.cmake to match
libc++'s -- and more importantly, to fix a bug where llvm-lit wasn't
found/created when libc++abi was built out-of-tree. This prevented
the test suite from running.

llvm-svn: 322768
2018-01-17 22:07:09 +00:00
Petr Hosek
2ffea93c57 [libcxxabi] Pass LIBCXXABI_SYSROOT and LIBCXXABI_GCC_TOOLCHAIN to lit
These are expected to be set by the shared lit scripts used from libc++.

Differential Revision: https://reviews.llvm.org/D40818

llvm-svn: 320445
2017-12-12 01:20:37 +00:00
Erik Pilkington
24d6534038 [demangler] Support for abi_tag attribute
Differential revision: https://reviews.llvm.org/D40279

llvm-svn: 318874
2017-11-22 20:38:22 +00:00