aboutsummaryrefslogtreecommitdiff
path: root/absl/strings
Commit message (Collapse)AuthorAgeFilesLines
* Add ABSL_INTERNAL_ATTRIBUTE_VIEW and ABSL_INTERNAL_ATTRIBUTE_OWNER ↵Abseil Team2024-06-121-1/+1
| | | | | | | attributes to types in Abseil PiperOrigin-RevId: 642619703 Change-Id: I8d2e423a3c7f40709d0e8c82cac0395c75d601cf
* PR #1689: Minor: Add missing quotes in CMake string view library definitionRobert Schulze2024-06-101-2/+2
| | | | | | | | | | | | 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 TODOAbseil Team2024-06-041-1/+0
| | | | | PiperOrigin-RevId: 640138527 Change-Id: I650dd91d76824cfd3a57b36eca282f41b3667125
* Workaround symbol resolution bug in Clang 19Derek Mauro2024-05-242-1/+12
| | | | | | | | | | | | | | 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 warningDerek Mauro2024-05-241-0/+10
| | | | | PiperOrigin-RevId: 636990118 Change-Id: Ib90ed852b899a976679a8eb6352a9161c27e17ce
* PR #1672: Optimize StrJoin with tuple without user defined formatterValery Mironov2024-05-153-1/+22
| | | | | | | | | | | | | | 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`Derek Mauro2024-05-132-4/+53
| | | | | | | | | | | | | | | | | 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 ↵Dino Radakovic2024-05-101-9/+7
| | | | | | | | | 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.Abseil Team2024-05-061-1/+1
| | | | | PiperOrigin-RevId: 631211391 Change-Id: I68bb19d5702626ac497b05d851936aec42cc99d4
* `convert_test`: Extract loop over tested floats from helper functionDino Radakovic2024-05-061-14/+18
| | | | | | | | | | 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.Fergus Henderson2024-04-301-15/+13
| | | | | PiperOrigin-RevId: 629403229 Change-Id: I24762df161f8a0ea41e59765ec68273f8607166b
* Guard against null pointer dereference in DumpNode.Fergus Henderson2024-04-251-4/+5
| | | | | PiperOrigin-RevId: 628134930 Change-Id: I6b9763f2a87a9259963f00815c6953927f8add73
* Remove the hand-rolled CordLeaker and replace with absl::NoDestructorDerek Mauro2024-04-243-27/+9
| | | | | | | to test the after-exit behavior PiperOrigin-RevId: 627804039 Change-Id: Idc1c5fc14cea466dcc98f0d8746c02cafe887502
* `convert_test`: Delete obsolete `skip_verify` parameter in test helperDino Radakovic2024-04-241-10/+7
| | | | | | | | 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`Abseil Team2024-04-181-2/+2
| | | | | PiperOrigin-RevId: 626124196 Change-Id: I81a9e4c35d6456ab8cd3942f9c2452c70db90678
* Add `absl::AppendCordToString`Abseil Team2024-04-183-0/+64
| | | | | PiperOrigin-RevId: 626039936 Change-Id: I6e791363bab06d66029a8565c42d158a2fe176f0
* `str_format/convert_test`: Delete workaround for [glibc ↵Dino Radakovic2024-04-181-23/+0
| | | | | | | | | 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 checkAbseil Team2024-04-092-0/+9
| | | | | PiperOrigin-RevId: 623195368 Change-Id: Iadb9bdedee4d9b5ced4fff9e6316ee63f9a89ea5
* Add ABSL_ATTRIBUTE_LIFETIME_BOUND to Cord::Flatten/TryFlatAbseil Team2024-04-041-2/+3
| | | | | | | 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 fixedAbseil Team2024-04-022-9/+0
| | | | | PiperOrigin-RevId: 621413395 Change-Id: I20e9fac94e81e59c0d723f115670c8cf68e9b44a
* Add internal traits to absl::string_view for lifetimebound detectionAbseil Team2024-04-024-0/+12
| | | | | | | | | 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 HexStringToBytesAbseil Team2024-03-282-5/+15
| | | | | PiperOrigin-RevId: 620141661 Change-Id: I9dc9243b1d227f7cf32319bc1fec94aba850d4c1
* Revert integer-to-string conversion optimizations pending more thorough analysisAbseil Team2024-03-266-755/+196
| | | | | PiperOrigin-RevId: 619261152 Change-Id: Id3409b326c52ace0fda42537e0b91dbb2d6a2287
* Fix a bug in `Cord::{Append,Prepend}(CordBuffer)`: callMarcin Kowalczyk2024-03-262-1/+4
| | | | | | | | | | | `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.Abseil Team2024-03-241-1/+1
| | | | | PiperOrigin-RevId: 618650101 Change-Id: I6cff17a9db0dc45ad3b1f833df6ea3d7d04a7449
* Performance improvement for absl::AsciiStrToUpper() and absl::AsciiStrToLower()Abseil Team2024-03-202-71/+36
| | | | | PiperOrigin-RevId: 617613544 Change-Id: I526b5bc087edf54046c77795dddf5412478ac6a8
* Remove vestigial variables in the DumpNode() helper in absl::CordDerek Mauro2024-03-191-10/+5
| | | | | | | Fixes #1636 (GCC -Wmaybe-uninitialized warning) PiperOrigin-RevId: 617253727 Change-Id: I246cd21d8123d4dfa7780b1c4cac8ea1558a4067
* Add explicit #include directives for <tuple>, "absl/base/config.h", and ↵Abseil Team2024-03-191-0/+3
| | | | | | | "absl/strings/string_view.h". PiperOrigin-RevId: 617232899 Change-Id: I5e6c0bd4545d7f7ad9c5c494017269e247f620a3
* Record sampling stride in cord profiling to facilitate unsampling.Chris Kennelly2024-03-189-71/+95
| | | | | | | | 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 overflowsDerek Mauro2024-03-144-12/+56
| | | | | | | | | 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 warningAbseil Team2024-03-071-1/+5
| | | | | | | | | | | 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 ChangeAbseil Team2024-02-281-0/+2
| | | | | PiperOrigin-RevId: 611321915 Change-Id: Ia63e3e2f66981d9e4f5b97f6df276b8195459ba2
* Workaround for NVIDIA C++ compiler being unable to parse variadic expansions ↵Abseil Team2024-02-281-12/+11
| | | | | | | | in range of range-based for loop Fixes: #1629 PiperOrigin-RevId: 611131201 Change-Id: I787731e00207b544ee16055e6e0d323a5094a433
* Performance improvement for absl::AsciiStrToUpper() and absl::AsciiStrToLower()Abseil Team2024-02-201-8/+63
| | | | | PiperOrigin-RevId: 608770171 Change-Id: Icca54086037e42826c272f04374aeb33d060ace5
* Performance improvement for absl::AsciiStrToUpper() and absl::AsciiStrToLower()Abseil Team2024-02-201-63/+8
| | | | | PiperOrigin-RevId: 608661989 Change-Id: Ibfd94f8b2d23fd232bf93904ed68e11a400b3644
* Minor documentation fix for `absl::StrSplit()`Abseil Team2024-02-141-1/+1
| | | | | PiperOrigin-RevId: 607095897 Change-Id: I077857f0b4c5cf8bbc62bfc8e51a20bb6845296c
* Prevent overflow in `absl::CEscape()`Derek Mauro2024-02-141-4/+22
| | | | | | | | | | | | | | | | | | 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 ↵Matt Kulukundis2024-02-072-6/+7
| | | | | | | go/ranked-overloads PiperOrigin-RevId: 605125821 Change-Id: I2ee260eaf283acafd80abfd2b7419a0e9f597a78
* Stop using `std::basic_string<uint8_t>` which relies on a non-standard genericBogdan Graur2024-02-071-6/+5
| | | | | | | `char_traits<>` implementation, recently removed from `libc++`. PiperOrigin-RevId: 605023824 Change-Id: Ia708c91c24625afc4504fa77e959f8ed1e025589
* Add a version of absl::HexStringToBytes() that returns a boolDerek Mauro2024-02-053-1/+84
| | | | | | | | | | | | 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.Martijn Vels2024-02-012-1/+22
| | | | | PiperOrigin-RevId: 603342563 Change-Id: I1cd80103377f457770d5178dad8b56ae459cbd55
* Replace `testonly = 1` with `testonly = True` in abseil BUILD files.Shahriar Rouf2024-01-311-4/+4
| | | | | | | https://bazel.build/build/style-guide#other-conventions PiperOrigin-RevId: 603084345 Change-Id: Ibd7c9573d820f88059d12c46ff82d7d322d002ae
* Missing parenthesis.Abseil Team2024-01-301-1/+1
| | | | | PiperOrigin-RevId: 602864815 Change-Id: I74db20c93f6a7d9046779677cb4a328dc54bae69
* Use absl::NoDestructor for cordz global queue.Abseil Team2024-01-303-25/+26
| | | | | | | 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.Matt Kulukundis2024-01-293-0/+23
| | | | | | | 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
* Add nullability annotationsDmitri Gribenko2024-01-252-23/+40
| | | | | PiperOrigin-RevId: 601477629 Change-Id: I3b683d94192b04f233ce5ec636586ccb90d24602
* Prevent brace initialization of AlphaNumAbseil Team2024-01-191-0/+5
| | | | | | | | | This was not intended to be supported, and it has resulted in calls as `absl::StrCat({...})`, which are not supported and only work coincidentally for the first 4 arguments due to `absl::StrCat` having overloads that take `absl::AlphaNum` directly for those. The existing situation prevents modifying the implementations of such functions to alternatives that do not have such overloads for those arguments. PiperOrigin-RevId: 599872755 Change-Id: I02c90119b2b96a922cf7e3b5d5f02affe24a272d
* Remove code pieces for no longer supported MSVC versions.Abseil Team2024-01-192-5/+1
| | | | | | | The current support policy is `_MSC_VER >= 1920`. PiperOrigin-RevId: 599833619 Change-Id: I9cf7393a5b659d1680765e37e0328539ccb870fa
* Re-add the internal file //absl/string/internal/has_absl_stringify.h to unblockDerek Mauro2024-01-093-0/+46
| | | | | | | | | | | | | | | releasing Abseil and GoogleTest. GoogleTest referenced this internal file and this internal trait. Since simultaneous releases are not possible since once release must reference another, we will temporarily add this back. https://github.com/google/googletest/blob/v1.14.x/googletest/include/gtest/gtest-printers.h#L119 https://github.com/google/googletest/pull/4368#issuecomment-1717699895 https://github.com/google/googletest/pull/4368#issuecomment-1717699895 PiperOrigin-RevId: 597073935 Change-Id: I7c2697a212dc477fd25770777445c64cfee73745
* Extend BM_StrAppendInt to use log-uniform random numbers instead of constantsAbseil Team2024-01-052-33/+47
| | | | | | | | | This follows Benford's law, which is likely also a much more accurate representation of real data than a constant. We also add benchmarks for different integer types. PiperOrigin-RevId: 596039508 Change-Id: I4862c7cfdbf5face18ae31cf0bd2fd54e47684b7