Commit 7300143
committed
[lldb][Expression] Emit a 'Note' diagnistc that indicates the language used for expression evaluation
Since it's a 'Note' diagnostic it would only show up when expression
evaluation actually failed. This helps with expression evaluation
failure reports in mixed language environments where it's not quite clear
what language the expression ran as. It may also reduce confusion around
why the expression evaluator ran an expression in a language it wasn't
asked to run (a softer alternative to what I attempted in #156648).
Here are some example outputs:
```
(lldb) expr -l c -- blah
˄
╰─ error: use of undeclared identifier 'blah'
note: Requested expression evaluation as 'c' but fell back to 'c++'.
(lldb) expr -l c++ -- blah
˄
╰─ error: use of undeclared identifier 'blah'
note: Requested expression evaluation as c++
(lldb) expr -l objc -- blah
˄
╰─ error: use of undeclared identifier 'blah'
note: Requested expression evaluation as 'objective-c' but fell back to 'objective-c++'.
(lldb) expr -l rust -- blah
˄
╰─ error: use of undeclared identifier 'blah'
note: Requested expression evaluation as rust
```
I didn't put the diagnostic on the same line as the inline diagnostic
for now because of implementation convenience, but if reviewers deem
that a blocker I can take a stab at that again.
Also, other language plugins (namely Swift), won't immediately benefit
from this and will have to emit their own diagnistc. I played around
with having a virtual API on `UserExpression` or `ExpressionParser` that
will be called consistently, but by the time we're about to parse the
expression we are already several frames deep into the plugin. Before
(and at the beginning of) the generic `UserExpression::Parse` call we
don't have enough information to notify which language we're going to
parse in (at least for the C++ plugin).
rdar://1602976491 parent a5d37d5 commit 7300143
File tree
5 files changed
+31
-9
lines changed- lldb/source/Plugins/ExpressionParser/Clang
5 files changed
+31
-9
lines changedLines changed: 25 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
527 | 528 | | |
528 | 529 | | |
529 | 530 | | |
530 | | - | |
| 531 | + | |
| 532 | + | |
531 | 533 | | |
532 | 534 | | |
533 | 535 | | |
| |||
547 | 549 | | |
548 | 550 | | |
549 | 551 | | |
| 552 | + | |
| 553 | + | |
550 | 554 | | |
551 | 555 | | |
552 | 556 | | |
| |||
560 | 564 | | |
561 | 565 | | |
562 | 566 | | |
| 567 | + | |
563 | 568 | | |
564 | 569 | | |
565 | 570 | | |
566 | 571 | | |
567 | 572 | | |
568 | 573 | | |
| 574 | + | |
569 | 575 | | |
570 | 576 | | |
571 | 577 | | |
| |||
610 | 616 | | |
611 | 617 | | |
612 | 618 | | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
613 | 634 | | |
614 | 635 | | |
615 | 636 | | |
| |||
687 | 708 | | |
688 | 709 | | |
689 | 710 | | |
690 | | - | |
691 | | - | |
| 711 | + | |
| 712 | + | |
692 | 713 | | |
693 | 714 | | |
694 | 715 | | |
| |||
754 | 775 | | |
755 | 776 | | |
756 | 777 | | |
757 | | - | |
| 778 | + | |
758 | 779 | | |
759 | 780 | | |
760 | 781 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
193 | | - | |
| 192 | + | |
| 193 | + | |
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
574 | 574 | | |
575 | 575 | | |
576 | 576 | | |
577 | | - | |
| 577 | + | |
578 | 578 | | |
579 | 579 | | |
580 | 580 | | |
| |||
818 | 818 | | |
819 | 819 | | |
820 | 820 | | |
821 | | - | |
| 821 | + | |
822 | 822 | | |
823 | 823 | | |
824 | 824 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
0 commit comments