Commit graph

10 commits

Author SHA1 Message Date
Timothy Flynn
2803d66d87 AK: Support UTF-16 string formatting
The underlying storage used during string formatting is StringBuilder.
To support UTF-16 strings, this patch allows callers to specify a mode
during StringBuilder construction. The default mode is UTF-8, for which
StringBuilder remains unchanged.

In UTF-16 mode, we treat the StringBuilder's internal ByteBuffer as a
series of u16 code units. Appending a single character will append 2
bytes for that character (cast to a char16_t). Appending a StringView
will transcode the string to UTF-16.

Utf16String also gains the same memory optimization that we added for
String, where we hand-off the underlying buffer to Utf16String to avoid
having to re-allocate.

In the future, we may want to further optimize for ASCII strings. For
example, we could defer committing to the u16-esque storage until we
see a non-ASCII code point.
2025-07-18 12:45:38 -04:00
Andrew Kaster
27503a5320 Tests: Invoke clang frontend instead of cc1 in ClangPlugin tests
Reverts 7fcedae610 at the same time
2025-05-12 16:00:55 -04:00
Jonne Ransijn
7fcedae610 Tests: Fix missing argument removed by -cc1
This argument is removed (or rather, never added) by `-cc1`, which
breaks any builds using GNU libc++, including CI.
2025-04-22 21:19:31 -06:00
Timothy Flynn
f52bb43673 ClangPlugins: Add -Wno-unqualified-std-cast-call to test compile options
We globally export std::move and std::forward in StdLibExtraDetails.h.
2024-08-26 17:24:53 -04:00
Andrew Kaster
15d60779a9 Tests: Update ClangPlugins tests for current clang version
Something is up with the plugin option and the current version of lit,
so XFAIL the test for that for now.
2024-07-25 18:35:57 -06:00
Matthew Olsson
5740f93ef4 ClangPlugins: Check for strong root fields in GC allocated objects
GC-allocated objects should never have JS::SafeFunction/JS::Handle
fields.

For now the plugin only emits warnings here, as there are many cases
of this occurring in the codebase that aren't trivial to fix. It is also
behind a CMake flag since it is a _very_ loud warning.
2024-05-30 09:29:20 -06:00
Matthew Olsson
c739ae3e02 ClangPlugins: Change name of variable used for test compile options
This makes it more clear what it is used for
2024-05-30 09:29:20 -06:00
Matthew Olsson
573bbd47ee Tests: Update ClangPlugins to use C++23 when running Clang 2024-05-22 21:55:34 -06:00
Andrew Kaster
d51c96d56d CMake: Export targets for Clang Plugins so they can be used by Serenity 2024-05-14 12:46:05 -06:00
Matthew Olsson
46ee2b5f06 ClangPlugins: Add LLVM lit test suite 2024-05-13 16:50:54 -06:00