<string.h> and wcschr, wcspbrk, wcsrchr, wmemchr, and wcsstr from <wchar.h> to
provide a const-correct overload set even when the underlying C library does
not.
This change adds a new macro, _LIBCPP_PREFERRED_OVERLOAD, which (if defined)
specifies that a given overload is a better match than an otherwise equally
good function declaration without the overload. This is implemented in modern
versions of Clang via __attribute__((enable_if)), and not elsewhere.
We use this new macro to define overloads in the global namespace for these
functions that displace the overloads provided by the C library, unless we
believe the C library is already providing the correct signatures.
llvm-svn: 260337
This reverts commit r260235. It breaks LLVM's bootstrap when building
with a -gcc-toolchain and the system's gcc installation does not provide
the libatomic library and its headers. We should check whether
LIBCXX_GCC_TOOLCHAIN is set and adjust the flags accordingly.
llvm-svn: 260323
Summary:
This fixes the tests under std/atomics for 32-bit MIPS CPUs where the
8-byte atomic operations call into the libatomic library.
Reviewers: dsanders, mclow.lists, EricWF, jroelofs, joerg
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D16613
llvm-svn: 260235
Avoid the developer warnings from cmake when configuring libc++ as part of the
LLVM layout. Setup the custom macro paths earlier to re-use the detection logic
prior to setting the project properties.
llvm-svn: 260071
This patch is the first in a series of patches that's meant to better
support unordered_map. unordered_map has a special "value_type" that
differs from pair<const Key, Value>. In order to meet the EmplaceConstructible
and CopyInsertable requirements we need to teach __hash_table about this
special value_type.
This patch creates a "__hash_node_types" traits class that contains
all of the typedefs needed by the unordered containers and it's iterators.
These typedefs include ones for each node type and node pointer type,
as well as special typedefs for "unordered_map"'s value type.
As a result of this change all of the unordered containers now all support
incomplete types.
As a drive-by fix I changed the difference_type in __hash_table to always
be ptrdiff_t. There is a corresponding change to size_type but it cannot
take affect until an ABI break.
This patch will be followed up shortly with fixes for various unordered_map
fixes.
llvm-svn: 260012
Rather than crashing in match_results::format() when a reference to a
marked subexpression is out of range, format the subexpression as empty
(i.e., replace it with an empty string). Note that
match_results::operator[]() has a range-check and returns a null match
in this case, so this just re-uses that logic.
llvm-svn: 259682
Instead of excluding all known operating systems that are not derived from BSD,
I now include all operating systems that claim to be derived from BSD.
Hopefully, that will make it so that this check doesn't need to change for
every new operating system that comes along.
http://reviews.llvm.org/D16634
llvm-svn: 259193
Summary:
This is a workaround to a clang bug which causes libcxx tests to fail in the 3.8
release. The clang bug is currently being investigated. It seems that clang
does not stop after frontend errors when using -verify and -fno-integrated-as
(or when this is the default). This patch adds -fsyntax-only to prevent GAS
from being called, fixing the libcxx failures.
PR26277
Patch by Eric Fiselier
Reviewers: mclow.lists, hans, EricWF
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D16584
llvm-svn: 259046
Summary:
These are the tests that didn't fail in the release candidate because they were
covered by another 'REQUIRES' directive.
Reviewers: mclow.lists, hans, bcraig, EricWF
Subscribers: EricWF, dim, cfe-commits
Differential Revision: http://reviews.llvm.org/D16408
llvm-svn: 258920
Per discussion with Eric and Joerg, this commit removes -Wpadded to
silence the warning about the padding inserted at the tail of struct
_Rep_base.
rdar://problem/23932550
llvm-svn: 258900
Summary:
This patch is similar to the <list> fix but it has a few differences. This patch doesn't use a `__link_pointer` typedef because we don't need to change the linked list pointers because `forward_list` never stores a `__forward_begin_node` in the linked list itself.
The issue with `forward_list` is that the iterators store pointers to `__forward_list_node` and not `__forward_begin_node`. This is incorrect because `before_begin()` and `cbefore_begin()` return iterators that point to a `__forward_begin_node`. This means we incorrectly downcast the `__forward_begin_node` pointer to a `__node_pointer`. This downcast itself is sometimes UB but it cannot be safely removed until ABI v2. The more common cause of UB is when we deference the downcast pointer. (for example `__ptr_->__next_`). This can be fixed without an ABI break by upcasting `__ptr_` before accessing it.
The fix is as follows:
1. Introduce a `__iter_node_pointer` typedef that works similar to `__link_pointer` in the last patch. In ABI v2 it is always a typedef for `__begin_node_pointer`.
2. Change the `__before_begin()` method to return the correct pointer type (`__begin_node_pointer`),
Previously it incorrectly downcasted the `__forward_begin_node` to a `__node_pointer` so it could be used to constructor the iterator types.
3. Change `__forward_list_iterator` and `__forward_list_const_iterator` in the following way:
1. Change `__node_pointer __ptr_;` member to have the `__iter_node_pointer` type instead.
2. Add additional private constructors that accept `__begin_node_pointer` in addition to `__node_pointer` and then correctly cast them to the stored `__iter_node_pointer` type.
3. Add `__get_begin()` and `__get_node_unchecked()` accessor methods that correctly cast `__ptr_` to the expected pointer type. `__get_begin()` is always safe to use and should be
preferred. `__get_node_unchecked()` can only be used on a deferencible iterator.
4. Replace direct access to `__forward_list_iterator::__ptr_` with the safe accessor methods.
Reviewers: mclow.lists, EricWF
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D15836
llvm-svn: 258888
This reverts commit r258575. EricWF sent me an email (no link since it
was off-list) requesting to review this pre-commit instead of
post-commit.
llvm-svn: 258625
An upcoming commit will add an optimization to insert() that avoids
unnecessary mallocs when we can safely extract the key type. This
commit shares code between emplace() and insert():
- if emplace() is given a single argument, and
- value_type is constructible from that argument
so that we have a single code path for the two.
I also updated the debug version of emplace_hint() to defer to
emplace(), like the non-debug version does.
In both cases, there should be NFC here.
llvm-svn: 258575
Rename the version of __construct_node() that takes a hash as an
argument to __construct_node_hash(), and use perfect-forwarding when
Rvalue references are available. The primary motivation is to allow
other types through, since unordered_map's value_type is different from
__hash_table's value_type -- a follow-up will take advantage of this --
but the rename is general "goodness".
There should be no functionality change here (aside from enabling the
follow-up).
llvm-svn: 258511