[Lldb-commits] [PATCH] D127922: [lldb] Introduce the concept of a log handler (NFC)

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 16 11:05:10 PDT 2022


clayborg added inline comments.


================
Comment at: lldb/source/Utility/Log.cpp:325
     std::lock_guard<std::recursive_mutex> guard(g_LogThreadedMutex);
-    *stream_sp << message;
-    stream_sp->flush();
+    handler_sp->Emit(message);
+    handler_sp->Flush();
----------------
mib wrote:
> JDevlieghere wrote:
> > clayborg wrote:
> > > Will this copy the string? The Emit() calls take a "std::string", maybe we should switch it to "const std::string &" to avoid any copies?
> > Yeah,  was planning on `std::move`-ing everything but I already found a few cases where that doesn't work. This should indeed take a reference. 
> +1
The other option is to have the Emit functions use llvm::StringRef?:
```
virtual void Emit(llvm::StringRef s) = 0;
```



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127922/new/

https://reviews.llvm.org/D127922



More information about the lldb-commits mailing list