177 Commits

Author SHA1 Message Date
Derek Mauro
64730a2348 Remove an obsolete //visibility:private tag
PiperOrigin-RevId: 924755156
Change-Id: I60faad5644dbcf53e1ca4a502f1eb4bf4dfd1b87
2026-06-01 09:35:26 -07:00
Abseil Team
c20be0a44d Add absl::StatusBuilder and status macros (ASSIGN_OR_RETURN, RETURN_IF_ERROR, etc.)
PiperOrigin-RevId: 915476143
Change-Id: If1ce23cf40e4e44c39164f81f6d5ca66988d405c
2026-05-14 09:45:04 -07:00
Derek Mauro
638e17aedd Add absl::CopyCordToSpan()
PiperOrigin-RevId: 912247630
Change-Id: Ie5d2837c9b878e6094dce4d2ec7e60441a7c6bb7
2026-05-07 17:55:11 -07:00
Abseil Team
bd6adb86c2 Change abseil hardening assertions in the strings directory from macros to functions
This associates debug information with the assertion sites, allowing clearer stack-traces for assertion failures and better accounting of the performance overhead of assertions.

PiperOrigin-RevId: 910863016
Change-Id: Ic615a9eeb8ad4b3f8c035074df4ff8347190e5c7
2026-05-05 13:00:46 -07:00
Abseil Team
ed2114e8ff Stop using C++17 type traits polyfills
This will let us deprecate the declarations without triggering warnings in Abseil itself.

PiperOrigin-RevId: 894202105
Change-Id: I57bb2a1647be1fedf9b724a07042fd0f564ce074
2026-04-03 12:34:35 -07:00
Derek Mauro
4ff7ff9ee9 Add cleanup dependency
PiperOrigin-RevId: 891759296
Change-Id: I315b927a89cbb7e8d25c77e994d07b0e545f6909
2026-03-30 09:32:24 -07:00
Mike Kruskal
6c1f120e3e Add //gloop/util/status:status_macros to Gloop
PiperOrigin-RevId: 885969057
Change-Id: I11d30ca91b576e61664efc68dd4c1df353eec6be
2026-03-18 22:32:30 -07:00
Derek Mauro
e8f3bb209b Add additional tests in str_split_test.cc
PiperOrigin-RevId: 884611329
Change-Id: I5944333d11c85867652fc5e596020381c445d562
2026-03-16 13:34:12 -07:00
Abseil Team
0a7fe7e8da Add absl::strings_internal::AbslStringifyStream
PiperOrigin-RevId: 883300728
Change-Id: Ib5c83114fdc4e292ad8fcf96a899878315707353
2026-03-13 13:01:43 -07:00
Abseil Team
81f4d83f38 Add supporting code for absl::SourceLocation
PiperOrigin-RevId: 883256961
Change-Id: I536f9dc76ce4f248b5c87eaf27515cd8a4a484ca
2026-03-13 11:25:47 -07:00
Abseil Team
ea40a529e1 Disable failing tests on ChromiumOS configurations.
PiperOrigin-RevId: 877419268
Change-Id: I38f33b8afbb0a756338e0b10c83eeffb076aaae6
2026-03-02 08:46:34 -08:00
Mike Kruskal
45c8989b87 Add a visibility placeholder to Abseil for Gloop.
PiperOrigin-RevId: 875292936
Change-Id: I5622f33f8d6581ca3f55783579f612e3e5c4822f
2026-02-25 12:48:48 -08:00
Derek Mauro
5088cf5194 Cleanup the uses of the polyfills absl::any, absl::optional,
absl::variant, and related types

The corresponding headers are removed from cc files, but kept in
headers to prevent breakages from transitive dependencies.

PiperOrigin-RevId: 872421685
Change-Id: I867d4c3f7c9e422289c63816d44719b0530fb0a6
2026-02-19 08:53:17 -08:00
Chris Kennelly
5d365d332a absl/strings: Prepare helper for printing objects to string representations.
PiperOrigin-RevId: 847935770
Change-Id: I7f96940e5ba11d6a602d34e7dc3dbfde112bb142
2025-12-22 17:29:23 -08:00
Derek Mauro
9ebd93a774 Remove the implementation of absl::string_view, which was only needed
prior to C++17. `absl::string_view` is now an alias for `std::string_view`.
It is recommended that clients simply use `std::string_view`.

PiperOrigin-RevId: 845822478
Change-Id: I220530c84118e5b9ef110baa002c232ac8f2c5f2
2025-12-17 10:23:48 -08:00
Derek Mauro
f43bcc04d9 Fixes for String{Resize|Append}AndOverwrite
- StringAppendAndOverwrite() should always call StringResizeAndOverwrite()
    with at least capacity() in case the standard library decides to shrink
    the buffer (Fixes #1965)
  - Small refactor to make the minimum growth an addition for clarity and
    to make it easier to test 1.5x growth in the future
  - Turn an ABSL_HARDENING_ASSERT into a ThrowStdLengthError
  - Add a missing std::move

PiperOrigin-RevId: 826107106
Change-Id: I73ee3e98daa10161aa9023b2a879f6178ebedbcf
2025-10-30 11:06:09 -07:00
Derek Mauro
9a2624f3e7 Use the new absl::StringResizeAndOverwrite() in string escaping utilities
PiperOrigin-RevId: 825168879
Change-Id: I5dfcd546ffe01fc2035f4380c92ffd9afaa52331
2025-10-28 13:00:59 -07:00
Derek Mauro
f81f1b1d08 Add an internal-only helper StringAppendAndOverwrite() similar to
StringResizeAndOverwrite() but optimized for repeated appends, using
exponential growth to ensure amortized complexity of increasing
a string size by a small amount is O(1).

Use this function to replace STLStringResizeUninitializedAmortized()

PiperOrigin-RevId: 825100704
Change-Id: Ife64b13301bc4288d68154b7c496f57aaad4b6a4
2025-10-28 10:26:25 -07:00
Derek Mauro
b8c46feecc Rollback StringAppendAndOverwrite() - the problem is that
StringResizeAndOverwrite has MSAN testing of the entire string.
This causes quadratic MSAN verification on small appends.

PiperOrigin-RevId: 824629932
Change-Id: Ibefff781f5923c8bd2c1dc364f5b63fcb1d0f5ab
2025-10-27 12:30:02 -07:00
Derek Mauro
d3c55ba366 Add an internal-only helper StringAppendAndOverwrite() similar to
StringResizeAndOverwrite() but optimized for repeated appends, using
exponential growth to ensure amortized complexity of increasing
a string size by a small amount is O(1).

Use this function to replace STLStringResizeUninitializedAmortized()

PiperOrigin-RevId: 824571998
Change-Id: I6fe4a9cadd469ceee6a3818d7b8709e2fa286b9c
2025-10-27 10:16:39 -07:00
Abseil Team
d71fcd13f6 Use the new absl::StringResizeAndOverwrite() in string escaping utilities
PiperOrigin-RevId: 823263060
Change-Id: Ife62660889ce8602013ccbb563ec853ae22fee9f
2025-10-23 18:08:57 -07:00
Derek Mauro
09c29fe055 Use the new absl::StringResizeAndOverwrite() in string escaping utilities
PiperOrigin-RevId: 823159114
Change-Id: I94ccf42464a5fee6233b15dc8d44503b0b3f9db2
2025-10-23 13:10:11 -07:00
Derek Mauro
f807de027a CordzInfo: Use absl::NoDestructor to remove a global destructor.
Chromium requires no global destructors.

PiperOrigin-RevId: 822156140
Change-Id: Ieedc7e042df035e000649a2f07a217dee6ca40e7
2025-10-21 09:40:32 -07:00
Abseil Team
8faaaebc12 Use the new absl::StringResizeAndOverwrite() in string escaping utilities
PiperOrigin-RevId: 821867896
Change-Id: I6fe8456d8081ad87c8512dff6fc9235ab73e9448
2025-10-20 17:16:32 -07:00
Derek Mauro
c9ffd888c1 Use the new absl::StringResizeAndOverwrite() in string escaping utilities
PiperOrigin-RevId: 821767972
Change-Id: Ia4d38b49bc97a485dec3e352dcb056ca1c4465d6
2025-10-20 13:02:08 -07:00
Derek Mauro
bda5c03b3c Use the new absl::StringResizeAndOverwrite() in absl::StrCat()
PiperOrigin-RevId: 821664382
Change-Id: I864eabd832c3e09b13373356b09954e1f2cc038c
2025-10-20 08:45:20 -07:00
Chris Kennelly
d6c9f93ab6 Validate absl::StringResizeAndOverwrite op has written bytes as expected.
PiperOrigin-RevId: 820383934
Change-Id: I45be1c15cd2080772cea9bfe267041be5b530832
2025-10-16 14:00:31 -07:00
Derek Mauro
b6f7ac3fe5 Use the new absl::StringResizeAndOverwrite() in absl::CordCopyToString()
PiperOrigin-RevId: 819855323
Change-Id: Ia26ec7437ab46f7e77a22f070c6727332fef7d7d
2025-10-15 11:58:41 -07:00
Derek Mauro
0cf55c4fd6 Adds absl::StringResizeAndOverwrite as a polyfill for C++23's
`std::basic_string<CharT,Traits,Allocator>::resize_and_overwrite`

#1136

PiperOrigin-RevId: 815709814
Change-Id: Ie6b98d19058c5403fb3f6d65ccc82e2bb46ec4f6
2025-10-06 07:07:47 -07:00
Abseil Team
18dd270ff9 Adds required load statements for C++ rules to BUILD and bzl files.
PiperOrigin-RevId: 786301329
Change-Id: I342de39e40e90c82501baac9858291b7c4d5c2d0
2025-07-23 08:59:55 -07:00
Derek Mauro
2dd8036891 Update CI to a more recent Clang on Linux x86-64
/opt/llvm/clang/bin/clang -v
clang version 21.0.0git (https://github.com/llvm/llvm-project 2dee1a2de3d2cc774fbd43507cf4320418fbf279)

This change adds `-Wno-unused-command-line-argument`
to the Clang builds since Bazel is now providing an unused
`-c` to rules that do header syntax checking only.
Rules that were missing copts which causes them to
encounter this error are also fixed.

PiperOrigin-RevId: 764757573
Change-Id: I1eba676327a6023c5b8afb54499e4a3a72c2cdad
2025-05-29 09:17:25 -07:00
Omer Mor
dd69c96310 Extract WideToUtf8 helper to utf8.h.
This change allows to reuse the conversion of `wchar_t` into UTF-8 from other code.
It also adds tests that covers the conversion.

PiperOrigin-RevId: 755365598
Change-Id: I0f1c0b7949dec3c9874be99f01540748436532ce
2025-05-06 07:36:53 -07:00
Laramie Leavitt
3870e283fb Use absl::InsecureBitGen in place of std::random_device in Abseil tests.
PiperOrigin-RevId: 750721356
Change-Id: I84e8a1c2a80335983e557270ef78b8b0b4f1e452
2025-04-23 14:16:54 -07:00
Vitaly Goldshteyn
7bf6d7918f Use weaker mixing for absl::Hash for types that mix their sizes.
When a container or a string is mixed, size is only supplementary data.
We are still mixing size to avoid hash expansion to be a suffix of one another.

Mixing is done by addition `size + Seed()`. `+ Seed()` is needed to make an empty string to change the hash state. We assume that `Seed()` is already loaded to some register. Addition would modify low bits that will be spread with data mixing later.

We considered the following optimization. Mix the size at the beginning in order to improve the dependency graph. Mixing would happen in parallel with reading strings data. It's not feasible because absl::Hash API requires that hash expansions can't be suffixes of each other.

```
name                           old CYCLES/op        new CYCLES/op        delta
BM_latency_AbslHash_String3      27.2 ± 0%            21.5 ± 0%  -21.08%        (p=0.000 n=52+52)
BM_latency_AbslHash_String5      28.1 ± 8%            22.3 ±11%  -20.70%        (p=0.000 n=57+57)
BM_latency_AbslHash_String9      27.7 ± 9%            22.2 ±17%  -19.77%        (p=0.000 n=56+57)
BM_latency_AbslHash_String17     25.9 ± 5%            21.2 ±23%  -18.02%        (p=0.000 n=57+54)
BM_latency_AbslHash_String33     28.0 ± 5%            22.5 ± 4%  -19.69%        (p=0.000 n=54+54)
BM_latency_AbslHash_String65     37.9 ± 8%            32.2 ±10%  -15.19%        (p=0.000 n=52+53)
BM_latency_AbslHash_String257    57.1 ± 8%            52.0 ±10%   -8.88%        (p=0.000 n=52+54)
```

PiperOrigin-RevId: 750151406
Change-Id: I2245bad4906960d9236bea671738a218a85eb1af
2025-04-22 05:26:01 -07:00
Derek Mauro
67cab0c465 Cleanups related to benchmarks
* Fix many benchmarks to be cc_binary instead of cc_test
  * Add a few benchmarks for StrFormat
  * Add benchmarks for Substitute
  * Add benchmarks for Damerau-Levenshtein distance used in flags

PiperOrigin-RevId: 738448552
Change-Id: I521f4b2ef9116c9895b44c32d27e94507380bee8
2025-03-19 10:21:06 -07:00
Abseil Team
60a68ba597 Automated Code Change
PiperOrigin-RevId: 735633699
Change-Id: I30889aeea6f0f01c8ec8bdaaf803728d95327bb6
2025-03-10 22:44:15 -07:00
Derek Mauro
feb3d276d4 Remove ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
which is longer needed with the C++17 floor

PiperOrigin-RevId: 729365281
Change-Id: Ife5e778ead193bb37150b9799099e92f53252cb4
2025-02-20 21:07:28 -08:00
Dino Radakovic
60d29be650 absl: Replace base_internal::{invoke,invoke_result_t,is_invocable_r} with std equivalents
Now that Abseil only supports C++17 and beyond, these `base_internal` symbols [are just aliases](05e72a3285/absl/base/internal/invoke.h (L42)) in C++ >= 17. Replacing them in `Abseil`'s internals will allow us to delete `absl/base/internal/invoke.h`.

PiperOrigin-RevId: 726051909
Change-Id: Ic571307c6e11d7b3e2a380255bd4c9be98e232f9
2025-02-12 07:45:45 -08:00
Justin Bassett
9e764b4f25 Factor out some iterator traits detection code
There are a few different cases where we check iterator categorization, mostly for forward iterators for preallocating buffers of the correct size. Factoring this out makes it easier to make all of these cases support the C++20 iterator model.

PiperOrigin-RevId: 725791190
Change-Id: Icf9d687654618c7ceff98ec76ec59e83c682dd6b
2025-02-11 15:19:06 -08:00
Abseil Team
1d508979fc Faster copy from inline Cords to inline Strings
PiperOrigin-RevId: 714061397
Change-Id: Iad41d5033d7a0f87a54cd97d636aa450e0d6b8b4
2025-01-10 08:28:05 -08:00
Derek Mauro
90a7ba66e8 Updates to CI to support newer versions of tools
Linux "latest" containers updated to
GCC 14.2
CMake 3.31.2
Bazel 8.0.0

Included are various fixes to get these versions to work.

Bazel now references repositories by their canonical names from the
Bazel Central Registry. For example, Abseil is now @abseil-cpp instead
of @com_google_absl, and GoogleTest is now @googletest instead of
@com_google_googletest. Users still using the old WORKSPACE system may
need to use `repo_mapping` on repositories using the old names. See
`WORKSPACE.bazel` in this commit for an example.

PiperOrigin-RevId: 709102146
Change-Id: I02327ed4f8fb947766480bdeef2b1930a7f831eb
2024-12-23 10:58:05 -08:00
Abseil Team
28528f595e Add support for std::string_view in StrCat even when
absl::string_view != std::string_view.

PiperOrigin-RevId: 704802270
Change-Id: I8293f755a688707db575f0df22440f24ffad430e
2024-12-10 12:16:18 -08:00
Gennadiy Rozental
202a8f40cf Add missing Abseil inline namespace and fix includes
PiperOrigin-RevId: 686110246
Change-Id: I78be07f1c6795d282c3739c54764b1562fd2523c
2024-10-15 08:13:39 -07:00
Derek Mauro
0598e582f6 Delete absl/strings/internal/has_absl_stringify.h now that the
GoogleTest version we depend on uses the public file

PiperOrigin-RevId: 653606441
Change-Id: Id49b18835443162ddf9747cc31619f3acf01f4ef
2024-07-18 07:04:49 -07:00
Abseil Team
c98bd9c884 Three-way comparison spaceship <=> operators for Cord.
This is portable because cord already has `operator<` etc., which will be unaffected. This just allows C++ >= 20 users to explicitly call `operator<=>`.

PiperOrigin-RevId: 646951415
Change-Id: I1432e224bd5dc09b99d56a1d27e95078463adf45
2024-06-26 08:14:50 -07:00
Derek Mauro
b65852fa1e Remove the hand-rolled CordLeaker and replace with absl::NoDestructor
to test the after-exit behavior

PiperOrigin-RevId: 627804039
Change-Id: Idc1c5fc14cea466dcc98f0d8746c02cafe887502
2024-04-24 11:56:38 -07:00
Abseil Team
5953a4885a Add internal traits to absl::string_view for lifetimebound detection
This helps compilers that understand `ABSL_ATTRIBUTE_LIFETIME_BOUND` flag constructs such as
`absl::StatusOr<std::string_view> str = std::string(...)`
as error-prone.

PiperOrigin-RevId: 621196818
Change-Id: I78d4c66854cde9d06eaaec05869d956376109d9c
2024-04-02 09:04:52 -07:00
Abseil Team
55d28d4b3b Automated Code Change
PiperOrigin-RevId: 611321915
Change-Id: Ia63e3e2f66981d9e4f5b97f6df276b8195459ba2
2024-02-28 20:12:58 -08:00
Shahriar Rouf
780bfc194d Replace testonly = 1 with testonly = True in abseil BUILD files.
https://bazel.build/build/style-guide#other-conventions

PiperOrigin-RevId: 603084345
Change-Id: Ibd7c9573d820f88059d12c46ff82d7d322d002ae
2024-01-31 10:08:35 -08:00
Abseil Team
cbdbec098f Use absl::NoDestructor for cordz global queue.
Also updated the return value to reference to clarify non-nullability.

PiperOrigin-RevId: 602730828
Change-Id: Ia36f7fde3cc87ac597ba4f194eebe9ebb90a1a09
2024-01-30 08:15:07 -08:00