mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-29 21:24:04 +00:00
Upstream Bionic definitions of ctype_base/regex.
Summary: This is a patch that Android has been carrying in its tree for several years. This patch upstreams the existing ABI. There's some historical cruft here. __regex_word used to be a part of regex_traits rather than ctype_base. Bionic also used to use its own ctype implementation because the libc++ builtin one wasn't available yet. Bionic's ctype masks were 8 bits wide and already saturated, so a wider type needed to be used for the regex mask, and the existing value was already used so Android needed to specify its own. Since then Android has migrated to the builtin ctype implementation and this patch probably should have been dropped then. Unfortunately that was not noticed at the time, so now we need to keep this to maintain the current ABI. Reviewers: EricWF, #libc, ldionne Reviewed By: #libc, ldionne Subscribers: dexonsmith, ldionne, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D76171
This commit is contained in:
parent
6f9ea26002
commit
cbf1904a3e
@ -496,7 +496,13 @@ public:
|
||||
static const mask punct = 1<<7;
|
||||
static const mask xdigit = 1<<8;
|
||||
static const mask blank = 1<<9;
|
||||
#if defined(__BIONIC__)
|
||||
// Historically this was a part of regex_traits rather than ctype_base. The
|
||||
// historical value of the constant is preserved for ABI compatibility.
|
||||
static const mask __regex_word = 0x8000;
|
||||
#else
|
||||
static const mask __regex_word = 1<<10;
|
||||
#endif // defined(__BIONIC__)
|
||||
#endif
|
||||
static const mask alnum = alpha | digit;
|
||||
static const mask graph = alnum | punct;
|
||||
|
@ -1001,7 +1001,19 @@ public:
|
||||
typedef _CharT char_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
typedef locale locale_type;
|
||||
#ifdef __BIONIC__
|
||||
// Originally bionic's ctype_base used its own ctype masks because the
|
||||
// builtin ctype implementation wasn't in libc++ yet. Bionic's ctype mask
|
||||
// was only 8 bits wide and already saturated, so it used a wider type here
|
||||
// to make room for __regex_word (then a part of this class rather than
|
||||
// ctype_base). Bionic has since moved to the builtin ctype_base
|
||||
// implementation, but this was not updated to match. Since then Android has
|
||||
// needed to maintain a stable libc++ ABI, and this can't be changed without
|
||||
// an ABI break.
|
||||
typedef uint16_t char_class_type;
|
||||
#else
|
||||
typedef ctype_base::mask char_class_type;
|
||||
#endif
|
||||
|
||||
static const char_class_type __regex_word = ctype_base::__regex_word;
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user