[Lldb-commits] [PATCH] D55653: Check pointer results on nullptr before using them
Jonas Devlieghere via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Feb 14 15:05:59 PST 2019
JDevlieghere added a comment.
In the future please include context with the diff (-U9999 should do the trick), it makes reviewing a lot easier.
Have you considered wrapping raw strings in llvm's `StringRef`s? It looks like lldb-mi is already using some ADT classes from llvm.
Unfortunately we cannot use those in the SB interface, but they're a lot safer. They have a `.str()` which does the right thing and returns an empty string when the raw string is a `nullptr`. Personally I would very much prefer that over the `This.or(That)` pattern, but if you really wanted that you could have an Optional<StringRef> and do `getValueOr()` as Shafik suggested.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55653/new/
https://reviews.llvm.org/D55653
More information about the lldb-commits
mailing list