[Lldb-commits] [lldb] 3a6da11 - [lldb/SWIG] Modulerize lldb.swig so parts of it can be reused.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 13 14:52:10 PST 2019


Author: Jonas Devlieghere
Date: 2019-12-13T14:49:44-08:00
New Revision: 3a6da1122b990386edeba0987d0d1fdc9c8dc53d

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

LOG: [lldb/SWIG] Modulerize lldb.swig so parts of it can be reused.

This groups the headers and interfaces in separate files that can be
included by other swig files for different languages.

Added: 
    lldb/scripts/headers.swig
    lldb/scripts/interfaces.swig

Modified: 
    lldb/scripts/lldb.swig

Removed: 
    


################################################################################
diff  --git a/lldb/scripts/headers.swig b/lldb/scripts/headers.swig
new file mode 100644
index 000000000000..69fd28e33c58
--- /dev/null
+++ b/lldb/scripts/headers.swig
@@ -0,0 +1,76 @@
+/* C++ headers to be included. */
+%{
+#include <algorithm>
+#include <string>
+%}
+
+/* The liblldb header files to be included. */
+%{
+#include "lldb/lldb-public.h"
+#include "lldb/API/SBAddress.h"
+#include "lldb/API/SBAttachInfo.h"
+#include "lldb/API/SBBlock.h"
+#include "lldb/API/SBBreakpoint.h"
+#include "lldb/API/SBBreakpointLocation.h"
+#include "lldb/API/SBBreakpointName.h"
+#include "lldb/API/SBBroadcaster.h"
+#include "lldb/API/SBCommandInterpreter.h"
+#include "lldb/API/SBCommandReturnObject.h"
+#include "lldb/API/SBCommunication.h"
+#include "lldb/API/SBCompileUnit.h"
+#include "lldb/API/SBData.h"
+#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBDeclaration.h"
+#include "lldb/API/SBError.h"
+#include "lldb/API/SBEvent.h"
+#include "lldb/API/SBExecutionContext.h"
+#include "lldb/API/SBExpressionOptions.h"
+#include "lldb/API/SBFileSpec.h"
+#include "lldb/API/SBFile.h"
+#include "lldb/API/SBFileSpecList.h"
+#include "lldb/API/SBFrame.h"
+#include "lldb/API/SBFunction.h"
+#include "lldb/API/SBHostOS.h"
+#include "lldb/API/SBInstruction.h"
+#include "lldb/API/SBInstructionList.h"
+#include "lldb/API/SBLanguageRuntime.h"
+#include "lldb/API/SBLaunchInfo.h"
+#include "lldb/API/SBLineEntry.h"
+#include "lldb/API/SBListener.h"
+#include "lldb/API/SBMemoryRegionInfo.h"
+#include "lldb/API/SBMemoryRegionInfoList.h"
+#include "lldb/API/SBModule.h"
+#include "lldb/API/SBModuleSpec.h"
+#include "lldb/API/SBPlatform.h"
+#include "lldb/API/SBProcess.h"
+#include "lldb/API/SBProcessInfo.h"
+#include "lldb/API/SBQueue.h"
+#include "lldb/API/SBQueueItem.h"
+#include "lldb/API/SBSection.h"
+#include "lldb/API/SBSourceManager.h"
+#include "lldb/API/SBStream.h"
+#include "lldb/API/SBStringList.h"
+#include "lldb/API/SBStructuredData.h"
+#include "lldb/API/SBSymbol.h"
+#include "lldb/API/SBSymbolContext.h"
+#include "lldb/API/SBSymbolContextList.h"
+#include "lldb/API/SBTarget.h"
+#include "lldb/API/SBThread.h"
+#include "lldb/API/SBThreadCollection.h"
+#include "lldb/API/SBThreadPlan.h"
+#include "lldb/API/SBTrace.h"
+#include "lldb/API/SBTraceOptions.h"
+#include "lldb/API/SBType.h"
+#include "lldb/API/SBTypeCategory.h"
+#include "lldb/API/SBTypeEnumMember.h"
+#include "lldb/API/SBTypeFilter.h"
+#include "lldb/API/SBTypeFormat.h"
+#include "lldb/API/SBTypeNameSpecifier.h"
+#include "lldb/API/SBTypeSummary.h"
+#include "lldb/API/SBTypeSynthetic.h"
+#include "lldb/API/SBValue.h"
+#include "lldb/API/SBValueList.h"
+#include "lldb/API/SBVariablesOptions.h"
+#include "lldb/API/SBWatchpoint.h"
+#include "lldb/API/SBUnixSignals.h"
+%}

diff  --git a/lldb/scripts/interfaces.swig b/lldb/scripts/interfaces.swig
new file mode 100644
index 000000000000..cc6bb91febda
--- /dev/null
+++ b/lldb/scripts/interfaces.swig
@@ -0,0 +1,83 @@
+/* Various liblldb typedefs that SWIG needs to know about.  */
+#define __extension__ /* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h. */
+/* The ISO C99 standard specifies that in C++ implementations limit macros such
+   as INT32_MAX should only be defined if __STDC_LIMIT_MACROS is. */
+#define __STDC_LIMIT_MACROS
+%include "stdint.i"
+
+%include "lldb/lldb-defines.h"
+%include "lldb/lldb-enumerations.h"
+%include "lldb/lldb-forward.h"
+%include "lldb/lldb-types.h"
+
+/* Forward declaration of SB classes. */
+%include "lldb/API/SBDefines.h"
+
+/* Python interface files with docstrings. */
+%include "./interface/SBAddress.i"
+%include "./interface/SBAttachInfo.i"
+%include "./interface/SBBlock.i"
+%include "./interface/SBBreakpoint.i"
+%include "./interface/SBBreakpointLocation.i"
+%include "./interface/SBBreakpointName.i"
+%include "./interface/SBBroadcaster.i"
+%include "./interface/SBCommandInterpreter.i"
+%include "./interface/SBCommandReturnObject.i"
+%include "./interface/SBCommunication.i"
+%include "./interface/SBCompileUnit.i"
+%include "./interface/SBData.i"
+%include "./interface/SBDebugger.i"
+%include "./interface/SBDeclaration.i"
+%include "./interface/SBError.i"
+%include "./interface/SBEvent.i"
+%include "./interface/SBExecutionContext.i"
+%include "./interface/SBExpressionOptions.i"
+%include "./interface/SBFileSpec.i"
+%include "./interface/SBFile.i"
+%include "./interface/SBFileSpecList.i"
+%include "./interface/SBFrame.i"
+%include "./interface/SBFunction.i"
+%include "./interface/SBHostOS.i"
+%include "./interface/SBInstruction.i"
+%include "./interface/SBInstructionList.i"
+%include "./interface/SBLanguageRuntime.i"
+%include "./interface/SBLaunchInfo.i"
+%include "./interface/SBLineEntry.i"
+%include "./interface/SBListener.i"
+%include "./interface/SBMemoryRegionInfo.i"
+%include "./interface/SBMemoryRegionInfoList.i"
+%include "./interface/SBModule.i"
+%include "./interface/SBModuleSpec.i"
+%include "./interface/SBPlatform.i"
+%include "./interface/SBProcess.i"
+%include "./interface/SBProcessInfo.i"
+%include "./interface/SBQueue.i"
+%include "./interface/SBQueueItem.i"
+%include "./interface/SBSection.i"
+%include "./interface/SBSourceManager.i"
+%include "./interface/SBStream.i"
+%include "./interface/SBStringList.i"
+%include "./interface/SBStructuredData.i"
+%include "./interface/SBSymbol.i"
+%include "./interface/SBSymbolContext.i"
+%include "./interface/SBSymbolContextList.i"
+%include "./interface/SBTarget.i"
+%include "./interface/SBThread.i"
+%include "./interface/SBThreadCollection.i"
+%include "./interface/SBThreadPlan.i"
+%include "./interface/SBTrace.i"
+%include "./interface/SBTraceOptions.i"
+%include "./interface/SBType.i"
+%include "./interface/SBTypeCategory.i"
+%include "./interface/SBTypeEnumMember.i"
+%include "./interface/SBTypeFilter.i"
+%include "./interface/SBTypeFormat.i"
+%include "./interface/SBTypeNameSpecifier.i"
+%include "./interface/SBTypeSummary.i"
+%include "./interface/SBTypeSynthetic.i"
+%include "./interface/SBValue.i"
+%include "./interface/SBValueList.i"
+%include "./interface/SBVariablesOptions.i"
+%include "./interface/SBWatchpoint.i"
+%include "./interface/SBUnixSignals.i"
+

diff  --git a/lldb/scripts/lldb.swig b/lldb/scripts/lldb.swig
index 7bbf7f1eec35..f030116b6cb8 100644
--- a/lldb/scripts/lldb.swig
+++ b/lldb/scripts/lldb.swig
@@ -94,178 +94,18 @@ def lldb_iter(obj, getsize, getelem):
 %}
 
 %include "./Python/python-typemaps.swig"
+%include "./headers.swig"
 
-/* C++ headers to be included. */
 %{
-#include <algorithm>
-#include <string>
-%}
-
-/* The liblldb header files to be included. */
-%{
-#include "lldb/lldb-public.h"
-#include "lldb/API/SBAddress.h"
-#include "lldb/API/SBAttachInfo.h"
-#include "lldb/API/SBBlock.h"
-#include "lldb/API/SBBreakpoint.h"
-#include "lldb/API/SBBreakpointLocation.h"
-#include "lldb/API/SBBreakpointName.h"
-#include "lldb/API/SBBroadcaster.h"
-#include "lldb/API/SBCommandInterpreter.h"
-#include "lldb/API/SBCommandReturnObject.h"
-#include "lldb/API/SBCommunication.h"
-#include "lldb/API/SBCompileUnit.h"
-#include "lldb/API/SBData.h"
-#include "lldb/API/SBDebugger.h"
-#include "lldb/API/SBDeclaration.h"
-#include "lldb/API/SBError.h"
-#include "lldb/API/SBEvent.h"
-#include "lldb/API/SBExecutionContext.h"
-#include "lldb/API/SBExpressionOptions.h"
-#include "lldb/API/SBFileSpec.h"
-#include "lldb/API/SBFile.h"
-#include "lldb/API/SBFileSpecList.h"
-#include "lldb/API/SBFrame.h"
-#include "lldb/API/SBFunction.h"
-#include "lldb/API/SBHostOS.h"
-#include "lldb/API/SBInstruction.h"
-#include "lldb/API/SBInstructionList.h"
-#include "lldb/API/SBLanguageRuntime.h"
-#include "lldb/API/SBLaunchInfo.h"
-#include "lldb/API/SBLineEntry.h"
-#include "lldb/API/SBListener.h"
-#include "lldb/API/SBMemoryRegionInfo.h"
-#include "lldb/API/SBMemoryRegionInfoList.h"
-#include "lldb/API/SBModule.h"
-#include "lldb/API/SBModuleSpec.h"
-#include "lldb/API/SBPlatform.h"
-#include "lldb/API/SBProcess.h"
-#include "lldb/API/SBProcessInfo.h"
-#include "lldb/API/SBQueue.h"
-#include "lldb/API/SBQueueItem.h"
-#include "lldb/API/SBSection.h"
-#include "lldb/API/SBSourceManager.h"
-#include "lldb/API/SBStream.h"
-#include "lldb/API/SBStringList.h"
-#include "lldb/API/SBStructuredData.h"
-#include "lldb/API/SBSymbol.h"
-#include "lldb/API/SBSymbolContext.h"
-#include "lldb/API/SBSymbolContextList.h"
-#include "lldb/API/SBTarget.h"
-#include "lldb/API/SBThread.h"
-#include "lldb/API/SBThreadCollection.h"
-#include "lldb/API/SBThreadPlan.h"
-#include "lldb/API/SBTrace.h"
-#include "lldb/API/SBTraceOptions.h"
-#include "lldb/API/SBType.h"
-#include "lldb/API/SBTypeCategory.h"
-#include "lldb/API/SBTypeEnumMember.h"
-#include "lldb/API/SBTypeFilter.h"
-#include "lldb/API/SBTypeFormat.h"
-#include "lldb/API/SBTypeNameSpecifier.h"
-#include "lldb/API/SBTypeSummary.h"
-#include "lldb/API/SBTypeSynthetic.h"
-#include "lldb/API/SBValue.h"
-#include "lldb/API/SBValueList.h"
-#include "lldb/API/SBVariablesOptions.h"
-#include "lldb/API/SBWatchpoint.h"
-#include "lldb/API/SBUnixSignals.h"
-
 #include "../source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h"
-
 #include "../scripts/Python/python-swigsafecast.swig"
-
 using namespace lldb_private;
 using namespace lldb_private::python;
 using namespace lldb;
-
 %}
 
-/* Various liblldb typedefs that SWIG needs to know about.  */
-#define __extension__ /* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h. */
-/* The ISO C99 standard specifies that in C++ implementations limit macros such
-   as INT32_MAX should only be defined if __STDC_LIMIT_MACROS is. */
-#define __STDC_LIMIT_MACROS
-%include "stdint.i"
-
-%include "lldb/lldb-defines.h"
-%include "lldb/lldb-enumerations.h"
-%include "lldb/lldb-forward.h"
-%include "lldb/lldb-types.h"
-
-/* Forward declaration of SB classes. */
-%include "lldb/API/SBDefines.h"
-
-/* Python interface files with docstrings. */
-%include "./interface/SBAddress.i"
-%include "./interface/SBAttachInfo.i"
-%include "./interface/SBBlock.i"
-%include "./interface/SBBreakpoint.i"
-%include "./interface/SBBreakpointLocation.i"
-%include "./interface/SBBreakpointName.i"
-%include "./interface/SBBroadcaster.i"
-%include "./interface/SBCommandInterpreter.i"
-%include "./interface/SBCommandReturnObject.i"
-%include "./interface/SBCommunication.i"
-%include "./interface/SBCompileUnit.i"
-%include "./interface/SBData.i"
-%include "./interface/SBDebugger.i"
-%include "./interface/SBDeclaration.i"
-%include "./interface/SBError.i"
-%include "./interface/SBEvent.i"
-%include "./interface/SBExecutionContext.i"
-%include "./interface/SBExpressionOptions.i"
-%include "./interface/SBFileSpec.i"
-%include "./interface/SBFile.i"
-%include "./interface/SBFileSpecList.i"
-%include "./interface/SBFrame.i"
-%include "./interface/SBFunction.i"
-%include "./interface/SBHostOS.i"
-%include "./interface/SBInstruction.i"
-%include "./interface/SBInstructionList.i"
-%include "./interface/SBLanguageRuntime.i"
-%include "./interface/SBLaunchInfo.i"
-%include "./interface/SBLineEntry.i"
-%include "./interface/SBListener.i"
-%include "./interface/SBMemoryRegionInfo.i"
-%include "./interface/SBMemoryRegionInfoList.i"
-%include "./interface/SBModule.i"
-%include "./interface/SBModuleSpec.i"
-%include "./interface/SBPlatform.i"
-%include "./interface/SBProcess.i"
-%include "./interface/SBProcessInfo.i"
-%include "./interface/SBQueue.i"
-%include "./interface/SBQueueItem.i"
-%include "./interface/SBSection.i"
-%include "./interface/SBSourceManager.i"
-%include "./interface/SBStream.i"
-%include "./interface/SBStringList.i"
-%include "./interface/SBStructuredData.i"
-%include "./interface/SBSymbol.i"
-%include "./interface/SBSymbolContext.i"
-%include "./interface/SBSymbolContextList.i"
-%include "./interface/SBTarget.i"
-%include "./interface/SBThread.i"
-%include "./interface/SBThreadCollection.i"
-%include "./interface/SBThreadPlan.i"
-%include "./interface/SBTrace.i"
-%include "./interface/SBTraceOptions.i"
-%include "./interface/SBType.i"
-%include "./interface/SBTypeCategory.i"
-%include "./interface/SBTypeEnumMember.i"
-%include "./interface/SBTypeFilter.i"
-%include "./interface/SBTypeFormat.i"
-%include "./interface/SBTypeNameSpecifier.i"
-%include "./interface/SBTypeSummary.i"
-%include "./interface/SBTypeSynthetic.i"
-%include "./interface/SBValue.i"
-%include "./interface/SBValueList.i"
-%include "./interface/SBVariablesOptions.i"
-%include "./interface/SBWatchpoint.i"
-%include "./interface/SBUnixSignals.i"
-
+%include "./interfaces.swig"
 %include "./Python/python-extensions.swig"
-
 %include "./Python/python-wrapper.swig"
 
 %pythoncode%{


        


More information about the lldb-commits mailing list