[Lldb-commits] [PATCH] D55653: [lldb-mi] Check raw pointers before passing them to std::string ctor/assignment

Stefan Gränitz via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 19 10:29:45 PST 2019

sgraenitz added a comment.

Good initiative to fix potential nullptr assignments to `std::string`.

In D55653#1400513 <https://reviews.llvm.org/D55653#1400513>, @tatyana-krasnukha wrote:

> a caller still should examine pointers he passes to CMIUtilString::Format as the ellipsis parameter.

So `Format()` and `Printf()` don't handle `nullptr` arguments already?

In D55653#1398660 <https://reviews.llvm.org/D55653#1398660>, @JDevlieghere wrote:

> Have you considered wrapping raw strings in llvm's `StringRef`s?

+1 in general (but it may be a bigger effort)

Comment at: unittests/tools/lldb-mi/CMakeLists.txt:1
`LLDB_PROJECT_ROOT` is rarely used, maybe prefer `LLDB_SOURCE_DIR`?

Comment at: unittests/tools/lldb-mi/utils/CMakeLists.txt:3
+  ${LLDB_PROJECT_ROOT}/tools/lldb-mi/MIUtilString.cpp
+  )
Nice workaround for not having a library target at hand for linking!

Comment at: unittests/tools/lldb-mi/utils/StringTest.cpp:1
+//===-- LLGSTest.cpp --------------------------------------------*- C++ -*-===//
update name



More information about the lldb-commits mailing list