[Lldb-commits] [lldb] [lldb][NFC] Remove temp allocation SBCommandReturnObject::PutCString (PR #173365)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 5 07:29:11 PST 2026


================
@@ -315,8 +315,8 @@ void SBCommandReturnObject::PutCString(const char *string, int len) {
   if (len == 0 || string == nullptr || *string == 0) {
     return;
   } else if (len > 0) {
-    std::string buffer(string, len);
-    ref().AppendMessage(buffer.c_str());
+    const llvm::StringRef buffer{string, static_cast<size_t>(len)};
----------------
JDevlieghere wrote:

Why the braces? 

https://llvm.org/docs/CodingStandards.html#do-not-use-braced-initializer-lists-to-call-a-constructor

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


More information about the lldb-commits mailing list