[clang] [Format] Do not crash on non-null terminated strings (PR #131299)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 21 17:28:42 PDT 2025


================
@@ -29096,6 +29096,17 @@ TEST_F(FormatTest, BreakBeforeClassName) {
                "    ArenaSafeUniquePtr {};");
 }
 
+TEST_F(FormatTest, DoesNotCrashOnNonNullTerminatedStringRefs) {
+  llvm::StringRef TwoLines = "namespace foo {}\n"
+                             "namespace bar {}";
+  llvm::StringRef FirstLine =
----------------
owenca wrote:

Ditto

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


More information about the cfe-commits mailing list