src/tests/compiler_tests/ImmutableString_test.cpp


Log

Author Commit Date CI Message
Kimmo Kinnunen b8d546b2 2024-10-30T15:40:58 Fix immutable string concats with ints `BuildConcatenatedImmutableString("a", 10, "b")` would construct "a\nb" because the implementation lacked int overloads and ints would be promoted to chars implicitly. Fix by implementing simpler way to calculate digits for numbers and then add useful overloads. Remove ImmutableStringBuilder::appendDecimal() since the code is already expecting << for all other types, and the bug was due to this expectation. Bug: angleproject:376417347 Change-Id: Iea5e14a6e2fede068b704754b9203db794dd5bf0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5972641 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Roman Lavrov 0197826b 2024-03-22T14:42:34 Revert "Add conversion operator from ImmutableString to std::string" This reverts commit 8c0dae388bccb00f11cd94d641d719cc68325826. Reason for revert: Breaks Android rolls: external/angle/src/compiler/translator/ImmutableString.h:103:15: error: constexpr function's return type 'std::string' (aka 'basic_string<char, char_traits<char>, allocator<char>>') is not a literal type 103 | constexpr operator std::string() const { return std::string(data(), length()); } | ^ external/libcxx/include/string:4332:64: note: 'basic_string<char>' is not literal because it is not an aggregate and has no constexpr constructors other than copy or move constructors 4332 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<char>) Original change's description: > Add conversion operator from ImmutableString to std::string > > Also use the operator in a couple of places. Sometimes saves a strlen. > > Bug: angleproject:8614 > Change-Id: I429f3ac02af04b568ac7d1adf22ab65e5007fbda > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5372728 > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> > Commit-Queue: Geoff Lang <geofflang@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:8614 Change-Id: I46963686f9506f7029e164250b1bf81f8ab2c519 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5388255 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Roman Lavrov <romanl@google.com>
Kimmo Kinnunen 8c0dae38 2024-03-15T16:09:04 Add conversion operator from ImmutableString to std::string Also use the operator in a couple of places. Sometimes saves a strlen. Bug: angleproject:8614 Change-Id: I429f3ac02af04b568ac7d1adf22ab65e5007fbda Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5372728 Reviewed-by: Geoff Lang <geofflang@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Kimmo Kinnunen 3fa8d578 2024-03-04T10:06:57 Make appendDecimal use the last char of the buffer ImmutableStringBuilder(1) means 1 char usable payload and \0. This this should fit appendDecimal(1) but did not. Fix the off by one error calling snprintf. Also: * removes const & from uint32_t argument * removes const & from operator<<, to stay consistent * Removes a redundant static_cast * Implements operator<< const char* with potentially better operator<<(const ImmutableString&) (may get compile time strlen) Fixed: angleproject:8567 Change-Id: Ibfff59f6846add0498d06e963266e50ec19baf80 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5332381 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Tobin Ehlis 5546fb4f 2019-01-17T12:25:54 Vulkan:Adding custom pool allocator Migrated pool allocator used by compiler to common. Planning to use this for ANGLE custom command buffers so this some refactoring in preparation for that work. Added a unit test to check PoolAllocator functionality. Bug: angleproject:2951 Reviewed-on: https://chromium-review.googlesource.com/c/1476953 Reviewed-by: Jamie Madill <jmadill@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tobin Ehlis <tobine@google.com> Change-Id: I0b4f3d55ea1799e35c9799c221f7129233f30b24 Reviewed-on: https://chromium-review.googlesource.com/c/1492972
Yuly Novikov 0546b538 2019-02-25T22:47:17 Revert "Vulkan:Adding custom pool allocator" This reverts commit 941717496141b96f1d5817f31c2bb4a4e19847b9. Reason for revert: crashes on Debug bots Original change's description: > Vulkan:Adding custom pool allocator > > Migrated pool allocator used by compiler to common. > > Planning to use this for ANGLE custom command buffers so this some > refactoring in preparation for that work. > > Added a unit test to check PoolAllocator functionality. > > Bug: angleproject:2951 > Change-Id: I29618cfdb065b8a5fefd40719a35d27b1f6e99ef > Reviewed-on: https://chromium-review.googlesource.com/c/1476953 > Reviewed-by: Jamie Madill <jmadill@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Tobin Ehlis <tobine@google.com> TBR=ynovikov@chromium.org,jmadill@google.com,tobine@google.com,syoussefi@chromium.org Change-Id: Id8c522bd1d94154e871211d975e801a55cc9c257 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:2951, angleproject:3169 Reviewed-on: https://chromium-review.googlesource.com/c/1487977 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Tobin Ehlis 94171749 2019-01-17T12:25:54 Vulkan:Adding custom pool allocator Migrated pool allocator used by compiler to common. Planning to use this for ANGLE custom command buffers so this some refactoring in preparation for that work. Added a unit test to check PoolAllocator functionality. Bug: angleproject:2951 Change-Id: I29618cfdb065b8a5fefd40719a35d27b1f6e99ef Reviewed-on: https://chromium-review.googlesource.com/c/1476953 Reviewed-by: Jamie Madill <jmadill@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tobin Ehlis <tobine@google.com>
Tobin Ehlis 47ca1b2f 2019-01-23T16:11:41 Revert "Vulkan: Adding custom pool allocator" This reverts commit 05459e06fde5047ae8f5f90fe091c3255e6bc88e. Reason for revert: Clusterfuzz bugs flagged this commit Original change's description: > Vulkan: Adding custom pool allocator > > Copied pool allocator used by compiler to common and hooking it up as > custom allocator for CommandPools. Modified it to support reallocation. > > RendererVk now has a private poolAllocator and VkAllocationCallbacks > struct. The allocation callbacks are initialized to static functions > in RendererVk::initializeDevice() and then passed to CommandPool init() > and destroy() functions. > > Using the pool allocator saves Command Pool/Buffer clean-up time which > was showing us as a bottleneck is some cases. > > Bug: angleproject:2951 > Change-Id: I81aa8a7ec60397676fa722d6435029db27947ef4 > Reviewed-on: https://chromium-review.googlesource.com/c/1409867 > Commit-Queue: Tobin Ehlis <tobine@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=jmadill@chromium.org,tobine@google.com,ianelliott@google.com,syoussefi@chromium.org Change-Id: I363a351667c4dddef79833061790da90de477e70 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:2951 Reviewed-on: https://chromium-review.googlesource.com/c/1430679 Reviewed-by: Tobin Ehlis <tobine@google.com> Commit-Queue: Tobin Ehlis <tobine@google.com>
Tobin Ehlis 05459e06 2019-01-17T12:25:54 Vulkan: Adding custom pool allocator Copied pool allocator used by compiler to common and hooking it up as custom allocator for CommandPools. Modified it to support reallocation. RendererVk now has a private poolAllocator and VkAllocationCallbacks struct. The allocation callbacks are initialized to static functions in RendererVk::initializeDevice() and then passed to CommandPool init() and destroy() functions. Using the pool allocator saves Command Pool/Buffer clean-up time which was showing us as a bottleneck is some cases. Bug: angleproject:2951 Change-Id: I81aa8a7ec60397676fa722d6435029db27947ef4 Reviewed-on: https://chromium-review.googlesource.com/c/1409867 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 5ae64c94 2018-04-06T11:27:03 Fix writing hex values in ImmutableStringBuilder The old code was accidentally using letters offset by 10 when writing out hex values >= 10. Now the letters a to f are used as they should. This is one issue that changed shader output when ImmutableString was introduced, so it is a potential cause for a regression detailed in bug 824062, though this has not been verified. BUG=chromium:824062 TEST=angle_unittests Change-Id: Idb871dffba32a3ab20df0fe17b4b1a98ec00b7fa Reviewed-on: https://chromium-review.googlesource.com/999480 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>