Currently one can redefine a persistent variable and LLDB will just silently ignore the second definition:
(lldb) expr int $i = 1 (lldb) expr int $i = 2 (lldb) expr $i (int) $i = 1
This patch makes this an error and rejects the expression with the second definition.
A nice follow up would be to refactor LLDB's persistent variables to not just be a pair of type and name,
but also contain some way to obtain the original declaration and source code that declared the variable.
That way we could actually make a full diagnostic as we would get from redefining a variable twice
in the same expression.
As a totally unnecessary micro-optimization, it seems like Diagnostic is taking a StringRef in it's ctor only to store it as a std::string. We should make that a std::string and then move that string into place instead of making two unnecessary copies. Of course that doesn't have to be part of this patch.