https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/84890
>From ecb8e2744628207dd0ec72272428e3f57e8d68bb Mon Sep 17 00:00:00 2001 From: Michael Buch <michaelbuc...@gmail.com> Date: Tue, 12 Mar 2024 10:04:12 +0000 Subject: [PATCH 1/3] [lldb][test] TestExprCompletion.py: add tests for completion of reserved identifiers --- .../expression/completion/TestExprCompletion.py | 14 ++++++++++++++ .../API/commands/expression/completion/main.cpp | 11 +++++++++++ 2 files changed, 25 insertions(+) diff --git a/lldb/test/API/commands/expression/completion/TestExprCompletion.py b/lldb/test/API/commands/expression/completion/TestExprCompletion.py index c6a1e3c0f42275..d322b9c323d1ef 100644 --- a/lldb/test/API/commands/expression/completion/TestExprCompletion.py +++ b/lldb/test/API/commands/expression/completion/TestExprCompletion.py @@ -246,6 +246,20 @@ def test_expr_completion(self): "expr some_expr.Self(). FooNoArgs", "expr some_expr.Self(). FooNoArgsBar()" ) + self.complete_from_to( + "expr myVec.__f", "expr myVec.__func()" + ) + self.complete_from_to( + "expr myVec._F", "expr myVec._Func()" + ) + self.complete_from_to( + "expr myVec.__m", "expr myVec.__mem" + ) + self.complete_from_to( + "expr myVec._M", "expr myVec._Mem" + ) + + def test_expr_completion_with_descriptions(self): self.build() self.main_source = "main.cpp" diff --git a/lldb/test/API/commands/expression/completion/main.cpp b/lldb/test/API/commands/expression/completion/main.cpp index 908bebbebff568..b87f9626c93283 100644 --- a/lldb/test/API/commands/expression/completion/main.cpp +++ b/lldb/test/API/commands/expression/completion/main.cpp @@ -1,3 +1,11 @@ +class MyVec { + int __mem; + int _Mem; +public: + void __func() {} + void _Func() {} +}; + namespace LongNamespaceName { class NestedClass { long m; }; } // Defined in other.cpp, we only have a forward declaration here. @@ -31,5 +39,8 @@ int main() some_expr.FooNumbersBar1(); Expr::StaticMemberMethodBar(); ForwardDecl *fwd_decl_ptr = &fwd_decl; + MyVec myVec; + myVec.__func(); + myVec._Func(); return 0; // Break here } >From 68364e2c6e20fbe6b57672d2cb4f07d6fcf3f34e Mon Sep 17 00:00:00 2001 From: Michael Buch <michaelbuc...@gmail.com> Date: Tue, 12 Mar 2024 10:11:59 +0000 Subject: [PATCH 2/3] fixup! python format --- .../expression/completion/TestExprCompletion.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/lldb/test/API/commands/expression/completion/TestExprCompletion.py b/lldb/test/API/commands/expression/completion/TestExprCompletion.py index d322b9c323d1ef..022b9436ee8ea6 100644 --- a/lldb/test/API/commands/expression/completion/TestExprCompletion.py +++ b/lldb/test/API/commands/expression/completion/TestExprCompletion.py @@ -246,19 +246,10 @@ def test_expr_completion(self): "expr some_expr.Self(). FooNoArgs", "expr some_expr.Self(). FooNoArgsBar()" ) - self.complete_from_to( - "expr myVec.__f", "expr myVec.__func()" - ) - self.complete_from_to( - "expr myVec._F", "expr myVec._Func()" - ) - self.complete_from_to( - "expr myVec.__m", "expr myVec.__mem" - ) - self.complete_from_to( - "expr myVec._M", "expr myVec._Mem" - ) - + self.complete_from_to("expr myVec.__f", "expr myVec.__func()") + self.complete_from_to("expr myVec._F", "expr myVec._Func()") + self.complete_from_to("expr myVec.__m", "expr myVec.__mem") + self.complete_from_to("expr myVec._M", "expr myVec._Mem") def test_expr_completion_with_descriptions(self): self.build() >From 2961ca8068b2a90999e694ce40f53da80684e5b7 Mon Sep 17 00:00:00 2001 From: Michael Buch <michaelbuc...@gmail.com> Date: Tue, 12 Mar 2024 10:21:20 +0000 Subject: [PATCH 3/3] fixup! move type into header --- lldb/test/API/commands/expression/completion/Makefile | 1 + lldb/test/API/commands/expression/completion/main.cpp | 8 +------- .../API/commands/expression/completion/sys/reserved.h | 7 +++++++ 3 files changed, 9 insertions(+), 7 deletions(-) create mode 100644 lldb/test/API/commands/expression/completion/sys/reserved.h diff --git a/lldb/test/API/commands/expression/completion/Makefile b/lldb/test/API/commands/expression/completion/Makefile index 020dce7c31d11d..9882622b2189ea 100644 --- a/lldb/test/API/commands/expression/completion/Makefile +++ b/lldb/test/API/commands/expression/completion/Makefile @@ -1,3 +1,4 @@ CXX_SOURCES := main.cpp other.cpp +CXXFLAGS += -isystem $(SRCDIR)/sys include Makefile.rules diff --git a/lldb/test/API/commands/expression/completion/main.cpp b/lldb/test/API/commands/expression/completion/main.cpp index b87f9626c93283..5e03805a7a4d5c 100644 --- a/lldb/test/API/commands/expression/completion/main.cpp +++ b/lldb/test/API/commands/expression/completion/main.cpp @@ -1,10 +1,4 @@ -class MyVec { - int __mem; - int _Mem; -public: - void __func() {} - void _Func() {} -}; +#include <reserved.h> namespace LongNamespaceName { class NestedClass { long m; }; } diff --git a/lldb/test/API/commands/expression/completion/sys/reserved.h b/lldb/test/API/commands/expression/completion/sys/reserved.h new file mode 100644 index 00000000000000..a84888b9308600 --- /dev/null +++ b/lldb/test/API/commands/expression/completion/sys/reserved.h @@ -0,0 +1,7 @@ +class MyVec { + int __mem; + int _Mem; +public: + void __func() {} + void _Func() {} +}; _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits