[Lldb-commits] [lldb] 0a57034 - [lldb/SWIG] Guard embedded Python code in SWIG interfaces by SWIGPYTHON

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Sun Dec 8 14:49:01 PST 2019


Author: Jonas Devlieghere
Date: 2019-12-08T14:48:51-08:00
New Revision: 0a5703458b7f577f628ca123a47c209653f19dc2

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

LOG: [lldb/SWIG] Guard embedded Python code in SWIG interfaces by SWIGPYTHON

Guard the embedded Python code in LLDB's interface files by the
SWIGPYTHON define to ensures they can be reused for other languages
supported by SWIG.

Added: 
    

Modified: 
    lldb/scripts/interface/SBAddress.i
    lldb/scripts/interface/SBBlock.i
    lldb/scripts/interface/SBBreakpoint.i
    lldb/scripts/interface/SBCompileUnit.i
    lldb/scripts/interface/SBData.i
    lldb/scripts/interface/SBDebugger.i
    lldb/scripts/interface/SBDeclaration.i
    lldb/scripts/interface/SBError.i
    lldb/scripts/interface/SBExecutionContext.i
    lldb/scripts/interface/SBFile.i
    lldb/scripts/interface/SBFileSpec.i
    lldb/scripts/interface/SBFrame.i
    lldb/scripts/interface/SBFunction.i
    lldb/scripts/interface/SBInstruction.i
    lldb/scripts/interface/SBInstructionList.i
    lldb/scripts/interface/SBLineEntry.i
    lldb/scripts/interface/SBModule.i
    lldb/scripts/interface/SBProcess.i
    lldb/scripts/interface/SBSection.i
    lldb/scripts/interface/SBStringList.i
    lldb/scripts/interface/SBSymbol.i
    lldb/scripts/interface/SBSymbolContext.i
    lldb/scripts/interface/SBSymbolContextList.i
    lldb/scripts/interface/SBTarget.i
    lldb/scripts/interface/SBThread.i
    lldb/scripts/interface/SBType.i
    lldb/scripts/interface/SBTypeCategory.i
    lldb/scripts/interface/SBTypeEnumMember.i
    lldb/scripts/interface/SBTypeFilter.i
    lldb/scripts/interface/SBTypeFormat.i
    lldb/scripts/interface/SBTypeNameSpecifier.i
    lldb/scripts/interface/SBTypeSummary.i
    lldb/scripts/interface/SBTypeSynthetic.i
    lldb/scripts/interface/SBUnixSignals.i
    lldb/scripts/interface/SBValue.i
    lldb/scripts/interface/SBValueList.i

Removed: 
    


################################################################################
diff  --git a/lldb/scripts/interface/SBAddress.i b/lldb/scripts/interface/SBAddress.i
index 92bc3f828f23..6c5352bac6d7 100644
--- a/lldb/scripts/interface/SBAddress.i
+++ b/lldb/scripts/interface/SBAddress.i
@@ -63,12 +63,14 @@ public:
 
     explicit operator bool() const;
 
+#ifdef SWIGPYTHON
     // operator== is a free function, which swig does not handle, so we inject
     // our own equality operator here
     %pythoncode%{
     def __eq__(self, other):
       return not self.__ne__(other)
     %}
+#endif
 
     bool operator!=(const SBAddress &rhs) const;
 
@@ -138,6 +140,7 @@ public:
     lldb::SBLineEntry
     GetLineEntry ();
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         def __get_load_addr_property__ (self):
             '''Get the load address for a lldb.SBAddress using the current target.'''
@@ -173,6 +176,7 @@ public:
         file_addr = property(GetFileAddress, None, doc='''A read only property that returns file address for the section as an integer. This is the address that represents the address as it is found in the object file that defines it.''')
         load_addr = property(__get_load_addr_property__, __set_load_addr_property__, doc='''A read/write property that gets/sets the SBAddress using load address. The setter resolves SBAddress using the SBTarget from lldb.target so this property can ONLY be used in the interactive script interpreter (i.e. under the lldb script command) and not in Python based commands, or breakpoint commands.''')
     %}
+#endif
 
 };
 

diff  --git a/lldb/scripts/interface/SBBlock.i b/lldb/scripts/interface/SBBlock.i
index 6d2cebfa0cc2..73079a11760c 100644
--- a/lldb/scripts/interface/SBBlock.i
+++ b/lldb/scripts/interface/SBBlock.i
@@ -100,6 +100,7 @@ public:
                    bool locals,
                    bool statics);
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         def get_range_at_index(self, idx):
             if idx < self.GetNumRanges():
@@ -153,6 +154,7 @@ public:
         ranges = property(get_ranges_array, None, doc='''A read only property that returns a list() object that contains all of the address ranges for the block.''')
         num_ranges = property(GetNumRanges, None, doc='''A read only property that returns the same result as GetNumRanges().''')
     %}
+#endif
 
 };
 

diff  --git a/lldb/scripts/interface/SBBreakpoint.i b/lldb/scripts/interface/SBBreakpoint.i
index a33aeea40b71..f84f2ada3d32 100644
--- a/lldb/scripts/interface/SBBreakpoint.i
+++ b/lldb/scripts/interface/SBBreakpoint.i
@@ -249,6 +249,7 @@ public:
     bool
     IsHardware ();
 
+#ifdef SWIGPYTHON
     %pythoncode %{
 
         class locations_access(object):
@@ -295,6 +296,7 @@ public:
         one_shot = property(IsOneShot, SetOneShot, doc='''A read/write property that configures whether this breakpoint is one-shot (deleted when hit) or not.''')
         num_locations = property(GetNumLocations, None, doc='''A read only property that returns the count of locations of this breakpoint.''')
     %}
+#endif
 
 
 };

diff  --git a/lldb/scripts/interface/SBCompileUnit.i b/lldb/scripts/interface/SBCompileUnit.i
index f5f4e5af14b7..bc2d45ae8e56 100644
--- a/lldb/scripts/interface/SBCompileUnit.i
+++ b/lldb/scripts/interface/SBCompileUnit.i
@@ -116,6 +116,7 @@ public:
     bool
     operator != (const lldb::SBCompileUnit &rhs) const;
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         def __iter__(self):
             '''Iterate over all line entries in a lldb.SBCompileUnit object.'''
@@ -129,6 +130,7 @@ public:
         file = property(GetFileSpec, None, doc='''A read only property that returns the same result an lldb object that represents the source file (lldb.SBFileSpec) for the compile unit.''')
         num_line_entries = property(GetNumLineEntries, None, doc='''A read only property that returns the number of line entries in a compile unit as an integer.''')
     %}
+#endif
 };
 
 } // namespace lldb

diff  --git a/lldb/scripts/interface/SBData.i b/lldb/scripts/interface/SBData.i
index 464a6e69233f..fdaa6962f0ec 100644
--- a/lldb/scripts/interface/SBData.i
+++ b/lldb/scripts/interface/SBData.i
@@ -134,6 +134,7 @@ public:
     bool
     SetDataFromDoubleArray (double* array, size_t array_len);
 
+#ifdef SWIGPYTHON
     %pythoncode %{
 
         class read_data_helper:
@@ -287,6 +288,7 @@ public:
         byte_order = property(GetByteOrder, SetByteOrder, doc='''A read/write property getting and setting the endianness of this SBData (data.byte_order = lldb.eByteOrderLittle).''')
         size = property(GetByteSize, None, doc='''A read only property that returns the size the same result as GetByteSize().''')
     %}
+#endif
 
 };
 

diff  --git a/lldb/scripts/interface/SBDebugger.i b/lldb/scripts/interface/SBDebugger.i
index 20e662485b19..52f65841893c 100644
--- a/lldb/scripts/interface/SBDebugger.i
+++ b/lldb/scripts/interface/SBDebugger.i
@@ -165,6 +165,7 @@ public:
     void
     SkipLLDBInitFiles (bool b);
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         def SetOutputFileHandle(self, file, transfer_ownership):
             "DEPRECATED, use SetOutputFile"
@@ -187,6 +188,7 @@ public:
                 file = sys.stderr
             self.SetErrorFile(SBFile.Create(file, borrow=True))
     %}
+#endif
 
 
     %extend {
@@ -514,6 +516,7 @@ n_errors, quit_requested, has_crashed = debugger.RunCommandInterpreter(True,
     lldb::SBError
     RunREPL (lldb::LanguageType language, const char *repl_options);
 
+#ifdef SWIGPYTHON
     %pythoncode%{
     def __iter__(self):
         '''Iterate over all targets in a lldb.SBDebugger object.'''
@@ -523,6 +526,7 @@ n_errors, quit_requested, has_crashed = debugger.RunCommandInterpreter(True,
         '''Return the number of targets in a lldb.SBDebugger object.'''
         return self.GetNumTargets()
     %}
+#endif
 
 }; // class SBDebugger
 

diff  --git a/lldb/scripts/interface/SBDeclaration.i b/lldb/scripts/interface/SBDeclaration.i
index 96407d7c60f6..cdaec8567646 100644
--- a/lldb/scripts/interface/SBDeclaration.i
+++ b/lldb/scripts/interface/SBDeclaration.i
@@ -53,11 +53,13 @@ namespace lldb {
         bool
         operator != (const lldb::SBDeclaration &rhs) const;
 
+#ifdef SWIGPYTHON
         %pythoncode %{
             file = property(GetFileSpec, None, doc='''A read only property that returns an lldb object that represents the file (lldb.SBFileSpec) for this line entry.''')
             line = property(GetLine, None, doc='''A read only property that returns the 1 based line number for this line entry, a return value of zero indicates that no line information is available.''')
             column = property(GetColumn, None, doc='''A read only property that returns the 1 based column number for this line entry, a return value of zero indicates that no column information is available.''')
         %}
+#endif
     };
 
 } // namespace lldb

diff  --git a/lldb/scripts/interface/SBError.i b/lldb/scripts/interface/SBError.i
index 42308ff8bb83..96cd6c4886f5 100644
--- a/lldb/scripts/interface/SBError.i
+++ b/lldb/scripts/interface/SBError.i
@@ -105,6 +105,7 @@ public:
     bool
     GetDescription (lldb::SBStream &description);
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         value = property(GetError, None, doc='''A read only property that returns the same result as GetError().''')
         fail = property(Fail, None, doc='''A read only property that returns the same result as Fail().''')
@@ -112,6 +113,7 @@ public:
         description = property(GetCString, None, doc='''A read only property that returns the same result as GetCString().''')
         type = property(GetType, None, doc='''A read only property that returns the same result as GetType().''')
     %}
+#endif
 
 };
 

diff  --git a/lldb/scripts/interface/SBExecutionContext.i b/lldb/scripts/interface/SBExecutionContext.i
index 9e8d22b37288..46968d04ae32 100644
--- a/lldb/scripts/interface/SBExecutionContext.i
+++ b/lldb/scripts/interface/SBExecutionContext.i
@@ -37,12 +37,14 @@ public:
     SBFrame
     GetFrame () const;
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         target = property(GetTarget, None, doc='''A read only property that returns the same result as GetTarget().''')
         process = property(GetProcess, None, doc='''A read only property that returns the same result as GetProcess().''')
         thread = property(GetThread, None, doc='''A read only property that returns the same result as GetThread().''')
         frame = property(GetFrame, None, doc='''A read only property that returns the same result as GetFrame().''')
     %}
+#endif
 
 };
 

diff  --git a/lldb/scripts/interface/SBFile.i b/lldb/scripts/interface/SBFile.i
index 27b83641338f..a19666995cd3 100644
--- a/lldb/scripts/interface/SBFile.i
+++ b/lldb/scripts/interface/SBFile.i
@@ -38,6 +38,7 @@ public:
         }
     }
 
+#ifdef SWIGPYTHON
     %pythoncode {
         @classmethod
         def Create(cls, file, borrow=False, force_io_methods=False):
@@ -61,6 +62,7 @@ public:
                 else:
                     return cls(file)
     }
+#endif
 
     ~SBFile ();
 

diff  --git a/lldb/scripts/interface/SBFileSpec.i b/lldb/scripts/interface/SBFileSpec.i
index 98777c0e1e47..07a7630ebbac 100644
--- a/lldb/scripts/interface/SBFileSpec.i
+++ b/lldb/scripts/interface/SBFileSpec.i
@@ -80,6 +80,7 @@ public:
     void
     AppendPathComponent (const char *file_or_directory);
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         def __get_fullpath__(self):
             spec_dir = self.GetDirectory()
@@ -97,6 +98,7 @@ public:
         dirname = property(GetDirectory, None, doc='''A read only property that returns the path directory name as a python string.''')
         exists = property(Exists, None, doc='''A read only property that returns a boolean value that indicates if the file exists.''')
     %}
+#endif
 
 };
 

diff  --git a/lldb/scripts/interface/SBFrame.i b/lldb/scripts/interface/SBFrame.i
index f36d83c32e18..811f7f22f9b4 100644
--- a/lldb/scripts/interface/SBFrame.i
+++ b/lldb/scripts/interface/SBFrame.i
@@ -285,6 +285,7 @@ public:
     bool
     GetDescription (lldb::SBStream &description);
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         def get_all_variables(self):
             return self.GetVariables(True,True,True,True)
@@ -355,6 +356,7 @@ public:
         reg = property(get_registers_access, None, doc='''A read only property that returns an helper object providing a flattened indexable view of the CPU registers for this stack frame''')
         parent = property(get_parent_frame, None, doc='''A read only property that returns the parent (caller) frame of the current frame.''')
     %}
+#endif
 };
 
 } // namespace lldb

diff  --git a/lldb/scripts/interface/SBFunction.i b/lldb/scripts/interface/SBFunction.i
index 3acb0057cc3c..7b157bb38816 100644
--- a/lldb/scripts/interface/SBFunction.i
+++ b/lldb/scripts/interface/SBFunction.i
@@ -111,6 +111,7 @@ public:
     bool
     operator != (const lldb::SBFunction &rhs) const;
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         def get_instructions_from_current_target (self):
             return self.GetInstructions (target)
@@ -124,6 +125,7 @@ public:
         prologue_size = property(GetPrologueByteSize, None, doc='''A read only property that returns the size in bytes of the prologue instructions as an unsigned integer.''')
         type = property(GetType, None, doc='''A read only property that returns an lldb object that represents the return type (lldb.SBType) for this function.''')
     %}
+#endif
 
 };
 

diff  --git a/lldb/scripts/interface/SBInstruction.i b/lldb/scripts/interface/SBInstruction.i
index 4586978733f2..09688214630b 100644
--- a/lldb/scripts/interface/SBInstruction.i
+++ b/lldb/scripts/interface/SBInstruction.i
@@ -74,6 +74,7 @@ public:
     bool
     TestEmulation (lldb::SBStream &output_stream, const char *test_file);
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         def __mnemonic_property__ (self):
             return self.GetMnemonic (target)
@@ -93,6 +94,7 @@ public:
         size = property(GetByteSize, None, doc='''A read only property that returns the size in bytes for this instruction as an integer.''')
         is_branch = property(DoesBranch, None, doc='''A read only property that returns a boolean value that indicates if this instruction is a branch instruction.''')
     %}
+#endif
 
 
 };

diff  --git a/lldb/scripts/interface/SBInstructionList.i b/lldb/scripts/interface/SBInstructionList.i
index 1e5aa9496b54..d50deba4f5e1 100644
--- a/lldb/scripts/interface/SBInstructionList.i
+++ b/lldb/scripts/interface/SBInstructionList.i
@@ -66,6 +66,7 @@ public:
     bool
     DumpEmulationForAllInstructions (const char *triple);
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         def __iter__(self):
             '''Iterate over all instructions in a lldb.SBInstructionList
@@ -97,6 +98,7 @@ public:
                         closest_inst = inst
             return None
     %}
+#endif
 
 };
 

diff  --git a/lldb/scripts/interface/SBLineEntry.i b/lldb/scripts/interface/SBLineEntry.i
index 4dac71f04a7a..90f60df23247 100644
--- a/lldb/scripts/interface/SBLineEntry.i
+++ b/lldb/scripts/interface/SBLineEntry.i
@@ -84,6 +84,7 @@ public:
     bool
     operator != (const lldb::SBLineEntry &rhs) const;
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         file = property(GetFileSpec, None, doc='''A read only property that returns an lldb object that represents the file (lldb.SBFileSpec) for this line entry.''')
         line = property(GetLine, None, doc='''A read only property that returns the 1 based line number for this line entry, a return value of zero indicates that no line information is available.''')
@@ -91,6 +92,7 @@ public:
         addr = property(GetStartAddress, None, doc='''A read only property that returns an lldb object that represents the start address (lldb.SBAddress) for this line entry.''')
         end_addr = property(GetEndAddress, None, doc='''A read only property that returns an lldb object that represents the end address (lldb.SBAddress) for this line entry.''')
     %}
+#endif
 };
 
 } // namespace lldb

diff  --git a/lldb/scripts/interface/SBModule.i b/lldb/scripts/interface/SBModule.i
index 06a4628d52b2..03c8aeb2bed9 100644
--- a/lldb/scripts/interface/SBModule.i
+++ b/lldb/scripts/interface/SBModule.i
@@ -8,6 +8,7 @@
 
 namespace lldb {
 
+#ifdef SWIGPYTHON
 %pythoncode%{
 # ==================================
 # Helper function for SBModule class
@@ -30,6 +31,7 @@ def in_range(symbol, section):
         else:
             return False
 %}
+#endif
 
 %feature("docstring",
 "Represents an executable image and its associated object and symbol files.
@@ -342,6 +344,7 @@ public:
     lldb::SBAddress
     GetObjectFileEntryPointAddress() const;
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         def __len__(self):
             '''Return the number of symbols in a lldb.SBModule object.'''
@@ -542,6 +545,7 @@ public:
         num_sections = property(GetNumSections, None, doc='''A read only property that returns number of sections in the module as an integer.''')
 
     %}
+#endif
 
 };
 

diff  --git a/lldb/scripts/interface/SBProcess.i b/lldb/scripts/interface/SBProcess.i
index 453f98ffe200..c5ebc2468615 100644
--- a/lldb/scripts/interface/SBProcess.i
+++ b/lldb/scripts/interface/SBProcess.i
@@ -417,6 +417,7 @@ public:
     lldb::SBProcessInfo
     GetProcessInfo();
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         def __get_is_alive__(self):
             '''Returns "True" if the process is currently alive, "False" otherwise'''
@@ -495,6 +496,7 @@ public:
         exit_description = property(GetExitDescription, None, doc='''A read only property that returns an exit description as a string of this process when the process state is lldb.eStateExited.''')
         broadcaster = property(GetBroadcaster, None, doc='''A read only property that an lldb object that represents the broadcaster (lldb.SBBroadcaster) for this process.''')
     %}
+#endif
 
 };
 

diff  --git a/lldb/scripts/interface/SBSection.i b/lldb/scripts/interface/SBSection.i
index 7bd6c592e6d8..c1a84acc4f14 100644
--- a/lldb/scripts/interface/SBSection.i
+++ b/lldb/scripts/interface/SBSection.i
@@ -114,6 +114,7 @@ public:
     bool
     operator != (const lldb::SBSection &rhs);
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         def __iter__(self):
             '''Iterate over all subsections in a lldb.SBSection object.'''
@@ -136,6 +137,7 @@ public:
         type = property(GetSectionType, None, doc='''A read only property that returns an lldb enumeration value (see enumerations that start with "lldb.eSectionType") that represents the type of this section (code, data, etc.).''')
         target_byte_size = property(GetTargetByteSize, None, doc='''A read only property that returns the size of a target byte represented by this section as a number of host bytes.''')
     %}
+#endif
 
 private:
 

diff  --git a/lldb/scripts/interface/SBStringList.i b/lldb/scripts/interface/SBStringList.i
index 68653b5958fc..c8e1e357ed2b 100644
--- a/lldb/scripts/interface/SBStringList.i
+++ b/lldb/scripts/interface/SBStringList.i
@@ -41,6 +41,7 @@ public:
     void
     Clear ();
 
+#ifdef SWIGPYTHON
     %pythoncode%{
     def __iter__(self):
         '''Iterate over all strings in a lldb.SBStringList object.'''
@@ -50,6 +51,7 @@ public:
         '''Return the number of strings in a lldb.SBStringList object.'''
         return self.GetSize()
     %}
+#endif
 };
 
 } // namespace lldb

diff  --git a/lldb/scripts/interface/SBSymbol.i b/lldb/scripts/interface/SBSymbol.i
index 7391b9ab6b5d..e5880e66d300 100644
--- a/lldb/scripts/interface/SBSymbol.i
+++ b/lldb/scripts/interface/SBSymbol.i
@@ -72,6 +72,7 @@ public:
     bool
     operator != (const lldb::SBSymbol &rhs) const;
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         def get_instructions_from_current_target (self):
             return self.GetInstructions (target)
@@ -86,6 +87,7 @@ public:
         external = property(IsExternal, None, doc='''A read only property that returns a boolean value that indicates if this symbol is externally visiable (exported) from the module that contains it.''')
         synthetic = property(IsSynthetic, None, doc='''A read only property that returns a boolean value that indicates if this symbol was synthetically created from information in module that contains it.''')
     %}
+#endif
 
 };
 

diff  --git a/lldb/scripts/interface/SBSymbolContext.i b/lldb/scripts/interface/SBSymbolContext.i
index 29cc9538f239..a6aa4d78bfe3 100644
--- a/lldb/scripts/interface/SBSymbolContext.i
+++ b/lldb/scripts/interface/SBSymbolContext.i
@@ -82,6 +82,7 @@ public:
     GetDescription (lldb::SBStream &description);
 
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         module = property(GetModule, SetModule, doc='''A read/write property that allows the getting/setting of the module (lldb.SBModule) in this symbol context.''')
         compile_unit = property(GetCompileUnit, SetCompileUnit, doc='''A read/write property that allows the getting/setting of the compile unit (lldb.SBCompileUnit) in this symbol context.''')
@@ -90,6 +91,7 @@ public:
         symbol = property(GetSymbol, SetSymbol, doc='''A read/write property that allows the getting/setting of the symbol (lldb.SBSymbol) in this symbol context.''')
         line_entry = property(GetLineEntry, SetLineEntry, doc='''A read/write property that allows the getting/setting of the line entry (lldb.SBLineEntry) in this symbol context.''')
     %}
+#endif
 
 };
 

diff  --git a/lldb/scripts/interface/SBSymbolContextList.i b/lldb/scripts/interface/SBSymbolContextList.i
index 4ac6d82ca3b4..54adc659fa21 100644
--- a/lldb/scripts/interface/SBSymbolContextList.i
+++ b/lldb/scripts/interface/SBSymbolContextList.i
@@ -60,6 +60,7 @@ public:
     void
     Clear();
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         def __iter__(self):
             '''Iterate over all symbol contexts in a lldb.SBSymbolContextList
@@ -129,6 +130,7 @@ public:
         line_entries = property(get_line_entry_array, None, doc='''Returns a list() of lldb.SBLineEntry objects, one for each line entry in each SBSymbolContext object in this list.''')
         symbols = property(get_symbol_array, None, doc='''Returns a list() of lldb.SBSymbol objects, one for each symbol in each SBSymbolContext object in this list.''')
     %}
+#endif
 
 };
 

diff  --git a/lldb/scripts/interface/SBTarget.i b/lldb/scripts/interface/SBTarget.i
index e064852d6198..36492f5eed01 100644
--- a/lldb/scripts/interface/SBTarget.i
+++ b/lldb/scripts/interface/SBTarget.i
@@ -971,6 +971,7 @@ public:
     lldb::SBValue
     EvaluateExpression (const char *expr, const lldb::SBExpressionOptions &options);
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         class modules_access(object):
             '''A helper object that will lazily hand out lldb.SBModule objects for a target when supplied an index, or by full or partial path.'''
@@ -1066,5 +1067,6 @@ public:
         code_byte_size = property(GetCodeByteSize, None, doc='''A read only property that returns the size in host bytes of a byte in the code address space for this target.''')
         platform = property(GetPlatform, None, doc='''A read only property that returns the platform associated with with this target.''')
     %}
+#endif
 };
 } // namespace lldb

diff  --git a/lldb/scripts/interface/SBThread.i b/lldb/scripts/interface/SBThread.i
index 934e4c3b6056..c1c045487fc1 100644
--- a/lldb/scripts/interface/SBThread.i
+++ b/lldb/scripts/interface/SBThread.i
@@ -402,6 +402,7 @@ public:
     bool
     SafeToCallFunctions ();
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         def __iter__(self):
             '''Iterate over all frames in a lldb.SBThread object.'''
@@ -451,6 +452,7 @@ public:
         is_suspended = property(IsSuspended, None, doc='''A read only property that returns a boolean value that indicates if this thread is suspended.''')
         is_stopped = property(IsStopped, None, doc='''A read only property that returns a boolean value that indicates if this thread is stopped but not exited.''')
     %}
+#endif
 
 };
 

diff  --git a/lldb/scripts/interface/SBType.i b/lldb/scripts/interface/SBType.i
index ae9abfeefd85..d9da9e39b956 100644
--- a/lldb/scripts/interface/SBType.i
+++ b/lldb/scripts/interface/SBType.i
@@ -43,6 +43,7 @@ public:
     uint32_t
     GetBitfieldSizeInBits();
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         name = property(GetName, None, doc='''A read only property that returns the name for this member as a string.''')
         type = property(GetType, None, doc='''A read only property that returns an lldb object that represents the type (lldb.SBType) for this member.''')
@@ -51,6 +52,7 @@ public:
         is_bitfield = property(IsBitfield, None, doc='''A read only property that returns true if this member is a bitfield.''')
         bitfield_bit_size = property(GetBitfieldSizeInBits, None, doc='''A read only property that returns the bitfield size in bits for this member as an integer, or zero if this member is not a bitfield.''')
     %}
+#endif
 
 protected:
     std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_ap;
@@ -312,6 +314,7 @@ public:
 
     bool operator!=(lldb::SBType &rhs);
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         def template_arg_array(self):
             num_args = self.num_template_args
@@ -408,6 +411,7 @@ public:
         members = property(get_members_array, None, doc='''A read only property that returns a list() of all lldb.SBTypeMember objects that represent all of the base classes, virtual base classes and fields for this type in ascending bit offset order.''')
         enum_members = property(get_enum_members_array, None, doc='''A read only property that returns a list() of all lldb.SBTypeEnumMember objects that represent the enum members for this type.''')
         %}
+#endif
 
 };
 
@@ -462,6 +466,7 @@ public:
 
     ~SBTypeList();
 
+#ifdef SWIGPYTHON
     %pythoncode%{
     def __iter__(self):
         '''Iterate over all types in a lldb.SBTypeList object.'''
@@ -471,6 +476,7 @@ public:
         '''Return the number of types in a lldb.SBTypeList object.'''
         return self.GetSize()
     %}
+#endif
 };
 
 } // namespace lldb

diff  --git a/lldb/scripts/interface/SBTypeCategory.i b/lldb/scripts/interface/SBTypeCategory.i
index c183862702df..43fe9faf70f5 100644
--- a/lldb/scripts/interface/SBTypeCategory.i
+++ b/lldb/scripts/interface/SBTypeCategory.i
@@ -124,6 +124,7 @@ namespace lldb {
         bool
         DeleteTypeSynthetic (lldb::SBTypeNameSpecifier);
 
+#ifdef SWIGPYTHON
         %pythoncode %{
 
             class formatters_access_class(object):
@@ -213,6 +214,7 @@ namespace lldb {
             name = property(GetName, None)
             enabled = property(GetEnabled, SetEnabled)
         %}
+#endif
 
     };
 

diff  --git a/lldb/scripts/interface/SBTypeEnumMember.i b/lldb/scripts/interface/SBTypeEnumMember.i
index 0c9cf64a77ea..b2d861711782 100644
--- a/lldb/scripts/interface/SBTypeEnumMember.i
+++ b/lldb/scripts/interface/SBTypeEnumMember.i
@@ -43,12 +43,14 @@ public:
     GetDescription (lldb::SBStream &description,
                     lldb::DescriptionLevel description_level);
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         name = property(GetName, None, doc='''A read only property that returns the name for this enum member as a string.''')
         type = property(GetType, None, doc='''A read only property that returns an lldb object that represents the type (lldb.SBType) for this enum member.''')
         signed = property(GetValueAsSigned, None, doc='''A read only property that returns the value of this enum member as a signed integer.''')
         unsigned = property(GetValueAsUnsigned, None, doc='''A read only property that returns the value of this enum member as a unsigned integer.''')
     %}
+#endif
 
 protected:
     friend class SBType;

diff  --git a/lldb/scripts/interface/SBTypeFilter.i b/lldb/scripts/interface/SBTypeFilter.i
index 100c420bf2e2..3759e0a23d41 100644
--- a/lldb/scripts/interface/SBTypeFilter.i
+++ b/lldb/scripts/interface/SBTypeFilter.i
@@ -61,10 +61,12 @@ namespace lldb {
         bool
         operator != (lldb::SBTypeFilter &rhs);
 
+#ifdef SWIGPYTHON
         %pythoncode %{
             options = property(GetOptions, SetOptions)
             count = property(GetNumberOfExpressionPaths)
         %}
+#endif
 
     };
 

diff  --git a/lldb/scripts/interface/SBTypeFormat.i b/lldb/scripts/interface/SBTypeFormat.i
index 7c19ebbd0f1f..5efd135b7326 100644
--- a/lldb/scripts/interface/SBTypeFormat.i
+++ b/lldb/scripts/interface/SBTypeFormat.i
@@ -61,10 +61,12 @@ namespace lldb {
         bool
         operator != (lldb::SBTypeFormat &rhs);
 
+#ifdef SWIGPYTHON
         %pythoncode %{
             format = property(GetFormat, SetFormat)
             options = property(GetOptions, SetOptions)
         %}
+#endif
 
     };
 

diff  --git a/lldb/scripts/interface/SBTypeNameSpecifier.i b/lldb/scripts/interface/SBTypeNameSpecifier.i
index 537b9cecf224..bb16e86b0bc5 100644
--- a/lldb/scripts/interface/SBTypeNameSpecifier.i
+++ b/lldb/scripts/interface/SBTypeNameSpecifier.i
@@ -53,10 +53,12 @@ namespace lldb {
         bool
         operator != (lldb::SBTypeNameSpecifier &rhs);
 
+#ifdef SWIGPYTHON
         %pythoncode %{
             name = property(GetName)
             is_regex = property(IsRegex)
         %}
+#endif
 
 
     };

diff  --git a/lldb/scripts/interface/SBTypeSummary.i b/lldb/scripts/interface/SBTypeSummary.i
index 2a44918441ff..225a404cf73c 100644
--- a/lldb/scripts/interface/SBTypeSummary.i
+++ b/lldb/scripts/interface/SBTypeSummary.i
@@ -101,6 +101,7 @@ namespace lldb {
         bool
         operator != (lldb::SBTypeSummary &rhs);
 
+#ifdef SWIGPYTHON
         %pythoncode %{
             options = property(GetOptions, SetOptions)
             is_summary_string = property(IsSummaryString)
@@ -108,6 +109,7 @@ namespace lldb {
             is_function_name = property(IsFunctionCode)
             summary_data = property(GetData)
         %}
+#endif
 
     };
 

diff  --git a/lldb/scripts/interface/SBTypeSynthetic.i b/lldb/scripts/interface/SBTypeSynthetic.i
index 04502fa7f350..d9d75e4c9efa 100644
--- a/lldb/scripts/interface/SBTypeSynthetic.i
+++ b/lldb/scripts/interface/SBTypeSynthetic.i
@@ -63,11 +63,13 @@ namespace lldb {
         bool
         operator != (lldb::SBTypeSynthetic &rhs);
 
+#ifdef SWIGPYTHON
         %pythoncode %{
             options = property(GetOptions, SetOptions)
             contains_code = property(IsClassCode, None)
             synthetic_data = property(GetData, None)
         %}
+#endif
 
     };
 

diff  --git a/lldb/scripts/interface/SBUnixSignals.i b/lldb/scripts/interface/SBUnixSignals.i
index 015aeae51b1d..8fe3e2a3911f 100644
--- a/lldb/scripts/interface/SBUnixSignals.i
+++ b/lldb/scripts/interface/SBUnixSignals.i
@@ -60,6 +60,7 @@ public:
     int32_t
     GetSignalAtIndex (int32_t index) const;
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         def get_unix_signals_list(self):
             signals = []
@@ -69,6 +70,7 @@ public:
 
         threads = property(get_unix_signals_list, None, doc='''A read only property that returns a list() of valid signal numbers for this platform.''')
     %}
+#endif
 };
 
 }  // namespace lldb

diff  --git a/lldb/scripts/interface/SBValue.i b/lldb/scripts/interface/SBValue.i
index 10ad04f2dd59..d7d3bfacd328 100644
--- a/lldb/scripts/interface/SBValue.i
+++ b/lldb/scripts/interface/SBValue.i
@@ -443,6 +443,7 @@ public:
                        const SBExpressionOptions &options,
                        const char *name) const;
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         def __get_dynamic__ (self):
             '''Helper function for the "SBValue.dynamic" property.'''
@@ -591,6 +592,7 @@ public:
 
             return
     %}
+#endif
 
 };
 

diff  --git a/lldb/scripts/interface/SBValueList.i b/lldb/scripts/interface/SBValueList.i
index a43e228331cb..56ef19054e4c 100644
--- a/lldb/scripts/interface/SBValueList.i
+++ b/lldb/scripts/interface/SBValueList.i
@@ -101,6 +101,7 @@ public:
     lldb::SBValue
     GetFirstValueByName (const char* name) const;
 
+#ifdef SWIGPYTHON
     %pythoncode %{
         def __iter__(self):
             '''Iterate over all values in a lldb.SBValueList object.'''
@@ -140,6 +141,7 @@ public:
                 return matches
 
     %}
+#endif
 
 
 };


        


More information about the lldb-commits mailing list