labath wrote:

It's close, but it's not the same thing. Notice your arrow points into the 
error message:
```
(lldb) v externGlobalVar
error: externGlobalVar
       ˄
       ╰─ error: use of undeclared identifier 'externGlobalVar'
```

While for `expr`, it points directly into the command:
```
(lldb) expr 1.0+""
               ˄
               ╰─ error: invalid operands to binary expression ('double' and 
'const char[1]')
```

For that, you really need to return the error in a structured form. The string 
itself is needed as well, as it's used in contexts where it's impossible to 
show inline diagnostics, or because they have been disabled:
```
And if I disable inline diagnostics I, get the usual clang output:
```
(lldb) set set show-inline-diagnostics false
(lldb) expr 1.0+""
error: <user expression 1>:1:4: invalid operands to binary expression ('double' 
and 'const char[1]')
    1 | 1.0+""
      | ~~~^~~
```

For this purpose, you could use your original code, or maybe what you have now 
is fine as well.

https://github.com/llvm/llvm-project/pull/120971
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to