[Lldb-commits] [lldb] e0053bc - [lldb] Bump SWIG minimum version to 4

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 4 14:34:21 PDT 2023


Author: Jonas Devlieghere
Date: 2023-08-04T14:34:01-07:00
New Revision: e0053bc04e6b80ece8b334b268c2942e012009b9

URL: https://github.com/llvm/llvm-project/commit/e0053bc04e6b80ece8b334b268c2942e012009b9
DIFF: https://github.com/llvm/llvm-project/commit/e0053bc04e6b80ece8b334b268c2942e012009b9.diff

LOG: [lldb] Bump SWIG minimum version to 4

SWIG 4 was released in 2019 and has been the de-facto standard for a
while now. All bots are running SWIG 4.0 or later.

This was motivated by #64279 which discovered that 662548c broke the
LLDB build with SWIG 3 on Windows.

Differential revision: https://reviews.llvm.org/D156804

Added: 
    

Modified: 
    lldb/bindings/python/python.swig
    lldb/cmake/modules/FindLuaAndSwig.cmake
    lldb/cmake/modules/FindPythonAndSwig.cmake
    lldb/cmake/modules/LLDBConfig.cmake
    lldb/docs/resources/build.rst
    lldb/test/API/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
    lldb/test/API/python_api/lldbutil/TestSwigVersion.py
    lldb/test/API/python_api/module_section/TestModuleAndSection.py
    lldb/test/API/python_api/value/linked_list/TestValueAPILinkedList.py

Removed: 
    


################################################################################
diff  --git a/lldb/bindings/python/python.swig b/lldb/bindings/python/python.swig
index b1f6c4b9301da0..278c0eed2bab27 100644
--- a/lldb/bindings/python/python.swig
+++ b/lldb/bindings/python/python.swig
@@ -52,10 +52,6 @@ except ImportError:
     # Relative import should work if we are being loaded by Python.
     from . import $module"
 %enddef
-// These versions will not generate working python modules, so error out early.
-#if SWIG_VERSION >= 0x030009 && SWIG_VERSION < 0x030011
-#error Swig versions 3.0.9 and 3.0.10 are incompatible with lldb.
-#endif
 
 // The name of the module to be created.
 %module(docstring=DOCSTRING, moduleimport=MODULEIMPORT) lldb

diff  --git a/lldb/cmake/modules/FindLuaAndSwig.cmake b/lldb/cmake/modules/FindLuaAndSwig.cmake
index 763bf0a7bb9938..11548b76f843f0 100644
--- a/lldb/cmake/modules/FindLuaAndSwig.cmake
+++ b/lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -15,7 +15,7 @@ else()
         LUA_INCLUDE_DIR)
     endif()
   else()
-    message(STATUS "SWIG 3 or later is required for Lua support in LLDB but could not be found")
+    message(STATUS "SWIG 4 or later is required for Lua support in LLDB but could not be found")
   endif()
 
 

diff  --git a/lldb/cmake/modules/FindPythonAndSwig.cmake b/lldb/cmake/modules/FindPythonAndSwig.cmake
index d9305ab31f2258..d62cced0d095e9 100644
--- a/lldb/cmake/modules/FindPythonAndSwig.cmake
+++ b/lldb/cmake/modules/FindPythonAndSwig.cmake
@@ -40,7 +40,7 @@ else()
   if (LLDB_ENABLE_SWIG)
     FindPython3()
   else()
-    message(STATUS "SWIG 3 or later is required for Python support in LLDB but could not be found")
+    message(STATUS "SWIG 4 or later is required for Python support in LLDB but could not be found")
   endif()
 
   get_property(MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)

diff  --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index ca64ba798eda2d..19283b3cbb0194 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -50,7 +50,7 @@ macro(add_optional_dependency variable description package found)
   message(STATUS "${description}: ${${variable}}")
 endmacro()
 
-add_optional_dependency(LLDB_ENABLE_SWIG "Enable SWIG to generate LLDB bindings" SWIG SWIG_FOUND VERSION 3)
+add_optional_dependency(LLDB_ENABLE_SWIG "Enable SWIG to generate LLDB bindings" SWIG SWIG_FOUND VERSION 4)
 add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" LibEdit LibEdit_FOUND)
 add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support in LLDB" CursesAndPanel CURSESANDPANEL_FOUND)
 add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA compression support in LLDB" LibLZMA LIBLZMA_FOUND)

diff  --git a/lldb/docs/resources/build.rst b/lldb/docs/resources/build.rst
index fdbb4d8a005a16..d4f7a558f87953 100644
--- a/lldb/docs/resources/build.rst
+++ b/lldb/docs/resources/build.rst
@@ -34,7 +34,7 @@ If you want to run the test suite, you'll need to build LLDB with Python
 scripting support.
 
 * `Python <http://www.python.org/>`_
-* `SWIG <http://swig.org/>`_ 3 or later.
+* `SWIG <http://swig.org/>`_ 4 or later.
 
 Optional Dependencies
 *********************

diff  --git a/lldb/test/API/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/lldb/test/API/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
index d56c5b01d5f295..ec5b4da0f29b26 100644
--- a/lldb/test/API/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
+++ b/lldb/test/API/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
@@ -117,8 +117,6 @@ def test_SBDebugger(self):
 
         sb_debugger.fuzz_obj(obj)
 
-    # darwin: This test passes with swig 3.0.2, fails w/3.0.5 other tests fail
-    # with 2.0.12 http://llvm.org/pr23488
     def test_SBError(self):
         obj = lldb.SBError()
         if self.TraceOn():
@@ -225,9 +223,6 @@ def test_SBListener(self):
 
         sb_listener.fuzz_obj(obj)
 
-    # Py3 asserts due to a bug in SWIG.  Trying to upstream a patch to fix
-    # this in 3.0.8
-    @skipIf(py_version=[">=", (3, 0)], swig_version=["<", (3, 0, 8)])
     def test_SBModule(self):
         obj = lldb.SBModule()
         if self.TraceOn():

diff  --git a/lldb/test/API/python_api/lldbutil/TestSwigVersion.py b/lldb/test/API/python_api/lldbutil/TestSwigVersion.py
index d8fa83b98e1ec4..190f78955b7c88 100644
--- a/lldb/test/API/python_api/lldbutil/TestSwigVersion.py
+++ b/lldb/test/API/python_api/lldbutil/TestSwigVersion.py
@@ -21,6 +21,6 @@ def test(self):
         self.assertTrue(getattr(lldb, "swig_version"))
         self.assertIsInstance(lldb.swig_version, tuple)
         self.assertEqual(len(lldb.swig_version), 3)
-        self.assertGreaterEqual(lldb.swig_version[0], 1)
+        self.assertGreaterEqual(lldb.swig_version[0], 4)
         for v in lldb.swig_version:
             self.assertGreaterEqual(v, 0)

diff  --git a/lldb/test/API/python_api/module_section/TestModuleAndSection.py b/lldb/test/API/python_api/module_section/TestModuleAndSection.py
index 1e30a2850a86b7..8a83740b06732c 100644
--- a/lldb/test/API/python_api/module_section/TestModuleAndSection.py
+++ b/lldb/test/API/python_api/module_section/TestModuleAndSection.py
@@ -10,9 +10,6 @@
 
 
 class ModuleAndSectionAPIsTestCase(TestBase):
-    # Py3 asserts due to a bug in SWIG.  A fix for this was upstreamed into
-    # SWIG 3.0.8.
-    @skipIf(py_version=[">=", (3, 0)], swig_version=["<", (3, 0, 8)])
     def test_module_and_section(self):
         """Test module and section APIs."""
         self.build()

diff  --git a/lldb/test/API/python_api/value/linked_list/TestValueAPILinkedList.py b/lldb/test/API/python_api/value/linked_list/TestValueAPILinkedList.py
index 2acba76be28c25..2053583c04475e 100644
--- a/lldb/test/API/python_api/value/linked_list/TestValueAPILinkedList.py
+++ b/lldb/test/API/python_api/value/linked_list/TestValueAPILinkedList.py
@@ -20,9 +20,6 @@ def setUp(self):
         # Find the line number to break at.
         self.line = line_number("main.cpp", "// Break at this line")
 
-    # Py3 asserts due to a bug in SWIG.  A fix for this was upstreamed into
-    # SWIG 3.0.8.
-    @skipIf(py_version=[">=", (3, 0)], swig_version=["<", (3, 0, 8)])
     def test(self):
         """Exercise SBValue API linked_list_iter."""
         d = {"EXE": self.exe_name}


        


More information about the lldb-commits mailing list