Commit Graph

734 Commits

Author SHA1 Message Date
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
Eli Friedman 17a47b915a [libc++abi] Replace __sync_* functions with __libcpp_atomic_* functions.
This is basically part 2 of r313694.

It's a little unfortunate that I had to copy-paste atomic_support.h,
but I don't really see any alternative.

The refstring.h changes are the same as the libcxx changes in r313694.

llvm-svn: 330162
2018-04-16 22:00:14 +00:00
Erik Pilkington f2a9b0fdda [demangler] NFC: Some refactoring to support partial demangling.
I'm committing this to libcxxabi too so that the two demanglers remain as
simular as possible.

llvm-svn: 329950
2018-04-12 20:41:06 +00:00
Vlad Tsyrklevich b89e9b5e2f [CFI] Disable CFI checks for __cxa_decrement_exception_refcount
Summary:
exception_header->exceptionDestructor is a void(*)(void*) function
pointer; however, it can point to destructors like std::
exception::~exception that don't match that type signature.

Reviewers: pcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: kcc, christof, cfe-commits

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

llvm-svn: 329629
2018-04-09 22:11:28 +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
Petr Hosek 86a9ddcd1a [CMake] Support for monorepo layout
Support finding libcxx and libunwind sources in monorepo style layout.

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

llvm-svn: 329208
2018-04-04 17:40:59 +00:00
Erik Pilkington 615e753e09 [demangler] Fix a bug in r328464 found by oss-fuzz.
llvm-svn: 328507
2018-03-26 15:34:36 +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 4352d7221c [demangler] Modernize parse_unresolved_name.
llvm-svn: 326796
2018-03-06 14:21:08 +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 bb0e34558f [demangler] Simplify the AST for function types, NFC.
llvm-svn: 325092
2018-02-14 01:08:17 +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 aec1e58c99 [demangler] Rewrite parse_nested_name in the new style.
llvm-svn: 325022
2018-02-13 17:09:03 +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
Richard Smith 8e6107a0e4 Fix compilation in C++17 mode.
C++17 removes `std::unexpected_handler`, but libc++abi needs it to define
`__cxa_exception`. When building against libc++, this is easily rectified by
telling libc++ we're building the library. We already do this in the other
places where we need these symbols.

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

llvm-svn: 324542
2018-02-07 23:23:23 +00:00
Erik Pilkington 9cbd9bfaa5 [demangler] Refactor the type parser
Differential revision: https://reviews.llvm.org/D41889

llvm-svn: 324282
2018-02-05 22:41:20 +00:00
Erik Pilkington 0923542c61 [demangler] return early if conditional expr parsing failed
This should fix some bugs found by oss-fuzz.

llvm-svn: 324203
2018-02-05 02:34:41 +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
Don Hinton 4877063e19 [cmake] [libcxxabi] LLVM_FOUND isn't always set, so just test if
llvm_setup_rpath() is available instead.

llvm-svn: 323600
2018-01-27 19:18:04 +00:00
Don Hinton e3b3b8094d Reland:
[cmake] [libcxxabi] Call llvm_setup_rpath() when adding shared libraries.

Clang and llvm already use llvm_setup_rpath(), so this change will
help standarize rpath usage across all projects.

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

llvm-svn: 323495
2018-01-26 03:41:58 +00:00
Don Hinton bc595f5702 Revert [libcxxabi] r323455 - [cmake] [libcxxabi] Call llvm_setup_rpath() when adding shared libraries.
Shoaib Meenai pointed out this will break standalone builds can be built without llvm.

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

llvm-svn: 323458
2018-01-25 19:18:51 +00:00
Don Hinton 0106b4305f [cmake] [libcxxabi] Call llvm_setup_rpath() when adding shared libraries.
Clang and llvm already use llvm_setup_rpath(), so this change will
help standarize rpath usage across all projects.

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

llvm-svn: 323455
2018-01-25 18:43:18 +00:00
Peter Collingbourne a674a8fd1e [libc++abi] Fix unused function when building with LIBCXXABI_SILENT_TERMINATE
This fixes:
src/cxa_default_handlers.cpp:25:13: error: unused function 'demangling_terminate_handler' [-Werror,-Wunused-function]

Patch by Thomas Anderson!

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

llvm-svn: 323397
2018-01-25 01:38:43 +00:00
Don Hinton ae858bf65f [cmake] [libcxxabi] Fix find_path() problems when cross compiling
When CMAKE_SYSROOT or CMAKE_FIND_ROOT_PATH is set, cmake
recommends setting CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
globally which means find_path() always prepends CMAKE_SYSROOT or
CMAKE_FIND_ROOT_PATH to all paths used in the search.

However, these find_path() invocations are looking for paths in
the libcxx and libunwind projects on the host system, not the
target system, which can be done by passing
NO_CMAKE_FIND_ROOT_PATH.

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

llvm-svn: 323145
2018-01-22 19:41:05 +00:00
Don Hinton 964ea50ff8 [cmake] [libcxxabi] Don't print warning when tests are disabled.
Summary:
Don't print, possibly erroneous, warning if
LIBCXXABI_INCLUDE_TESTS is false.

This patch fixes a problem introduced in r291367.

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

llvm-svn: 322870
2018-01-18 18:29:36 +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
Hans Wennborg 4ebc5ab7a5 Update version to 7.0.0svn
llvm-svn: 321726
2018-01-03 15:42:34 +00:00
Jonathan Roelofs 01b938279c Try again, this time with the correct address
llvm-svn: 321569
2017-12-29 19:26:28 +00:00
Jonathan Roelofs 8e8378ba77 Update CREDITS.txt with personal email address
llvm-svn: 321564
2017-12-29 19:16:12 +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
Ben Hamilton 4bf869c87e [libcxxabi] Set up .arcconfig to point to new Diffusion CXXA repository
Summary:
We want to automatically copy the appropriate mailing list
for review requests to the libc++abi repository.

For context, see the proposal and discussion here:

http://lists.llvm.org/pipermail/cfe-dev/2017-November/056032.html

Similar to D40500, I set up a new Diffusion repository with callsign
"CXXA" for libc++abi:

https://reviews.llvm.org/source/libcxxabi/

This explicitly updates libcxxabi's .arcconfig to point to the new
CXX repository in Diffusion, which will let us use Herald rule H268.

Reviewers: phosek, beanz, EricWF, compnerd

Reviewed By: phosek

Subscribers: cfe-commits, klimek, sammccall, dlj, bkramer

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

llvm-svn: 319713
2017-12-04 23:14:03 +00:00
Shoaib Meenai acee992852 [libc++abi] Add install-cxxabi-stripped target
LLVM is gaining install-*-stripped targets to perform stripped installs,
and in order for this to be useful for install-distribution, all
potential distribution components should have stripped installation
targets. LLVM has a function to create these install targets, but since
we can't use LLVM CMake functions in libc++abi, let's do it manually.

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

llvm-svn: 319499
2017-11-30 23:25:51 +00:00
Akira Hatanaka 9ef1daa46e Insert padding before the __cxa_exception header to ensure the thrown
object is sufficiently aligned.

r303175 annotated field unwindHeader of __cxa_exception with attribute
'aligned' to ensure the thrown object following the __cxa_exception
header was sufficiently aligned. This caused changes in the field
offsets of __cxa_exception relative to the start of the thrown object,
which was an ABI breaking change for some clients.

Instead of annotating field unwindHeader, this commit inserts extra
space before the header. This ensures the thrown object following the
header is sufficiently aligned without changing the field offsets, thus
avoiding any ABI breakages.

rdar://problem/25364625
rdar://problem/35556163

llvm-svn: 319123
2017-11-28 00:36:29 +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