Commit Graph

129 Commits

Author SHA1 Message Date
Thomas A
a574ade231 Downgrading libcxx to llvmorg-13.0.1
It turns out that llvmorg-14.0.6 might be too new for dyld (the vector base class no longer exist in that release).
2022-06-26 13:05:32 -07:00
Thomas A
e3bbeb7fdc Update libcxx source to llvmorg-14.0.6 2022-06-26 09:13:52 -07:00
Marshall Clow
56448456d8 Add a missing default parameter to regex::assign. This is LWG3296; reviewed as https://reviews.llvm.org/D67944
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372896 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-25 16:40:30 +00:00
Mikhail Maltsev
19c3167b15 [libc++] Keep __regex_word in sync with ctype_base
Summary:
The class ctype_base in the header <__locale> contains masks for
character classification functions, which are kept in sync with
platform's C library, hence it contains many special cases.
The value of the bit mask __regex_word in the header <regex> must not
clash with those bit masks.

Currently the default case (i.e. unknown platform/C library) is
handled incorrectly: the __regex_word clashes with ctype_base::punct.

To avoid replicating the whole list of platforms in <regex> this patch
defines __regex_word in <__locale>, so that it is always kept in sync
with other masks.

Reviewers: ldionne, mclow.lists, EricWF

Reviewed By: ldionne

Subscribers: krytarowski, christof, dexonsmith, pbarrio, simon_tatham, libcxx-commits

Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@363363 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-14 09:04:16 +00:00
Louis Dionne
c30e2d9f77 [NFC][libcxx] Remove trailing whitespace
It's incredibly annoying when trying to create diffs

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@361981 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-29 16:01:36 +00:00
Marshall Clow
feb0e9afd4 Fix an incorrect 'Throws' in the regex code. Add a test for the new behavior. Reviewed as https://reviews.llvm.org/D61828. Thanks to Mark for the catch and the fix.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@361887 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-28 22:42:32 +00:00
Marshall Clow
b940d76b0d Add '_LIBCPP_ASSERT(ready())' to several match_results method that have this precondtion. Fix several tests which did not honor this precondition. Thanks to Andrey Maksimov for pointing this out.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@359324 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-26 17:10:03 +00:00
Marshall Clow
cc07c8937b Fix PR#35967: '<regex> syntax_option_type is not a proper bitmask' Sadly, this is an ABI break, so it's only available if you define either '_LIBCPP_ABI_VERSION > 2' or '_LIBCPP_ABI_UNSTABLE' or '_LIBCPP_ABI_REGEX_CONSTANTS_NONZERO' and rebuild your dylib.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@357190 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-28 17:30:23 +00:00
Marshall Clow
f2f9af0032 Change a couple of '&' to addressof(). NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352007 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-24 02:02:50 +00:00
Chandler Carruth
7c3769df62 Update more file headers across all of the LLVM projects in the monorepo
to reflect the new license. These used slightly different spellings that
defeated my regular expressions.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351648 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 10:56:40 +00:00
Michal Gorny
dc700f1239 [regex] Use distinct __regex_word on NetBSD
NetBSD defines character classes up to 0x2000.  Use 0x8000 as a safe
__regex_word that hopefully will not collide with other values
in the foreseeable future.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349293 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-16 09:18:26 +00:00
Eric Fiselier
f7fac08d5b Fix even more Clang warnings.
This patch disables shift-sign-overflow warnings for now. It also
fixes most -Wfloat-equal warnings and -Wextra-semi warnings.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343438 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-01 01:59:37 +00:00
Marshall Clow
e3973fd962 Implement the infrastructure for feature-test macros. Very few actual feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342073 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-12 19:41:40 +00:00
Louis Dionne
cd04d45e3a [libc++] Fix handling of negated character classes in regex
Summary:
This commit fixes a regression introduced in r316095, where we don't match
inverted character classes when there's no negated characrers in the []'s.

rdar://problem/43060054

Reviewers: mclow.lists, timshen, EricWF

Subscribers: christof, dexonsmith, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@340609 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-24 14:10:28 +00:00
Louis Dionne
54238057d6 [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336866 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-11 23:14:33 +00:00
Louis Dionne
4e7ffcaae6 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336382 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 18:41:50 +00:00
Louis Dionne
79aa4f32d0 [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336369 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 16:49:38 +00:00
Marshall Clow
7b98dba18e Implement deduction guides for basic_regex
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@333050 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-23 01:57:02 +00:00
Mikhail Maltsev
e54a22f809 [libcxx] Correctly handle invalid regex character class names
Summary:
Currently when a regular expression contains an invalid character
class name std::regex constructors throw an std::regex_error with
std::regex_constants::error_brack code.

This patch changes the code to std::regex_constants::error_ctype and
adds a test.

Reviewers: EricWF, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323322 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-24 12:45:18 +00:00
Marshall Clow
79f3f9dbed More of P0600 - '[[nodiscard]] in the Library' mark empty() as nodiscard in match_results. <regex>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318375 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-16 04:48:34 +00:00
Alexander Richardson
e208d0895a Rename identifiers named __output
Summary:
In the CHERI clang compiler __output and __input are keywords and therefore
we can't compile libc++ with our compiler.

Reviewers: mclow.lists, EricWF, theraven

Reviewed By: EricWF

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318144 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-14 11:14:25 +00:00
Marshall Clow
24c7353aa9 Fix an unsigned integer overflow in regex that lead to a bad memory access. Found by OSS-Fuzz
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@316191 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-19 22:10:41 +00:00
Marshall Clow
278c0ba4a6 Fix UB - signed integer overflow in regex. Thanks to Tim Shen for the patch. Reviewed as https://reviews.llvm.org/D39066
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@316172 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-19 17:39:16 +00:00
Marshall Clow
69447430a3 Fix regex bug with ^\W. Thanks to Tim Shen for the patch. Reviewed as https://reviews.llvm.org/D37955
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@316095 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-18 16:49:22 +00:00
Marshall Clow
ee596eb469 Apply D28224: 'Throw exception after too many steps' Fixes PR#20291. Thanks to Tim Shen for the patch
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@313056 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-12 17:56:59 +00:00
Marshall Clow
e00d350bbd Fix a bug in regex_Iterator where it would report zero-length matches forever. Reported as http://llvm.org/PR33681. Thanks to Karen Arutyunov for the report.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@307171 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 16:37:19 +00:00
Eric Fiselier
018a3d51a4 [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows
Summary:
This patch improves how libc++ handles min/max macros within the headers. Previously libc++ would undef them and emit a warning.
This patch changes libc++ to use `#pragma push_macro`  to save the macro before undefining it, and `#pragma pop_macro` to restore the macros and the end of the header.

Reviewers: mclow.lists, bcraig, compnerd, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits, krytarowski

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@304357 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-31 22:07:49 +00:00
Eric Fiselier
d89c715f29 Cleanup _LIBCPP_HAS_NO_<c++11-features> macro usage in regex
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300627 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 23:42:15 +00:00
Eric Fiselier
0867373a5c Work around recent -Wshadow changes in Clang
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299407 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-04 01:05:59 +00:00
Eric Fiselier
c60e8fcdcd Replace identifiers called __out because Windows.h #defines it.
Windows is greedy and it defines the identifier `__out` as a macro.
This patch renames all conflicting libc++ identifiers in order
to correctly work on Windows.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291345 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-07 11:27:06 +00:00
Eric Fiselier
c3589a8305 [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VIS
The name _LIBCPP_TYPE_VIS_ONLY is no longer accurate because both
_LIBCPP_TYPE_VIS and _LIBCPP_TYPE_VIS_ONLY expand to
__attribute__((__type_visibility__)) with Clang. The only remaining difference
is that _LIBCPP_TYPE_VIS_ONLY can be applied to templates whereas
_LIBCPP_TYPE_VIS cannot (due to dllimport/dllexport not being allowed on
templates).

This patch renames _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VIS.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291035 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 23:56:00 +00:00
Marshall Clow
99447c8e03 Fix bug #31387 - not checking end iterator when parsing decimal escape. Thanks to Karen for the report.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290500 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-24 17:21:03 +00:00
Eric Fiselier
50f6579e74 fix sign comparison warnings
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290469 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-24 00:24:44 +00:00
Tim Shen
38c2a3767b [libcxx] Make regex_match backtrack when search fails
Summary:
Fixes PR19851.
alg.re.match/ecma.pass.cpp still XFAILS on linux, but after commenting out
locale-related tests, it passes. I don't have a freebsd machine to produce a
full pass.

Reviewers: mclow.lists

Subscribers: cfe-commits, emaste

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285352 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-27 21:40:34 +00:00
Tim Shen
741cb8b8e6 [libcxx] Support std::regex_constants::match_not_null
Summary: Fixes PR21597.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284881 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 20:41:47 +00:00
Marshall Clow
14c09a2413 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@279744 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-25 15:09:01 +00:00
Hubert Tong
7f6e8e2141 [libcxx] Add "flag" default arg: basic_regex ptr_size_flag ctor
Summary:
The synopsis in C++11 subclause 28.8 [re.regex] has:
```
basic_regex(const charT* p, size_t len,
            flag_type f = regex_constants::ECMAScript);
```

The default argument is added to libc++ by this change.

Reviewers: mclow.lists, rsmith, hubert.reinterpretcast

Subscribers: cfe-commits

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

Reapplies r277966.
Patch by Jason Liu!


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@277968 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 22:26:04 +00:00
Hubert Tong
5f9ee490e7 Revert r277966. Forgot patch attribution.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@277967 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 22:23:24 +00:00
Hubert Tong
9bae734ed9 [libcxx] Add "flag" default arg: basic_regex ptr_size_flag ctor
Summary:
The synopsis in C++11 subclause 28.8 [re.regex] has:
```
basic_regex(const charT* p, size_t len,
            flag_type f = regex_constants::ECMAScript);
```

The default argument is added to libc++ by this change.

Reviewers: mclow.lists, rsmith, hubert.reinterpretcast

Subscribers: cfe-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@277966 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 22:18:33 +00:00
Hubert Tong
b49c67fad2 [libcxx] basic_regex: add traits_type, string_type
Summary:
In the synopsis in C++11 subclause 28.8 [re.regex], `basic_regex` is
specified to have member typedefs `traits_type` and `string_type`. This
change adds them to libc++.

Reviewers: mclow.lists, rsmith, hubert.reinterpretcast

Subscribers: cfe-commits

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

Patch by Jason Liu!


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@277526 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 21:34:48 +00:00
Daniel Sanders
7e87bc9c67 [libcxx] Fix definition of regex_traits::__regex_word on big-endian glibc systems
Summary:
On glibc, the bits used for the various character classes is endian dependant
(see _ISbit() in ctypes.h) but __regex_word does not account for this and uses
a spare bit that isn't spare on big-endian. On big-endian, it overlaps with the
bit for graphic characters which causes '-', '@', etc. to be considered a word
character.

Fixed this by defining the value using _ISbit(15) on MIPS glibc systems. We've
restricted this to MIPS for now to avoid the risk of introducing failures in
other targets.

Fixes PR26476.

Reviewers: hans, mclow.lists

Subscribers: dsanders, cfe-commits

Differential Revision: http://reviews.llvm.org/D17132


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@261088 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17 13:16:31 +00:00
Duncan P. N. Exon Smith
e784f5770f re.results.form: Format out-of-range subexpression references as null
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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@259682 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-03 19:30:20 +00:00
Marshall Clow
685cdcaf9f Fix PR#26175. Thanks to Josh Petrie for the report and the patch. Reviewed as http://reviews.llvm.org/D16262
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@258107 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19 00:50:37 +00:00
Evgeniy Stepanov
a3b25f81d1 Cleanup: move visibility/linkage attributes to the first declaration.
This change moves visibility attributes from out-of-class method
definitions to in-class declaration. This is needed for a switch to
attribute((internal_linkage)) (see http://reviews.llvm.org/D13925)
which can only appear on the first declaration.

This change does not touch istream/ostream/streambuf. They are
handled separately in http://reviews.llvm.org/D14409.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@252385 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-07 01:22:13 +00:00
Marshall Clow
70e8f59884 Fix a crasher found by libFuzzer
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245849 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-24 15:57:09 +00:00
Marshall Clow
fc93ce7349 Make regex and any assert when they should throw an exception _but_ the user has decreed 'no exceptions'. This matches the behavior of string and vector
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245239 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-17 21:14:16 +00:00
Marshall Clow
2576c29dab Consolidate a bunch of #ifdef _LIBCPP_NO_EXCEPTIONS .. #endif blocks into a single template function. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243415 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-28 13:30:47 +00:00
Marshall Clow
568bd0222f Detect and throw on a class of bad regexes that we mistakenly accepted before. Thanks to Trevor Smigiel for the report
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243030 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-23 18:27:51 +00:00
Eric Fiselier
7cc7106776 Fix initializer list order in <regex> to be correct
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@242864 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-22 01:29:41 +00:00
Eric Fiselier
47c5dae573 Remove unused typedefs in random and regex
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@242628 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-18 22:57:14 +00:00