[libcxx-commits] [libcxx] [llvm] [libc++] Diagnose when nullptrs are passed to string APIs (PR #122790)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 16 03:26:49 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 4435b7d8d3df31d59402b6b106d8d45fd2ba0f93 b49e71872191f7d2a100a6720c8fd041a3c9f267 --extensions ,cpp -- libcxx/test/libcxx/strings/basic.string/nonnull.verify.cpp libcxx/include/__config libcxx/include/string
``````````

</details>

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

``````````diff
diff --git a/libcxx/test/libcxx/strings/basic.string/nonnull.verify.cpp b/libcxx/test/libcxx/strings/basic.string/nonnull.verify.cpp
index 5871218c1d..d61896277a 100644
--- a/libcxx/test/libcxx/strings/basic.string/nonnull.verify.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/nonnull.verify.cpp
@@ -32,10 +32,10 @@ void func() {
   str2.compare(0, 0, np);                       // expected-warning {{null passed}}
 
 #if TEST_STD_VER >= 20
-  str2.starts_with(np);                         // expected-warning {{null passed}}
-  str2.ends_with(np);                           // expected-warning {{null passed}}
+  str2.starts_with(np); // expected-warning {{null passed}}
+  str2.ends_with(np);   // expected-warning {{null passed}}
 #endif
 #if TEST_STD_VER >= 23
-  str2.contains(np);                            // expected-warning {{null passed}}
+  str2.contains(np); // expected-warning {{null passed}}
 #endif
 }

``````````

</details>


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


More information about the libcxx-commits mailing list