Commit e03585e
committed
[lldb] Re-use clang's keyword enable/disable mechanism in CPlusPlusNameParser.cpp
The problem is that CPlusPlusNameParser doesn't respect the language dialect
for `target variable Class::constant`. If `constant` is a keyword in some
(downstream in this case) dialects then it lexes `constant` as `kw_constant`
instead of `kw_raw_identifier` even if that dialect is not active. As a
result:
* `target variable constant` works
* `target variable Class::constant` fails to look up constant because it sees
`kw_raw_identifier, kw_coloncolon, kw_constant` instead of
`kw_raw_identifier, kw_coloncolon, kw_raw_identifier`
* `expr -l c++ -- Class::constant` works because clang is parsing it
Note: There's seemingly a separate bug where GetLangOptions() does not account
for the process/frame language and just uses a pre-defined set of language
options. I have not attempted to fix that since, for now, at least
hardcoding my dialect to be disabled by that function does the
right thing for existing tests.
Also fixed a trivial return-after-else that clangd pointed out in the same
area1 parent 7af1e87 commit e03585e
File tree
1 file changed
+13
-7
lines changed- lldb/source/Plugins/Language/CPlusPlus
1 file changed
+13
-7
lines changedLines changed: 13 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
719 | 719 | | |
720 | 720 | | |
721 | 721 | | |
722 | | - | |
723 | | - | |
724 | 722 | | |
| 723 | + | |
725 | 724 | | |
726 | 725 | | |
727 | 726 | | |
| |||
755 | 754 | | |
756 | 755 | | |
757 | 756 | | |
758 | | - | |
759 | | - | |
760 | | - | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
761 | 768 | | |
762 | 769 | | |
763 | | - | |
764 | 770 | | |
765 | 771 | | |
766 | 772 | | |
| |||
769 | 775 | | |
770 | 776 | | |
771 | 777 | | |
772 | | - | |
| 778 | + | |
773 | 779 | | |
774 | 780 | | |
775 | 781 | | |
| |||
0 commit comments