Commit Graph

29 Commits

Author SHA1 Message Date
Louis Dionne 7c3492b00d [NFC][libc++] Consistently use spaces to indent
rdar://problem/19988944

llvm-svn: 338933
2018-08-03 22:36:53 +00:00
Louis Dionne dc7200b486 [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY
Summary:
We never actually mean to always inline a function -- all the uses of
the macro I could find are actually attempts to control the visibility
of symbols. This is better described by _LIBCPP_INLINE_VISIBILITY, which
is actually always defined the same.

This change is orthogonal to the decision of what we're actually going
to do with _LIBCPP_INLINE_VISIBILITY -- it just simplifies things by
having one canonical way of doing things.

Note that this commit had originally been applied in r336369 and then
reverted in r336382 because of unforeseen problems. Both of these problems
have now been fixed.

Reviewers: EricWF, mclow.lists

Subscribers: christof, dexonsmith, erikvanderpoel

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

llvm-svn: 336866
2018-07-11 23:14:33 +00:00
Louis Dionne 195a499d63 Revert "[libc++] Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY"
This reverts commit r336369. The commit had two problems:
1. __pbump was marked as _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY instead of
   _LIBCPP_INLINE_VISIBILITY, which lead to two symbols being added in the
   dylib and the check-cxx-abilist failing.

2. The LLDB tests started failing because they undefine
   `_LIBCPP_INLINE_VISIBILITY`. I need to figure out why they do that and
   fix the tests before we can go forward with this change.

llvm-svn: 336382
2018-07-05 18:41:50 +00:00
Louis Dionne 4a8f3f9948 [libc++] Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY
Summary:
We never actually mean to always inline a function -- all the uses of
the macro I could find are actually attempts to control the visibility
of symbols. This is better described by _LIBCPP_INLINE_VISIBILITY, which
is actually always defined the same.

This change is orthogonal to the decision of what we're actually going
to do with _LIBCPP_INLINE_VISIBILITY -- it just simplifies things by
having one canonical way of doing things.

Reviewers: EricWF

Subscribers: christof, llvm-commits, dexonsmith, erikvanderpoel, mclow.lists

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

llvm-svn: 336369
2018-07-05 16:49:38 +00:00
Peter Collingbourne 1634c15e3c libcxx: Use vcruntime declarations for typeinfo on Windows.
We need to use the vcruntime declarations on Windows to avoid an
ODR violation involving rtti.obj, which provides the definition of
the runtime function implementing dynamic_cast and depends on the
vcruntime implementations of bad_cast and bad_typeid.

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

llvm-svn: 323491
2018-01-26 01:22:17 +00:00
Shoaib Meenai c3f5cc8e78 [libc++] Remove unnecessary struct tag
It causes warnings about mismatched tags, and it's not needed.

llvm-svn: 313345
2017-09-15 06:19:31 +00:00
Saleem Abdulrasool e7b38cdc00 typeinfo: provide a partial implementation for Win32
The RTTI structure is different on Windows when building under MS ABI.
Update the definition to reflect this. The structure itself contains an
area for caching the undecorated name (which is 0-initialized). The
decorated name has a bitfield followed by the linkage name. When
std::type_info::name is invoked for the first time, the runtime should
undecorate the name, cache it, and return the undecorated name. This
requires access to an implementation of __unDName. For now, return
the raw name.

This uses the fnv-1a hash to hash the name of the RTTI. We could use an
alternate hash (murmur? city?), but, this was the quickest to throw
together.

llvm-svn: 313344
2017-09-15 05:42:39 +00:00
Mehdi Amini e9c66ad9fa Add markup for libc++ dylib availability
Libc++ is used as a system library on macOS and iOS (amongst others). In order
for users to be able to compile a binary that is intended to be deployed to an
older version of the platform, clang provides the
availability attribute <https://clang.llvm.org/docs/AttributeReference.html#availability>_
that can be placed on declarations to describe the lifecycle of a symbol in the
library.

See docs/DesignDocs/AvailabilityMarkup.rst for more information.

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

llvm-svn: 302172
2017-05-04 17:08:54 +00:00
Eric Fiselier d22c9dc422 Recommit "Split exception.cpp and new.cpp implementation into different files for different runtimes."
This recommits r294707 with additional fixes. The main difference is
libc++ now correctly builds without any ABI library.

exception.cpp is a bloody mess. It's full of confusing #ifdef branches for
each different ABI library we support, and it's getting unmaintainable.

This patch breaks down exception.cpp into multiple different header files,
roughly one per implementation. Additionally it moves the definitions of
exceptions in new.cpp into the correct implementation header.

This patch also removes an unmaintained libc++abi configuration.
This configuration may still be used by Apple internally but there
are no other possible users. If it turns out that Apple still uses
this configuration internally I will re-add it in a later commit.
See http://llvm.org/PR31904.

llvm-svn: 294730
2017-02-10 08:57:35 +00:00
Eric Fiselier 8dcdeaeb35 Revert "Split exception.cpp and new.cpp implementation into different files for different runtimes."
The compiler-rt CMake configuration needs some tweaking before this can land.

llvm-svn: 294727
2017-02-10 07:43:08 +00:00
Eric Fiselier def60acdf5 Split exception.cpp and new.cpp implementation into different files for different runtimes.
exception.cpp is a bloody mess. It's full of confusing #ifdef branches for
each different ABI library we support, and it's getting unmaintainable.

This patch breaks down exception.cpp into multiple different header files,
roughly one per implementation. Additionally it moves the definitions of
exceptions in new.cpp into the correct implementation header.

This patch also removes an unmaintained libc++abi configuration.
This configuration may still be used by Apple internally but there
are no other possible users. If it turns out that Apple still uses
this configuration internally I will re-add it in a later commit.
See http://llvm.org/PR31904.

llvm-svn: 294707
2017-02-10 04:25:33 +00:00
Eric Fiselier 6880885fae Fix type_info's constructor by making it explicit again.
In recent changes type_info's private constructor was
accidentally made implicit. This patch fixes that.

llvm-svn: 292294
2017-01-17 23:41:42 +00:00
Saleem Abdulrasool 9075622d58 typeinfo: style adjustments for adding MS ABI RTTI
This is motivated by adding a third RTTI scheme to libc++.  Split out
the two forms of the itanium RTTI representation.  This is based on
suggestions from Eric Fiselier.  NFC

llvm-svn: 291174
2017-01-05 21:22:22 +00:00
Eric Fiselier ae34c56ee7 Fix strict-aliasing violation in typeinfo::hash_code()
Summary:
The current implementation of `hash_code()` for uniqued RTTI strings violates strict aliasing by dereferencing a type-punned pointer. Specifically it generates a `const char**` pointer from the address of the `__name` member before casting it to `const size_t*` and dereferencing it to get the hash. This is really just a complex and incorrect way of writing `reinterpret_cast<size_t>(__name)`.

This patch changes the conversion sequence so that it no longer contains UB.


Reviewers: howard.hinnant, mclow.lists

Subscribers: rjmccall, cfe-commits

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

llvm-svn: 283408
2016-10-05 22:55:10 +00:00
Eric Fiselier b683ec20e4 Try 2 - Remove <cstdlib> include from `<exception>`
This patch removes the `<cstdlib>` include from exception where it is no longer
needed. Unlike my previous attempt this patch also adds <cstdlib> where needed
in other headers like <new> and <typeinfo>.

This won't fix the Firefox build issues discussed on IRC but it is more correct
for libc++.

llvm-svn: 280754
2016-09-06 21:25:27 +00:00
Eric Fiselier 350eb52819 Revert r280743 and r280745. Remove <cstdlib> include from `<exception>`
Apparently I missed a number of additional include which need to be added.
Reverting so I can recommit as a single patch with all of the required includes.

llvm-svn: 280752
2016-09-06 21:06:41 +00:00
Eric Fiselier b0b1746962 Add missing <cstdlib> include. Sorry about the bot breakage
llvm-svn: 280745
2016-09-06 20:10:13 +00:00
Eric Fiselier f6ac565031 Fix or suppress GCC warnings during build.
Summary:
Currently a number of GCC warnings are emitted when building libc++. This patch fixes or ignores all of them. The primary changes are:

* Work around strict aliasing issues in `typeinfo::hash_code()` by using __attribute__((may_alias)). However I think a non-aliasing `hash_code()` implementation is possible. Further investigation needed.
* Add `_LIBCPP_UNREACHABLE()` to switch in `strstream.cpp` to avoid -Wpotentially-uninitialized.
* Fix -Wunused-value warning in `__all` by adding a void cast.
* Ignore -Wattributes for now. There are a number of real attribute issues when using GCC but enabling the warning is too noisy.
* Ignore -Wliteral-suffix since it warns about the use of reserved identifiers. Note Only GCC 7.0 supports disabling this warning.
* Ignore -Wc++14-compat since it warns about the sized new/delete overloads.



Reviewers: EricWF

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

llvm-svn: 280007
2016-08-29 20:43:38 +00:00
Marshall Clow d437fa5c8c Add an _LIBCPP_NORETURN inline function named __throw_XXX for each exception type we define. They either construct and throw the exception, or abort() (if exceptions are disabled). Use these functions everywhere instead of assert()ing when exceptions are disabled. WARNING: This is a behavior change - but only with exceptions disabled. Reviewed as: https://reviews.llvm.org/D23855.
llvm-svn: 279744
2016-08-25 15:09:01 +00:00
Tim Northover caccac10b7 RTTI Uniqueness: remove __name_for_load function.
It's identical to name() these days. (At one point it avoided masking
of the RTTI uniqueness bit because ARM64 ignored it architecturally,
but no longer).

llvm-svn: 205518
2014-04-03 09:12:38 +00:00
Tim Northover 0090e657cb ARM64: compare RTTI names as strings
ARM64 generates RTTI with hidden visibility, which means that typeinfo
must be compared char-by-char since it's not guaranteed to be uniqued
across the whole program.

llvm-svn: 205139
2014-03-30 11:34:26 +00:00
Howard Hinnant 073458b1ab Windows support by Ruben Van Boxem.
llvm-svn: 142235
2011-10-17 20:05:10 +00:00
Howard Hinnant fafca58c58 Applied noexcept to everything in [language.support] (Chapter 18)
llvm-svn: 132129
2011-05-26 18:23:59 +00:00
Howard Hinnant 412dbebe1b license change
llvm-svn: 119395
2010-11-16 22:09:02 +00:00
Howard Hinnant 789847ddbb visibility-decoration sweep completed.
llvm-svn: 114685
2010-09-23 18:58:28 +00:00
Howard Hinnant b3371f6f49 Fixing whitespace problems
llvm-svn: 111750
2010-08-22 00:02:43 +00:00
Nick Kledzik 111e0cbe51 add headers and implementation for <new>, <exception>, and <typeinfo>
llvm-svn: 103795
2010-05-14 20:19:37 +00:00
Howard Hinnant 5b08a8a432 Wiped out some non-ascii characters that snuck into the copyright.
llvm-svn: 103516
2010-05-11 21:36:01 +00:00
Howard Hinnant 3e519524c1 libcxx initial import
llvm-svn: 103490
2010-05-11 19:42:16 +00:00