[Lldb-commits] [lldb] [lldb][test] Add semicolon to @import expressions (PR #189075)

via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 27 11:01:06 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Dave Lee (kastiglione)

<details>
<summary>Changes</summary>



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


8 Files Affected:

- (modified) lldb/test/API/commands/expression/diagnostics/TestExprDiagnostics.py (+1-1) 
- (modified) lldb/test/API/commands/expression/weak_symbols/TestWeakSymbols.py (+1-1) 
- (modified) lldb/test/API/commands/target/dump-pcm-info/TestDumpPCMInfo.py (+1-1) 
- (modified) lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py (+1-1) 
- (modified) lldb/test/API/lang/cpp/modules-import/TestCXXModulesImport.py (+3-3) 
- (modified) lldb/test/API/lang/objc/modules-cache/TestClangModulesCache.py (+1-1) 
- (modified) lldb/test/API/lang/objc/modules-non-objc-target/TestObjCModulesNonObjCTarget.py (+1-1) 
- (modified) lldb/test/API/lang/objc/modules-objc-property/TestModulesObjCProperty.py (+1-1) 


``````````diff
diff --git a/lldb/test/API/commands/expression/diagnostics/TestExprDiagnostics.py b/lldb/test/API/commands/expression/diagnostics/TestExprDiagnostics.py
index 1f87a6918bb21..2a5f11ded592e 100644
--- a/lldb/test/API/commands/expression/diagnostics/TestExprDiagnostics.py
+++ b/lldb/test/API/commands/expression/diagnostics/TestExprDiagnostics.py
@@ -172,7 +172,7 @@ def test_source_locations_from_objc_modules(self):
 
         # Import foundation so that the Obj-C module is loaded (which contains source locations
         # that can be used by LLDB).
-        self.runCmd("expr --language objective-c++ -- @import Foundation")
+        self.runCmd("expr --language objective-c++ -- @import Foundation;")
         value = frame.EvaluateExpression("NSLog(1);")
         self.assertFalse(value.GetError().Success())
         # LLDB should print the source line that defines NSLog. To not rely on any
diff --git a/lldb/test/API/commands/expression/weak_symbols/TestWeakSymbols.py b/lldb/test/API/commands/expression/weak_symbols/TestWeakSymbols.py
index 4783dd98aa829..aa1d49b7b9355 100644
--- a/lldb/test/API/commands/expression/weak_symbols/TestWeakSymbols.py
+++ b/lldb/test/API/commands/expression/weak_symbols/TestWeakSymbols.py
@@ -75,7 +75,7 @@ def do_test(self):
         self.assertTrue(self.frame.IsValid(), "Got a good frame")
         options = lldb.SBExpressionOptions()
         options.SetLanguage(lldb.eLanguageTypeObjC)
-        result = self.frame.EvaluateExpression("@import Dylib", options)
+        result = self.frame.EvaluateExpression("@import Dylib;", options)
 
         # Now run an expression that references an absent weak symbol:
         self.run_weak_var_check("absent_weak_int", False)
diff --git a/lldb/test/API/commands/target/dump-pcm-info/TestDumpPCMInfo.py b/lldb/test/API/commands/target/dump-pcm-info/TestDumpPCMInfo.py
index e00ed4aa90ff1..e8234331bd584 100644
--- a/lldb/test/API/commands/target/dump-pcm-info/TestDumpPCMInfo.py
+++ b/lldb/test/API/commands/target/dump-pcm-info/TestDumpPCMInfo.py
@@ -26,7 +26,7 @@ def test(self):
         self.runCmd(f"settings set symbols.clang-modules-cache-path '{mod_cache}'")
 
         # Cause lldb to generate a Darwin-*.pcm
-        self.runCmd("expression @import Darwin")
+        self.runCmd("expression @import Darwin;")
 
         # root/<config-hash>/<module-name>-<modulemap-path-hash>.pcm
         pcm_paths = glob.glob(os.path.join(mod_cache, "*", "Darwin-*.pcm"))
diff --git a/lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py b/lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py
index 228f676aedf6a..7b041e89cd3a9 100644
--- a/lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py
+++ b/lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py
@@ -38,7 +38,7 @@ def test_clang_module_build_progress_report(self):
         )
 
         # Trigger module builds.
-        self.expect("expression @import MyModule")
+        self.expect("expression @import MyModule;")
 
         event = lldbutil.fetch_next_event(self, listener, broadcaster)
         payload = lldb.SBDebugger.GetProgressFromEvent(event)
diff --git a/lldb/test/API/lang/cpp/modules-import/TestCXXModulesImport.py b/lldb/test/API/lang/cpp/modules-import/TestCXXModulesImport.py
index 040d44eb8bdcb..65fa466ca325f 100644
--- a/lldb/test/API/lang/cpp/modules-import/TestCXXModulesImport.py
+++ b/lldb/test/API/lang/cpp/modules-import/TestCXXModulesImport.py
@@ -28,10 +28,10 @@ def test_expr(self):
             self, "break here", lldb.SBFileSpec("main.cpp")
         )
 
-        self.expect("expr -l Objective-C++ -- @import Bar")
+        self.expect("expr -l Objective-C++ -- @import Bar;")
         self.expect("expr -- Bar()", substrs=["success"])
         self.expect(
-            "expr -l Objective-C++ -- @import THIS_MODULE_DOES_NOT_EXIST", error=True
+            "expr -l Objective-C++ -- @import THIS_MODULE_DOES_NOT_EXIST;", error=True
         )
 
     @skipUnlessDarwin
@@ -44,4 +44,4 @@ def test_expr_failing_import(self):
             self, "break here", lldb.SBFileSpec("main.cpp")
         )
 
-        self.expect("expr -l Objective-C++ -- @import Bar", error=True)
+        self.expect("expr -l Objective-C++ -- @import Bar;", error=True)
diff --git a/lldb/test/API/lang/objc/modules-cache/TestClangModulesCache.py b/lldb/test/API/lang/objc/modules-cache/TestClangModulesCache.py
index 6ba46fef67526..fb031d091c2dc 100644
--- a/lldb/test/API/lang/objc/modules-cache/TestClangModulesCache.py
+++ b/lldb/test/API/lang/objc/modules-cache/TestClangModulesCache.py
@@ -28,5 +28,5 @@ def test_expr(self):
         (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
             self, "Set breakpoint here", self.main_source_file
         )
-        self.runCmd("expr @import Foo")
+        self.runCmd("expr @import Foo;")
         self.assertTrue(os.path.isdir(mod_cache), "module cache exists")
diff --git a/lldb/test/API/lang/objc/modules-non-objc-target/TestObjCModulesNonObjCTarget.py b/lldb/test/API/lang/objc/modules-non-objc-target/TestObjCModulesNonObjCTarget.py
index 7e6728ca78d15..3174f1b39ff14 100644
--- a/lldb/test/API/lang/objc/modules-non-objc-target/TestObjCModulesNonObjCTarget.py
+++ b/lldb/test/API/lang/objc/modules-non-objc-target/TestObjCModulesNonObjCTarget.py
@@ -16,7 +16,7 @@ def test(self):
         )
 
         # Import foundation to get some ObjC types.
-        self.expect("expr --lang objc -- @import Foundation")
+        self.expect("expr --lang objc -- @import Foundation;")
         # Do something with NSString (which requires special handling when
         # preparing to run in the target). The expression most likely can't
         # be prepared to run in the target but it should at least not crash LLDB.
diff --git a/lldb/test/API/lang/objc/modules-objc-property/TestModulesObjCProperty.py b/lldb/test/API/lang/objc/modules-objc-property/TestModulesObjCProperty.py
index 657a7103ee989..e1cd28d2afda6 100644
--- a/lldb/test/API/lang/objc/modules-objc-property/TestModulesObjCProperty.py
+++ b/lldb/test/API/lang/objc/modules-objc-property/TestModulesObjCProperty.py
@@ -20,6 +20,6 @@ def test_conflicting_properties(self):
             + '"'
         )
 
-        self.runCmd("expr @import myModule")
+        self.runCmd("expr @import myModule;")
         self.expect_expr("m.propConflict", result_value="5")
         self.expect_expr("MyClass.propConflict", result_value="6")

``````````

</details>


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


More information about the lldb-commits mailing list