Commit Graph

792 Commits

Author SHA1 Message Date
Louis Dionne e823b6d7e6 [libcxx] Remove bad_array_length
Summary:
std::bad_array_length was added by n3467, but this never made it into C++.
This commit removes the definition of std::bad_array_length from the headers
AND from the shared library. See the comments in the ABI changelog for details
about the ABI implications of this change.

Reviewers: mclow.lists, dexonsmith, howard.hinnant, EricWF

Subscribers: christof, jkorous, libcxx-commits

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

llvm-svn: 347903
2018-11-29 19:44:57 +00:00
Pavel Labath 14f3e3aa36 [Demangle] remove itaniumFindTypesInMangledName
Summary:
This (very specialized) function was added to enable an LLDB use case.
Now that a more generic interface (overriding of parser functions -
D52992)  is available, and LLDB has been converted to use that (D54074),
the function is unused and can be removed.

Reviewers: erik.pilkington, sgraenitz, rsmith

Subscribers: mgorny, hiraditya, christof, libcxx-commits, llvm-commits

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

llvm-svn: 347670
2018-11-27 16:11:24 +00:00
Petr Hosek 2d2e23e89b [CMake] Passthrough CFLAGS when checking the compiler-rt path
This is needed when cross-compiling for a different target since
CFLAGS may contain additional flags like -resource-dir which
change the location in which compiler-rt builtins are found.

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

llvm-svn: 346820
2018-11-14 00:09:26 +00:00
Nico Weber 966c180ad2 Port LLVM r346606 to libcxxabi.
llvm-svn: 346607
2018-11-11 10:09:06 +00:00
Reid Kleckner 60cce5c782 Use C++11 fallthrough attribute syntax when available and add a break
Summary:
This silences the two -Wimplicit-fallthrough warnings clang finds in
ItaniumDemangle.h in libc++abi.

Clang does not have a GNU attribute spelling for this attribute, so this
is necessary.

I will commit the same change to the LLVM demangler soon.

Reviewers: EricWF, ldionne

Subscribers: christof, erik.pilkington, cfe-commits

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

llvm-svn: 345870
2018-11-01 18:24:03 +00:00
Petr Hosek f503f7fd42 [libc++abi] Provide __cxa_thread_atexit on Fuchsia
Fuchsia already supports this interface.

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

llvm-svn: 345534
2018-10-29 20:20:26 +00:00
Pavel Labath 49b29eabc6 cxa_demangle: make demangler's parsing functions overridable
Summary:
This uses CRTP (for performance reasons) to allow a user the override
demangler functions to implement custom parsing logic. The motivation
for this is LLDB, which needs to occasionaly modify the mangled names.
One such instance is already implemented via the TypeCallback member,
but this is very specific functionality which does not help with any
other use case. Currently we have a use case for modifying the
constructor flavours, which would require adding another callback. This
approach does not scale.

With CRTP, the user (LLDB) can override any function it needs without
any special support from the demangler library. After LLDB is ported to
use this instead of the TypeCallback mechanism, the callback can be
removed.

More context can be found in D50599.

Reviewers: erik.pilkington, rsmith

Subscribers: christof, ldionne, llvm-commits, libcxx-commits

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

llvm-svn: 344607
2018-10-16 14:29:14 +00:00
Erik Pilkington fbca8d5495 NFC: Fix a -Wsign-conversion warning
llvm-svn: 344564
2018-10-15 22:03:53 +00:00
Erik Pilkington ad10cd1198 Override libcxxabi's .clang-format in the demangle directory
This directory uses LLVM style.

llvm-svn: 344316
2018-10-11 23:30:56 +00:00
Eric Fiselier 426ec26028 Use C++03 friendly version of alignof
llvm-svn: 344215
2018-10-11 03:01:14 +00:00
Eric Fiselier 51fbb2e70a Update libc++abi's detection of aligned allocation after r344207.
llvm-svn: 344208
2018-10-11 00:18:54 +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
Marshall Clow 8a39827eb3 Blind attempt to fix linker errors when building libc++abit w/o exceptions.
llvm-svn: 344156
2018-10-10 17:12:54 +00:00
Marshall Clow 611a55a084 Make libc++abi work better with gcc's ARM unwind library. Reviewed as https://reviews.llvm.org/D42242
llvm-svn: 344152
2018-10-10 16:18:37 +00:00
Pavel Labath 6c656b73c5 Port llvm r342166 to libcxxabi demangler
Summary:
This was committed back in september (D51463), but it seems it never
made it into the libcxxabi copy.

The original commit message was:
  The hash computed for an ArrayType was different when first constructed
  versus when later profiled due to the constructor default argument, and
  we were not tracking constructor / destructor variant as part of the
  mangled name AST, leading to incorrect equivalences.

Reviewers: erik.pilkington, rsmith, EricWF

Subscribers: christof, ldionne, libcxx-commits

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

llvm-svn: 344121
2018-10-10 08:39:16 +00:00
Louis Dionne dd1bed11d8 [NFC][unwind] Improve error message when a type has more than one RTTIs
The "dynamic_cast error 2" error can apparently happen when the same
type (with RTTI) is defined in more than one translation unit, and
those translation units are linked together. This is technically an
ODR violation, but making the error message more obvious is still
helpful.

llvm-svn: 344052
2018-10-09 14:55:15 +00:00
Eric Fiselier 44911a9e3a Update docs to reference new libc++ mailing lists.
llvm-svn: 342817
2018-09-22 19:52:12 +00:00
Eric Fiselier 4b47cbccd4 Fix incorrectly aligned exceptions in 32 bit builds.
This patch fixes a bug where exceptions in 32 bit builds
would be incorrectly aligned because malloc only provides 8 byte aligned
memory where 16 byte alignment is needed.

This patch makes libc++abi correctly use posix_memalign when it's
available. This requires defining _LIBCPP_BUILDING_LIBRARY so that
libc++ only defines _LIBCPP_HAS_NO_ALIGNED_ALLOCATION when libc doesn't
support it and not when aligned new/delete are disable for other
reasons.

This bug somehow made it into the 7.0 release, making it a regression.
Therefore this patch should be included in the next dot release.

llvm-svn: 342815
2018-09-22 19:22:36 +00:00
Pirama Arumuga Nainar 546de61000 [libc++abi] is_strcmp parameter to is_equal is unused for WIN32
Summary: Mark it as unused to avoid -Wunused-parameter.

Reviewers: EricWF, srhines, mstorsjo

Subscribers: christof, ldionne, libcxx-commits, cfe-commits

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

llvm-svn: 342764
2018-09-21 20:01:22 +00:00
Sylvestre Ledru 1298143369 add a quick link to libc++
llvm-svn: 342627
2018-09-20 08:01:16 +00:00
Nico Weber da01b342b2 Merge Demangle change in r342330 to libcxxabi.
Differential Revision: https://reviews.llvm.org/D52104

llvm-svn: 342331
2018-09-15 18:25:49 +00:00
Richard Smith 2b1dc39d18 Port my recent changes from LLVM copy of the demangler:
r340663 - Allow Allocator::make to make a node of a different type than that
          requested.
r340664 - Add documentation comment to ForwardTemplateReference.
r340665 - Fix ExpandedSpecialSubstitution demangling for Sa and Sb.
r340670 - Allow demangler's node allocator to fail, and bail out of the entire
          demangling process when it does.

llvm-svn: 340671
2018-08-24 23:30:26 +00:00
Richard Smith 2077b62a62 Port LLVM r340203 (and r340205) to libcxxabi.
Move Itanium demangler implementation into a header file and add visitation support.

Summary:
This transforms the Itanium demangler into a generic reusable library that can
be used to build, traverse, and transform Itanium mangled name trees.

This is in preparation for adding a canonicalizing demangler, which
cannot live in the Demangle library for layering reasons. In order to
keep the diffs simpler, this patch moves more code to the new header
than is strictly necessary: in particular, all of the printLeft /
printRight implementations can be moved to the implementation file.
(And indeed we could make them non-virtual now if we wished, and remove
the vptr from Node.)

All nodes are now included in the Kind enumeration, rather than omitting
some of the Expr nodes, and the three different floating-point literal
node types now have distinct Kind values.

As a proof of concept for the visitation / matching mechanism, this
patch implements a Node dumping facility on top of it, replacing the
prior mechanism that produced the pretty-printed output rather than a
tree dump. Sample dump output:

FunctionEncoding(
  NameType("int"),
  NameWithTemplateArgs(
    NestedName(
      NameWithTemplateArgs(
        NameType("A"),
        TemplateArgs(
          {NameType("B")})),
      NameType("f")),
    TemplateArgs(
      {NameType("int")})),
  {},
  <null>,
  QualConst, FunctionRefQual::FrefQualLValue)

As a next step, it would make sense to move the LLVM high-level interface to
the demangler (the itaniumDemangler function and ItaniumPartialDemangler class)
into the Support library, and implement them in terms of the Demangle library.
This would allow the libc++abi demangler implementation to be an identical copy
of the llvm Demangle library, and would allow the LLVM implementation to reuse
LLVM components such as llvm::BumpPtrAllocator, but we'll need to decide how to
coordinate that with the MS ABI demangler, so I'm not doing that in this patch.

No functionality change intended other than the behavior of dump().

Reviewers: erik.pilkington, zturner, chandlerc, dlj

Subscribers: aheejin, llvm-commits

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

llvm-svn: 340207
2018-08-20 20:14:49 +00:00
Richard Smith dc64b9c8e4 Factor Node creation out of the demangler. No functionality change intended.
(This is a port of llvm r339944 to libcxxabi.)

llvm-svn: 339952
2018-08-16 22:04:36 +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 ac6a801cca [itanium demangler] Add llvm::itaniumFindTypesInMangledName()
This function calls a callback whenever a <type> is parsed.

This is necessary to implement FindAlternateFunctionManglings in LLDB, which
uses a similar hack in FastDemangle. Once that function has been updated to use
this version, FastDemangle can finally be removed.

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

llvm-svn: 339580
2018-08-13 16:37:47 +00:00
Martin Storsjo 9b60b9289c Add missing _LIBCXXABI_FUNC_VIS to __gxx_personality_seh0
This was missed in SVN r337754.

llvm-svn: 339503
2018-08-11 19:36:06 +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
Hans Wennborg f2eafcc816 Update version to 8.0.0svn
llvm-svn: 338564
2018-08-01 14:25:03 +00:00
Louis Dionne c8e84ff251 [libc++] Remove _LIBCPP_BUILDING_XXX macros, which are redundant since _LIBCPP_BUILDING_LIBRARY
Summary: As suggested by Marshall in https://reviews.llvm.org/D49914

Reviewers: mclow.lists, EricWF

Subscribers: christof, dexonsmith, cfe-commits

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

llvm-svn: 338475
2018-08-01 02:08:59 +00:00
Erik Pilkington 256db4b799 [demangler] Fix an oss-fuzz bug from r338138
Stack overflow on invalid. While collapsing references, we were skipping over a
cycle check in ForwardTemplateReference leading to a stack overflow. This commit
fixes the problem by duplicating the cycle check in ReferenceType.

llvm-svn: 338190
2018-07-28 04:06:30 +00:00
Erik Pilkington 3a6fed4a7b [demangler] Support for reference collapsing
llvm.org/PR38323

llvm-svn: 338138
2018-07-27 17:27:40 +00:00
Sam Clegg 77c99ee5d9 [CMake] Don't use LIBCXXABI_ENABLE_STATIC option before its declared
Summary:
rL337867 introduced two new cmake_dependent_option options:
- LIBCXXABI_INSTALL_STATIC_LIBRARY
- LIBCXXABI_INSTALL_SHARED_LIBRARY

They depend on LIBCXXABI_ENABLE_STATIC and LIBCXXABI_ENABLE_SHARED
and so therefore need to (it seems) come after the declaration of
these two options.

Subscribers: mgorny, aheejin, christof, ldionne, cfe-commits

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

llvm-svn: 337982
2018-07-25 23:13:00 +00:00
Petr Hosek cbb4313b1c [CMake] Use LIBCXXABI_LIBDIR_SUFFIX in libc++abi build
This was changed unintentionally in r335809.

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

llvm-svn: 337937
2018-07-25 16:51:00 +00:00
Eric Fiselier a596ea5842 Fix dangling reference in test
llvm-svn: 337906
2018-07-25 11:19:13 +00:00
Petr Hosek 4a1e14ea78 [CMake] Option to control whether shared/static library is installed
Currently it's only possible to control whether shared or static library
build of libc++, libc++abi and libunwind is enabled or disabled and
whether to install everything we've built or not. However, it'd be
useful to have more fine grained control, e.g. when static libraries are
merged together into libc++.a we don't need to install libc++abi.a and
libunwind.a. This change adds this option.

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

llvm-svn: 337867
2018-07-24 23:27:51 +00:00
Petr Hosek 058c04c3dd Reland "[CMake] Support statically linking dependencies only to shared or static library"
This is a reland of commit r337668.

llvm-svn: 337814
2018-07-24 07:06:17 +00:00
Erik Pilkington 28e08a0a61 [demangler] call terminate() if allocation failed
We really should set *status to memory_alloc_failure, but we need to refactor
the demangler a bit to properly propagate the failure up the stack. Until then,
its better to explicitly terminate then rely on a null dereference crash.

rdar://31240372

llvm-svn: 337759
2018-07-23 22:23:04 +00:00
Martin Storsjo 64142ba98b Implement a GCC compatible SEH unwinding personality, __gxx_personality_seh0
This allows handling SEH based exceptions, with unwind functions
provided by libgcc.

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

llvm-svn: 337754
2018-07-23 22:09:23 +00:00
Petr Hosek 781ee0bc5a Revert "[CMake] Support statically linking dependencies only to shared or static library"
This reverts commit r337668: broke the cxxabi build when using Make.

llvm-svn: 337670
2018-07-23 05:07:44 +00:00
Petr Hosek 7a0295cbc8 [CMake] Support statically linking dependencies only to shared or static library
Currently it's possible to select whether to statically link unwinder
or the C++ ABI library, but this option applies to both the shared
and static library. However, in some scenarios it may be desirable to
only statically link unwinder and C++ ABI library into static C++
library since for shared C++ library we can rely on dynamic linking
and linker scripts. This change enables selectively enabling or
disabling statically linking only to shared or static library.

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

llvm-svn: 337668
2018-07-23 04:19:55 +00:00
Eric Fiselier 6fa95b8787 Add GCC 9 to XFAILs list for test
llvm-svn: 337662
2018-07-22 21:58:46 +00:00
Zachary Turner 0e3fbf6b8b Merge changes to ItaniumDemangle over to libcxxabi.
ItaniumDemangle had a small NFC refactor to make some of its
code reusable by the newly added Microsoft demangler.  To keep
the libcxxabi demangler as close as possible to the master copy
this refactor is being merged over.

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

llvm-svn: 337582
2018-07-20 17:16:49 +00:00
Petr Hosek 6aae861e0e [CMake] Set per-runtime library directory suffix in runtimes build
Do not use LLVM_RUNTIMES_LIBDIR_SUFFIX variable which is an internal
variable used by the runtimes build from individual runtimes, instead
set per-runtime librarhy directory suffix variable which is necessary
for the sanitized runtimes build to install libraries into correct
location.

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

llvm-svn: 336713
2018-07-10 19:13:33 +00:00
Serge Pavlov 2f17e969e4 [demangler] Avoid alignment warning
The alignment specified by a constant for the field
`BumpPointerAllocator::InitialBuffer` exceeded the alignment
guaranteed by `malloc` and `new` on Windows. This change set
the alignment value to that of `long double`, which is defined
by the used platform.

It fixes https://bugs.llvm.org/show_bug.cgi?id=37944.

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

llvm-svn: 336312
2018-07-05 06:24:29 +00:00
Erik Pilkington 988a16af92 Revert r336159, r336157. Some bots failed on qualified std::max_align_t, and other on unqualified max_align_t.
I'll take another stab at this tomorrow. Any ideas for fixing this would be appreciated!

http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/23071/steps/build_Lld/logs/stdio
http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/11185/steps/build-stage1-compiler/logs/stdio

llvm-svn: 336162
2018-07-03 01:30:53 +00:00
Erik Pilkington 0409a8ade7 Some buildbots were choking on std::max_align_t, try using the global alias.
llvm-svn: 336159
2018-07-03 00:48:27 +00:00
Erik Pilkington d26ace3955 [demangler] Fix a MSVC alignment warning.
This should fix llvm.org/PR37944

llvm-svn: 336157
2018-07-03 00:23:18 +00:00
Shoaib Meenai 51d5cc9228 [libc++abi] Look for __config instead of vector
vector is a generic C++ header, whereas __config is libc++-specific, so
we can look for it instead to guarantee we're finding a libc++
installation. This was suggested by Eric in https://reviews.llvm.org/D48694.

This is less important now that we're limiting the header search to the
specified directories (which definitely shouldn't have any other C++
library's headers anyway), but it shouldn't hurt either. There's a
chance some other library could also be providing a __config header, so
there's still a trade-off there. It would be ideal if we could check for
the presence of both __config and vector in the same directory, but
there doesn't seem to be any easy way to do that in CMake.

llvm-svn: 336034
2018-06-30 01:25:47 +00:00
Shoaib Meenai 777ec37659 [libc++abi] Limit libc++ header search to specified paths
Right now, when libc++abi is locating libc++ headers, it specifies
several search locations, but it also doesn't prevent CMake from looking
for those headers in system directories. I don't know if this was
intentional or an oversight, but it has several issues:

* We're looking specifically for the vector header, which could just as
  easily be found in a libstdc++ (or other C++ library) installation.
* No system I know of places their C++ headers directly in system
  include directories (they're always under a C++ subdirectory), so the
  system search will never succeed.
* find_path searches system paths before the user-specified PATHS, so
  if some system does happen to have C++ headers in its system include
  directories, those headers will be preferred, which doesn't seem
  desirable.

It makes sense to me to limit this header search to the explicitly
specified paths (using NO_DEFAULT_PATH, as is done for the other
find_path call in this file), but I'm putting it up for review in case
there's some use case I'm not thinking of.

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

llvm-svn: 336032
2018-06-30 01:04:50 +00:00