Commit Graph

251 Commits

Author SHA1 Message Date
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
Erik Pilkington 1b7f8d5b04 [demangler] Document some features that the demangler doesn't yet support, NFC
llvm-svn: 318765
2017-11-21 15:04:08 +00:00
Erik Pilkington 7377525fce Mark test as unsupported c++98/03 to fix buildbots
llvm-svn: 310530
2017-08-09 21:51:56 +00:00
Erik Pilkington ab04a08c49 [demangler] Improve representation of substitutions/templates
Differential revision: https://reviews.llvm.org/D36427

llvm-svn: 310525
2017-08-09 21:30:57 +00:00
Erik Pilkington 39dc8800c1 [demangler] Fix another oss-fuzz bug
llvm-svn: 310226
2017-08-06 20:46:33 +00:00
Erik Pilkington 906d585686 [demangler] Fix another bug found by oss-fuzz in r309340
llvm-svn: 309650
2017-08-01 02:38:41 +00:00
Erik Pilkington 39bbe2f5de [demangler] Fix some bugs in r309340 found by oss-fuzz
llvm-svn: 309520
2017-07-30 20:09:55 +00:00
Erik Pilkington 94d2ac7160 [demangler] Use an AST to represent demangled names
The demangler now demangles by producing an AST, then traverses that
AST to produce a demangled name. This is done for performance reasons,
now the demangler doesn't manuiplate std::strings, which hurt
performance and caused string operations to be inlined into the
parser, leading to large code size and stack usage.

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

llvm-svn: 309340
2017-07-28 00:43:49 +00:00
Erik Pilkington 28a4d0b981 [demangler] Respect try_to_parse_template_args
Fixes an exponential parse found by oss-fuzz.

llvm-svn: 307941
2017-07-13 19:37:37 +00:00
Eric Fiselier ce02c1bc15 Fix incomplete type test on OS X; workaround weird DYLD_LIBRARY_PATH behavior
llvm-svn: 307230
2017-07-06 00:29:09 +00:00
Marshall Clow f74609b15f Add some catch(...) blocks to the tests so that if they fail, we get a good error message. No functional change.
llvm-svn: 305977
2017-06-22 00:49:03 +00:00
Erik Pilkington a34ea7583f [demangler] Fix a exponential string copying bug
The problem was that if base_name() was called from a context without
an actual base name, it could gulp up the entire string, which can
result in recursive duplications. The fix is to be more strict as to
what qualifies as a base name.

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

llvm-svn: 304113
2017-05-28 23:15:50 +00:00
Tamas Berghammer 8bc9b88a24 __cxa_demangle: Fix constructor cv qualifier handling
Summary:
Previously if we parsed a constructor then we set parsed_ctor_dtor_cv
to true and never reseted it. This causes issue when a template argument
references a constructor (e.g. type of lambda defined inside a
constructor) as we will have the parsed_ctor_dtor_cv flag set what will
cause issues when parsing later arguments.

Reviewers: EricWF, compnerd

Subscribers: cfe-commits

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

llvm-svn: 303737
2017-05-24 11:21:34 +00:00
Erik Pilkington 17dfebcc39 [demangler] Fix a crash in the demangler during parsing of a lamdba
The problem is that multiple types could have been parsed from parse_type(),
which the lamdba parameter parsing didn't handle.

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

llvm-svn: 303718
2017-05-24 05:44:19 +00:00
Akira Hatanaka 7d5d9dc18a [libcxxabi] Fix the test case committed in r303175.
Free the __cxa_exception object allocated with __cxa_allocate_exception.

This is an attempt to fix this asan bot:

http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-asan/builds/560

llvm-svn: 303194
2017-05-16 18:18:03 +00:00
Akira Hatanaka 0c1016a337 [libcxxabi] Align unwindHeader on a double-word boundary.
r276215 made a change to annotate _Unwind_Exception with attribute
"aligned" so that an exception object following field __cxa_exception
is sufficiently aligned. This fix hasn't been incorporated to unwind.h
on Darwin since it is an ABI breaking change.

Instead of annotating struct _Unwind_Exception with the attribute, this
commit annotates field unwindHeader of __cxa_exception. This ensures the
exception object is sufficiently aligned without breaking the ABI.

This recommits r302978 and r302981, which were reverted in r303016
because a libcxx test was failing on an AArch64 bot. I also modified the
libcxxabi test case to check the alignment of the pointer returned by
__cxa_allocate_exception rather than compiling the test with -O1 and
checking whether it segfaults.

rdar://problem/25364625

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

llvm-svn: 303175
2017-05-16 15:19:08 +00:00