[Lldb-commits] [lldb] [lldb][test] TestExprCompletion.py: add tests for completion of reserved identifiers (PR #84890)

via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 12 03:06:34 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)

<details>
<summary>Changes</summary>

Depends on https://github.com/llvm/llvm-project/pull/84891

---
Full diff: https://github.com/llvm/llvm-project/pull/84890.diff


2 Files Affected:

- (modified) lldb/test/API/commands/expression/completion/TestExprCompletion.py (+14) 
- (modified) lldb/test/API/commands/expression/completion/main.cpp (+11) 


``````````diff
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
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/84890


More information about the lldb-commits mailing list