[lldb] Allow evaluating expressions in C++20 mode
authorMichael Buch <michaelbuch12@gmail.com>
Fri, 14 Apr 2023 16:01:49 +0000 (17:01 +0100)
committerMichael Buch <michaelbuch12@gmail.com>
Fri, 14 Apr 2023 16:10:18 +0000 (17:10 +0100)
commit89cd0e8c267f57004a734c94ff15c6bd0facf646
tree9e2ef7ce69f54961ea5d4157a07ee349b0a07402
parent0301a492f43efc3a2c1fa1bddd16e46aac8ab77e
[lldb] Allow evaluating expressions in C++20 mode

This patch allows users to evaluate expressions using
`expr -l c++20`. Currently DWARF keeps the CU's at
`DW_AT_language` at `DW_LANG_C_plus_plus_14` even
when compiling with `-std=c++20`. So even in "C++20
programs" expression evaluation will by default be
performed in `C++11` mode for now.

Enabling `C++14` has been previously attempted at
https://reviews.llvm.org/D80308

There are some remaining issues around evaluating C++20
expressions. Mainly, lack of support for C++20 AST nodes in
`clang::ASTImporter`. But these can be addressed in follow-up
patches.
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Target/Language.cpp
lldb/test/API/lang/cpp/standards/cpp20/Makefile [new file with mode: 0644]
lldb/test/API/lang/cpp/standards/cpp20/TestCPP20Standard.py [new file with mode: 0644]
lldb/test/API/lang/cpp/standards/cpp20/main.cpp [new file with mode: 0644]
lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp