summaryrefslogtreecommitdiff
path: root/absl/strings
Commit message (Collapse)AuthorAge
* Fix LINT.IfChange syntaxGravatar Derek Mauro2024-07-22
| | | | | PiperOrigin-RevId: 654745969 Change-Id: I96b9797c0fb91cf22e5a50ef97223216683d4ec7
* PR #1720: Fix spelling mistake: occurrance -> occurrenceGravatar Ikko Eltociear Ashimine2024-07-18
| | | | | | | | | | | | Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1720 Merge a72c4bcc7b45d17cf12bee62989722f16f85f0fd into 0598e582f659594aa3592c70ba7dcb251649d264 Merging this change closes #1720 COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1720 from eltociear:patch-1 a72c4bcc7b45d17cf12bee62989722f16f85f0fd PiperOrigin-RevId: 653737423 Change-Id: I5638538d1b008942feba6dc6fc98dcdbf53653ef
* Delete absl/strings/internal/has_absl_stringify.h now that theGravatar Derek Mauro2024-07-18
| | | | | | | GoogleTest version we depend on uses the public file PiperOrigin-RevId: 653606441 Change-Id: Id49b18835443162ddf9747cc31619f3acf01f4ef
* Deprecate `ABSL_ATTRIBUTE_NORETURN` in favor of the `[[noreturn]]`Gravatar Derek Mauro2024-07-01
| | | | | | | | | | | | | | | standardized in C++11 Migrate all Abseil code to `[[noreturn]]`. Notably, https://github.com/abseil/abseil-cpp/issues/1698 reports that `[[noreturn]]` works better here. We can't migrate `ABSL_ATTRIBUTE_NORETURN` to use `[[noreturn]]` because the difference in accepted attribute placement breaks some code. PiperOrigin-RevId: 648395324 Change-Id: Icd3e9b837aac25f128e8994de099f1edb3cabccf
* Three-way comparison spaceship <=> operators for Cord.Gravatar Abseil Team2024-06-26
| | | | | | | 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
* Add ABSL_INTERNAL_ATTRIBUTE_VIEW and ABSL_INTERNAL_ATTRIBUTE_OWNER ↵Gravatar Abseil Team2024-06-12
| | | | | | | attributes to types in Abseil PiperOrigin-RevId: 642619703 Change-Id: I8d2e423a3c7f40709d0e8c82cac0395c75d601cf
* PR #1689: Minor: Add missing quotes in CMake string view library definitionGravatar Robert Schulze2024-06-10
| | | | | | | | | | | | Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1689 Merge c755474cd03d3da0efa68ec0605b183d24bfd5d6 into 2f61aed18c4affd3a75a2b2d2468d23f2f16192a Merging this change closes #1689 COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1689 from rschu1ze:missing-quotes c755474cd03d3da0efa68ec0605b183d24bfd5d6 PiperOrigin-RevId: 641896976 Change-Id: Iaf565a13ad639543c2f1ba698aefd18f8f48bede
* Remove obsolete TODOGravatar Abseil Team2024-06-04
| | | | | PiperOrigin-RevId: 640138527 Change-Id: I650dd91d76824cfd3a57b36eca282f41b3667125
* Workaround symbol resolution bug in Clang 19Gravatar Derek Mauro2024-05-24
| | | | | | | | | | | | | | Clang 19 seems to see the old usage of absl::string_internal::HasAbslStringify in GoogleTest 1.14.0 and incorrectly resolves absl::HasAbslStringify sometimes. This issue is fixed when a version of GoogleTest that removes absl::string_internal::HasAbslStringify is used. This workaround is ugly but will be removed after the next GoogleTest release. PiperOrigin-RevId: 636993564 Change-Id: Ic166edbd4ddc2c716afbedec34be629cfc988e00
* Silence a bogus GCC14 -Warray-bounds warningGravatar Derek Mauro2024-05-24
| | | | | PiperOrigin-RevId: 636990118 Change-Id: Ib90ed852b899a976679a8eb6352a9161c27e17ce
* PR #1672: Optimize StrJoin with tuple without user defined formatterGravatar Valery Mironov2024-05-15
| | | | | | | | | | | | | | Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1672 https://github.com/abseil/abseil-cpp/discussions/1671 Merge ddcbb2466b2c9c4048d60be7e58cf47f935c257d into eba8db7baf6c326870f28e58977075b7b2fb243d Merging this change closes #1672 COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1672 from MBkkt:optimize-str-join ddcbb2466b2c9c4048d60be7e58cf47f935c257d PiperOrigin-RevId: 633988391 Change-Id: I2b3904211a29de3a768fb90a7fc106d7ff6c03e7
* Add a `string_view` overload to `absl::StrJoin`Gravatar Derek Mauro2024-05-13
| | | | | | | | | | | | | | | | | This allows users to pass a collection of string-like objects in an `initializer_list` without having to convert everything to the same type first. `initializer_list` has the requirement that everything is copied in to the list. For strings hitting the `string_view` overload avoids unnecessary copies. This may be a breaking change if `absl::StrJoin` has an explicit template parameter, for example `absl::StrJoin<std::string>({foo, "bar"});`. In this case, remove the explicit template parameter. PiperOrigin-RevId: 633295575 Change-Id: Ie5f0860f409f639a27a58949842ec961e0b3bdeb
* `convert_test`: Delete obsolete condition around ASSERT_EQ in ↵Gravatar Dino Radakovic2024-05-10
| | | | | | | | | TestWithMultipleFormatsHelper The `if (actual != expected)` makes the `ASSERT_EQ(actual, expected)` trigger only when the assertion fails. However, a successful `ASSERT_EQ` takes a negligible amount of time, which means the `if` is useless and only makes the test harder to read. PiperOrigin-RevId: 632487285 Change-Id: I1f78136cf4895295c88a5ff3e0bcdce6b08c1d0b
* Doc fix.Gravatar Abseil Team2024-05-06
| | | | | PiperOrigin-RevId: 631211391 Change-Id: I68bb19d5702626ac497b05d851936aec42cc99d4
* `convert_test`: Extract loop over tested floats from helper functionGravatar Dino Radakovic2024-05-06
| | | | | | | | | | This change is a step towards simplifying `TestWithMultipleFormatsHelper` to the point where we'll be able to handle special cases (e.g. apple's handling of nan) by changing which inputs are fed into the helper, instead of skipping them within the helper and not testing them at all. Extracting the loop also improves readability by reducing indentation. PiperOrigin-RevId: 631038465 Change-Id: I8b2458539d9d276093d8e7b5f373efba6a33800c
* Enable Cord tests with Crc.Gravatar Fergus Henderson2024-04-30
| | | | | PiperOrigin-RevId: 629403229 Change-Id: I24762df161f8a0ea41e59765ec68273f8607166b
* Guard against null pointer dereference in DumpNode.Gravatar Fergus Henderson2024-04-25
| | | | | PiperOrigin-RevId: 628134930 Change-Id: I6b9763f2a87a9259963f00815c6953927f8add73
* Remove the hand-rolled CordLeaker and replace with absl::NoDestructorGravatar Derek Mauro2024-04-24
| | | | | | | to test the after-exit behavior PiperOrigin-RevId: 627804039 Change-Id: Idc1c5fc14cea466dcc98f0d8746c02cafe887502
* `convert_test`: Delete obsolete `skip_verify` parameter in test helperGravatar Dino Radakovic2024-04-24
| | | | | | | | It is unused. We already use code within the `TestWithMultipleFormatsHelper` to skip output verification for Apple and MSVC. PiperOrigin-RevId: 627783586 Change-Id: Ib51374e8571aa5f4b5f1e836815188bd9bdc1536
* Minor cleanup for `absl::Cord`Gravatar Abseil Team2024-04-18
| | | | | PiperOrigin-RevId: 626124196 Change-Id: I81a9e4c35d6456ab8cd3942f9c2452c70db90678
* Add `absl::AppendCordToString`Gravatar Abseil Team2024-04-18
| | | | | PiperOrigin-RevId: 626039936 Change-Id: I6e791363bab06d66029a8565c42d158a2fe176f0
* `str_format/convert_test`: Delete workaround for [glibc ↵Gravatar Dino Radakovic2024-04-18
| | | | | | | | | bug](https://sourceware.org/bugzilla/show_bug.cgi?id=22142) RHEL7 ships an affected version of glibc, but this bug is specific to powerpc, which abseil [does not support](https://github.com/google/oss-policies-info/blob/4ec9f2a979a6c6b7bb148040347c8d2b1def09fa/foundational-cxx-support-matrix.md). PiperOrigin-RevId: 626018125 Change-Id: I1875aee6c37e69f712ef91e41da455af9d00fb5f
* Restore string_view detection checkGravatar Abseil Team2024-04-09
| | | | | PiperOrigin-RevId: 623195368 Change-Id: Iadb9bdedee4d9b5ced4fff9e6316ee63f9a89ea5
* Add ABSL_ATTRIBUTE_LIFETIME_BOUND to Cord::Flatten/TryFlatGravatar Abseil Team2024-04-04
| | | | | | | These were already on the declarations, but it seems like the definitions need them as well. PiperOrigin-RevId: 621868985 Change-Id: I2595aae506924f8b1dad3b07efe1660ae0e4488e
* Temporarily revert dangling std::string_view detection until dependent is fixedGravatar Abseil Team2024-04-02
| | | | | PiperOrigin-RevId: 621413395 Change-Id: I20e9fac94e81e59c0d723f115670c8cf68e9b44a
* Add internal traits to absl::string_view for lifetimebound detectionGravatar Abseil Team2024-04-02
| | | | | | | | | 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
* Use local decoding buffer in HexStringToBytesGravatar Abseil Team2024-03-28
| | | | | PiperOrigin-RevId: 620141661 Change-Id: I9dc9243b1d227f7cf32319bc1fec94aba850d4c1
* Revert integer-to-string conversion optimizations pending more thorough analysisGravatar Abseil Team2024-03-26
| | | | | PiperOrigin-RevId: 619261152 Change-Id: Id3409b326c52ace0fda42537e0b91dbb2d6a2287
* Fix a bug in `Cord::{Append,Prepend}(CordBuffer)`: callGravatar Marcin Kowalczyk2024-03-26
| | | | | | | | | | | `MaybeRemoveEmptyCrcNode()`. Otherwise appending a `CordBuffer` an empty Cord with a CRC node crashes (`RemoveCrcNode()` which increases the refcount of a nullptr child). Cosmetics: in `Cord::InlineRep::AppendArray()`, return early for empty `src` before removing the empty CRC node. PiperOrigin-RevId: 619107278 Change-Id: I4f1bc6b75c662f4678c61e3ef310e8597d62e2e1
* LSC: Move expensive variables on their last use to avoid copies.Gravatar Abseil Team2024-03-24
| | | | | PiperOrigin-RevId: 618650101 Change-Id: I6cff17a9db0dc45ad3b1f833df6ea3d7d04a7449
* Performance improvement for absl::AsciiStrToUpper() and absl::AsciiStrToLower()Gravatar Abseil Team2024-03-20
| | | | | PiperOrigin-RevId: 617613544 Change-Id: I526b5bc087edf54046c77795dddf5412478ac6a8
* Remove vestigial variables in the DumpNode() helper in absl::CordGravatar Derek Mauro2024-03-19
| | | | | | | Fixes #1636 (GCC -Wmaybe-uninitialized warning) PiperOrigin-RevId: 617253727 Change-Id: I246cd21d8123d4dfa7780b1c4cac8ea1558a4067
* Add explicit #include directives for <tuple>, "absl/base/config.h", and ↵Gravatar Abseil Team2024-03-19
| | | | | | | "absl/strings/string_view.h". PiperOrigin-RevId: 617232899 Change-Id: I5e6c0bd4545d7f7ad9c5c494017269e247f620a3
* Record sampling stride in cord profiling to facilitate unsampling.Gravatar Chris Kennelly2024-03-18
| | | | | | | | The sampling rate may change over time, so this allows us to weight samples by the value observed when we made the sampling decision. PiperOrigin-RevId: 616900100 Change-Id: I9b1affdba93f5f48367cb7503916296b2d84709a
* Add additional checks for size_t overflowsGravatar Derek Mauro2024-03-14
| | | | | | | | | This change mainly affects 32-bit platforms. Similar to 4618865caf8596742a9fd7c28a70a46b5e277794, check for size_t overflow in all places where string result sizes are precomputed before allocation. PiperOrigin-RevId: 615792028 Change-Id: I71c774c5ef2c2978bd812c70e9bab36d266b7c90
* Work around an implicit conversion signedness compiler warningGravatar Abseil Team2024-03-07
| | | | | | | | | | | Addition and subtraction operators std::array::iterator are defined only for ptrdiff_t, which is signed, instead of size_t, which is unsigned. Therefore, adding the index variable to ar.begin() will trigger -Wsign-conversion if std::array::iterator is not a raw pointer because the index variable will be implicitly converted from size_t (an unsigned type) to ptrdiff_t (a signed type). To fix this, we explicitly static_cast index to a ptrdiff_t. PiperOrigin-RevId: 613662928 Change-Id: I5e06c2261d7b8f167fae7bb6acece076257f8579
* Automated Code ChangeGravatar Abseil Team2024-02-28
| | | | | PiperOrigin-RevId: 611321915 Change-Id: Ia63e3e2f66981d9e4f5b97f6df276b8195459ba2
* Workaround for NVIDIA C++ compiler being unable to parse variadic expansions ↵Gravatar Abseil Team2024-02-28
| | | | | | | | in range of range-based for loop Fixes: #1629 PiperOrigin-RevId: 611131201 Change-Id: I787731e00207b544ee16055e6e0d323a5094a433
* Performance improvement for absl::AsciiStrToUpper() and absl::AsciiStrToLower()Gravatar Abseil Team2024-02-20
| | | | | PiperOrigin-RevId: 608770171 Change-Id: Icca54086037e42826c272f04374aeb33d060ace5
* Performance improvement for absl::AsciiStrToUpper() and absl::AsciiStrToLower()Gravatar Abseil Team2024-02-20
| | | | | PiperOrigin-RevId: 608661989 Change-Id: Ibfd94f8b2d23fd232bf93904ed68e11a400b3644
* Minor documentation fix for `absl::StrSplit()`Gravatar Abseil Team2024-02-14
| | | | | PiperOrigin-RevId: 607095897 Change-Id: I077857f0b4c5cf8bbc62bfc8e51a20bb6845296c
* Prevent overflow in `absl::CEscape()`Gravatar Derek Mauro2024-02-14
| | | | | | | | | | | | | | | | | | Strings larger than 1 GiB on a platform with a 32-bit size_t could potentially overflow size_t in `CEscapedLength()`, resulting in an undersized allocation. The resulting write in `CEscapeAndAppendInternal()` would then write beyond the bounds of the output buffer. A second overflow, where the calculated escaped length is added to the size of the string being appended to, is also fixed. In both cases the program will now abort prior to the overflow. Credit goes to Ronald Crane (Zippenhop LLC) for reporting this issue. PiperOrigin-RevId: 607019573 Change-Id: I97bf246cde96102a793d2db49446cccae08abf59
* Switch rank structs to be consistent with written guidance in ↵Gravatar Matt Kulukundis2024-02-07
| | | | | | | go/ranked-overloads PiperOrigin-RevId: 605125821 Change-Id: I2ee260eaf283acafd80abfd2b7419a0e9f597a78
* Stop using `std::basic_string<uint8_t>` which relies on a non-standard genericGravatar Bogdan Graur2024-02-07
| | | | | | | `char_traits<>` implementation, recently removed from `libc++`. PiperOrigin-RevId: 605023824 Change-Id: Ia708c91c24625afc4504fa77e959f8ed1e025589
* Add a version of absl::HexStringToBytes() that returns a boolGravatar Derek Mauro2024-02-05
| | | | | | | | | | | | to validate that the input was actually valid hexadecimal data. Mark the version of absl::HexStringToBytes() that does not validate the input as deprecated. Fixes #141 PiperOrigin-RevId: 604495678 Change-Id: Iac3020c33c9dbc6d8e31a43b746783fb345edaa7
* Optimize `Cord::Swap()` for missed compiler optimization in clang.Gravatar Martijn Vels2024-02-01
| | | | | PiperOrigin-RevId: 603342563 Change-Id: I1cd80103377f457770d5178dad8b56ae459cbd55
* Replace `testonly = 1` with `testonly = True` in abseil BUILD files.Gravatar Shahriar Rouf2024-01-31
| | | | | | | https://bazel.build/build/style-guide#other-conventions PiperOrigin-RevId: 603084345 Change-Id: Ibd7c9573d820f88059d12c46ff82d7d322d002ae
* Missing parenthesis.Gravatar Abseil Team2024-01-30
| | | | | PiperOrigin-RevId: 602864815 Change-Id: I74db20c93f6a7d9046779677cb4a328dc54bae69
* Use absl::NoDestructor for cordz global queue.Gravatar Abseil Team2024-01-30
| | | | | | | Also updated the return value to reference to clarify non-nullability. PiperOrigin-RevId: 602730828 Change-Id: Ia36f7fde3cc87ac597ba4f194eebe9ebb90a1a09
* Fix a corner case in SpyHashState for exact boundaries.Gravatar Matt Kulukundis2024-01-29
| | | | | | | AbslHash allows for piecewise chunks to be streamed incrementally into hash states and requires them to hash identically to one giant stream. The exact size window for this is an internal details `PiecewiseChunkSize`. There was an off by one error in this code. Add tests and fix it. PiperOrigin-RevId: 602463183 Change-Id: I159bbb5e7e745f55b2fe6eaf0d2735bd0a08aca9