[libcxx-commits] [libcxx] [libc++] Optimize ofstream::write (PR #123337)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 19 23:56:03 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 4c4fc4650fa66361f19f8c8b60768987fe48a90f 11bc68bcfc4a530345ccc46660d7f5bc5c598d82 --extensions ,cpp -- libcxx/test/benchmarks/streams/ofstream.bench.cpp libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/sputn_not_open.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/sputn_seekoff.pass.cpp libcxx/include/fstream libcxx/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.verify.cpp libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.verify.cpp libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/sputn_not_open.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/sputn_not_open.pass.cpp
index 257f00d0cb..32af472cb8 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/sputn_not_open.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/sputn_not_open.pass.cpp
@@ -15,27 +15,27 @@
 #include <vector>
 
 void sputn_not_open() {
-    std::vector<char> data(10, 'a');
-    std::filebuf f;
-    std::streamsize len = f.sputn(data.data(), data.size());
-    assert(len == 0);
-    assert(std::strncmp(data.data(), "aaaaaaaaaa", 10) == 0);
+  std::vector<char> data(10, 'a');
+  std::filebuf f;
+  std::streamsize len = f.sputn(data.data(), data.size());
+  assert(len == 0);
+  assert(std::strncmp(data.data(), "aaaaaaaaaa", 10) == 0);
 }
 
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
 void sputn_not_open_wchar() {
-    std::vector<wchar_t> data(10, L'a');
-    std::wfilebuf f;
-    std::streamsize len = f.sputn(data.data(), data.size());
-    assert(len == 0);
-    assert(std::wcsncmp(data.data(), L"aaaaaaaaaa", 10) == 0);
+  std::vector<wchar_t> data(10, L'a');
+  std::wfilebuf f;
+  std::streamsize len = f.sputn(data.data(), data.size());
+  assert(len == 0);
+  assert(std::wcsncmp(data.data(), L"aaaaaaaaaa", 10) == 0);
 }
 #endif
 
-int main(int, char **) {
-    sputn_not_open();
+int main(int, char**) {
+  sputn_not_open();
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
-    sputn_not_open_wchar();
+  sputn_not_open_wchar();
 #endif
-    return 0;
+  return 0;
 }
\ No newline at end of file

``````````

</details>


https://github.com/llvm/llvm-project/pull/123337


More information about the libcxx-commits mailing list