diff options
author | Michael Buch <michaelbuch12@gmail.com> | 2023-04-14 17:01:49 +0100 |
---|---|---|
committer | Michael Buch <michaelbuch12@gmail.com> | 2023-04-14 17:10:18 +0100 |
commit | 89cd0e8c267f57004a734c94ff15c6bd0facf646 (patch) | |
tree | 9e2ef7ce69f54961ea5d4157a07ee349b0a07402 /lldb/unittests | |
parent | 0301a492f43efc3a2c1fa1bddd16e46aac8ab77e (diff) | |
download | llvm-89cd0e8c267f57004a734c94ff15c6bd0facf646.tar.gz |
[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.
Diffstat (limited to 'lldb/unittests')
-rw-r--r-- | lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp b/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp index 6c85ed159df5..cfdc3163f6a3 100644 --- a/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp +++ b/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp @@ -205,7 +205,11 @@ TEST(CPlusPlusLanguage, MethodNameParsing) { {"auto Foo[abi:abc]<int>::operator<<<Foo[abi:abc]<int>>(int) &", "auto", "Foo[abi:abc]<int>", "operator<<<Foo[abi:abc]<int>>", "(int)", "&", - "Foo[abi:abc]<int>::operator<<<Foo[abi:abc]<int>>"}}; + "Foo[abi:abc]<int>::operator<<<Foo[abi:abc]<int>>"}, + + {"auto A::operator<=>[abi:tag]<A::B>()", "auto", "A", + "operator<=>[abi:tag]<A::B>", "()", "", + "A::operator<=>[abi:tag]<A::B>"}}; for (const auto &test : test_cases) { CPlusPlusLanguage::MethodName method(ConstString(test.input)); @@ -227,7 +231,6 @@ TEST(CPlusPlusLanguage, InvalidMethodNameParsing) { std::string test_cases[] = { "int Foo::operator[]<[10>()", "Foo::operator bool[10]()", - "auto A::operator<=>[abi:tag]<A::B>()", "auto A::operator<<<(int)", "auto A::operator>>>(int)", "auto A::operator<<<Type[abi:tag]<>(int)", @@ -356,10 +359,9 @@ TEST(CPlusPlusLanguage, ExtractContextAndIdentifier) { EXPECT_FALSE(CPlusPlusLanguage::ExtractContextAndIdentifier( "f<A<B><C>>", context, basename)); - // We expect these cases to fail until we turn on C++2a - EXPECT_FALSE(CPlusPlusLanguage::ExtractContextAndIdentifier( + EXPECT_TRUE(CPlusPlusLanguage::ExtractContextAndIdentifier( "A::operator<=><A::B>", context, basename)); - EXPECT_FALSE(CPlusPlusLanguage::ExtractContextAndIdentifier( + EXPECT_TRUE(CPlusPlusLanguage::ExtractContextAndIdentifier( "operator<=><A::B>", context, basename)); } |