aboutsummaryrefslogtreecommitdiff
path: root/libphobos/src/std/uni
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2022-03-29 16:57:10 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2022-04-02 23:56:52 +0200
commit235d5a96cb8dad0b4c427602346fcf966a4ec914 (patch)
treeca19c774a19ad923e5d6f09d43ee8d89c275a96e /libphobos/src/std/uni
parentbe07535d0f43390b8906826cc119473dea514b54 (diff)
downloadgcc-235d5a96cb8dad0b4c427602346fcf966a4ec914.zip
gcc-235d5a96cb8dad0b4c427602346fcf966a4ec914.tar.gz
gcc-235d5a96cb8dad0b4c427602346fcf966a4ec914.tar.bz2
d: Merge upstream dmd 47871363d, druntime, c52e28b7, phobos 99e9c1b77.
D front-end changes: - Import dmd v2.099.1-beta.1. - The address of NRVO variables is now stored in scoped closures when they have nested references. - Using `__traits(parameters)' in foreach loops now always returns the parameters to the function the foreach appears within. Previously, when used inside a `foreach' using an overloaded `opApply', the trait would yield the parameters to the delegate. - The deprecation period of unannotated `asm' blocks has been ended. - The `inout' attribute no longer implies the `return' attribute. - Added new `D_PreConditions', `D_PostConditions', and `D_Invariants' version identifiers. D runtime changes: - Import druntime v2.099.1-beta.1. Phobos changes: - Import phobos v2.099.1-beta.1. - `Nullable' in `std.typecons' can now act as a range. - std.experimental.logger default level changed to `info' instead of `warning'. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 47871363d. * d-builtins.cc (d_init_versions): Add predefined version identifiers D_PreConditions, D_PostConditions, and D_Invariants. * d-codegen.cc (d_build_call): Update for new front-end interface. (build_frame_type): Generate reference field for NRVO variables with nested references. (build_closure): Generate assignment of return address to closure. * d-tree.h (DECL_INSTANTIATED): Use DECL_LANG_FLAG_2. (bind_expr): Remove. * decl.cc (DeclVisitor::visit (FuncDeclaration *)): Update for new front-end interface. (get_symbol_decl): Likewise. (get_decl_tree): Check DECL_LANG_FRAME_FIELD before DECL_LANG_NRVO. Dereference the field when both are set. * expr.cc (ExprVisitor::visit (DeleteExp *)): Update for new front-end interface. * modules.cc (get_internal_fn): Likewise. * toir.cc (IRVisitor::visit (ReturnStatement *)): Likewise. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime c52e28b7. * libdruntime/Makefile.am (DRUNTIME_DSOURCES_OPENBSD): Add core/sys/openbsd/pwd.d. * libdruntime/Makefile.in: Regenerate. * src/MERGE: Merge upstream phobos 99e9c1b77. * testsuite/libphobos.exceptions/message_with_null.d: New test. gcc/testsuite/ChangeLog: * gdc.dg/nrvo1.d: New test.
Diffstat (limited to 'libphobos/src/std/uni')
-rw-r--r--libphobos/src/std/uni/package.d44
1 files changed, 26 insertions, 18 deletions
diff --git a/libphobos/src/std/uni/package.d b/libphobos/src/std/uni/package.d
index eeeda72..98735ac 100644
--- a/libphobos/src/std/uni/package.d
+++ b/libphobos/src/std/uni/package.d
@@ -9834,25 +9834,29 @@ dchar toLower(dchar c)
Returns:
An array with the same element type as `s`.
+/
-ElementEncodingType!S[] toLower(S)(S s)
-if (isSomeString!S || (isRandomAccessRange!S && hasLength!S && hasSlicing!S && isSomeChar!(ElementType!S)))
+ElementEncodingType!S[] toLower(S)(return scope S s) @trusted
+if (isSomeString!S)
{
static import std.ascii;
+ return toCase!(LowerTriple, std.ascii.toLower)(s);
+}
- static if (isSomeString!S)
- return () @trusted { return toCase!(LowerTriple, std.ascii.toLower)(s); } ();
- else
- return toCase!(LowerTriple, std.ascii.toLower)(s);
+/// ditto
+ElementEncodingType!S[] toLower(S)(S s)
+if (!isSomeString!S && (isRandomAccessRange!S && hasLength!S && hasSlicing!S && isSomeChar!(ElementType!S)))
+{
+ static import std.ascii;
+ return toCase!(LowerTriple, std.ascii.toLower)(s);
}
// overloads for the most common cases to reduce compile time
@safe pure /*TODO nothrow*/
{
- string toLower(string s)
+ string toLower(return scope string s)
{ return toLower!string(s); }
- wstring toLower(wstring s)
+ wstring toLower(return scope wstring s)
{ return toLower!wstring(s); }
- dstring toLower(dstring s)
+ dstring toLower(return scope dstring s)
{ return toLower!dstring(s); }
@safe unittest
@@ -10038,25 +10042,29 @@ dchar toUpper(dchar c)
Returns:
An new array with the same element type as `s`.
+/
-ElementEncodingType!S[] toUpper(S)(S s)
-if (isSomeString!S || (isRandomAccessRange!S && hasLength!S && hasSlicing!S && isSomeChar!(ElementType!S)))
+ElementEncodingType!S[] toUpper(S)(return scope S s) @trusted
+if (isSomeString!S)
{
static import std.ascii;
+ return toCase!(UpperTriple, std.ascii.toUpper)(s);
+}
- static if (isSomeString!S)
- return () @trusted { return toCase!(UpperTriple, std.ascii.toUpper)(s); } ();
- else
- return toCase!(UpperTriple, std.ascii.toUpper)(s);
+/// ditto
+ElementEncodingType!S[] toUpper(S)(S s)
+if (!isSomeString!S && (isRandomAccessRange!S && hasLength!S && hasSlicing!S && isSomeChar!(ElementType!S)))
+{
+ static import std.ascii;
+ return toCase!(UpperTriple, std.ascii.toUpper)(s);
}
// overloads for the most common cases to reduce compile time
@safe pure /*TODO nothrow*/
{
- string toUpper(string s)
+ string toUpper(return scope string s)
{ return toUpper!string(s); }
- wstring toUpper(wstring s)
+ wstring toUpper(return scope wstring s)
{ return toUpper!wstring(s); }
- dstring toUpper(dstring s)
+ dstring toUpper(return scope dstring s)
{ return toUpper!dstring(s); }
@safe unittest