[Lldb-commits] [lldb] r358846 - modify-python-lldb.py: Remove docstring formatting code

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Sun Apr 21 05:48:54 PDT 2019


Author: labath
Date: Sun Apr 21 05:48:53 2019
New Revision: 358846

URL: http://llvm.org/viewvc/llvm-project?rev=358846&view=rev
Log:
modify-python-lldb.py: Remove docstring formatting code

The strings have been already cleaned up in r358683, so this code is not
doing anything anymore.

While comparing the outputs before and after removing the formatting
code, I've found a couple of docstrings that managed to escape my perl
script in r358683, so I format them manually with this patch.

Modified:
    lldb/trunk/scripts/Python/modify-python-lldb.py
    lldb/trunk/scripts/interface/SBProcess.i
    lldb/trunk/scripts/interface/SBTarget.i

Modified: lldb/trunk/scripts/Python/modify-python-lldb.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/modify-python-lldb.py?rev=358846&r1=358845&r2=358846&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/modify-python-lldb.py (original)
+++ lldb/trunk/scripts/Python/modify-python-lldb.py Sun Apr 21 05:48:53 2019
@@ -43,9 +43,6 @@ else:
 #
 # Residues to be removed.
 #
-c_comment_marker = "//------------"
-# The pattern for recognizing the doxygen comment block line.
-doxygen_comment_start = re.compile("^\s*(/// ?)")
 # The demarcation point for turning on/off residue removal state.
 # When bracketed by the lines, the CLEANUP_DOCSTRING state (see below) is ON.
 toggle_docstring_cleanup_line = '        """'
@@ -119,25 +116,14 @@ for line in content.splitlines():
 
     if line == toggle_docstring_cleanup_line:
         if state & CLEANUP_DOCSTRING:
-            # Special handling of the trailing blank line right before the '"""'
-            # end docstring marker.
-            new_content.del_blank_line()
             state ^= CLEANUP_DOCSTRING
         else:
             state |= CLEANUP_DOCSTRING
 
     if (state & CLEANUP_DOCSTRING):
-        # Remove the comment marker line.
-        if c_comment_marker in line:
-            continue
-
-        # Also remove the '\a ' and '\b 'substrings.
+        # Remove the '\a ' and '\b 'substrings.
         line = line.replace('\a ', '')
         line = line.replace('\b ', '')
-        # And the leading '///' substring.
-        doxygen_comment_match = doxygen_comment_start.match(line)
-        if doxygen_comment_match:
-            line = line.replace(doxygen_comment_match.group(1), '', 1)
 
         line = char_to_str_xform(line)
 

Modified: lldb/trunk/scripts/interface/SBProcess.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBProcess.i?rev=358846&r1=358845&r2=358846&view=diff
==============================================================================
--- lldb/trunk/scripts/interface/SBProcess.i (original)
+++ lldb/trunk/scripts/interface/SBProcess.i Sun Apr 21 05:48:53 2019
@@ -289,8 +289,7 @@ public:
     if error.Success():
         print('integer: %u' % uint)
     else
-        print('error: ', error)
-") ReadUnsignedFromMemory;
+        print('error: ', error)") ReadUnsignedFromMemory;
 
     uint64_t
     ReadUnsignedFromMemory (addr_t addr, uint32_t byte_size, lldb::SBError &error);
@@ -304,8 +303,7 @@ public:
     if error.Success():
         print('pointer: 0x%x' % ptr)
     else
-        print('error: ', error)
-") ReadPointerFromMemory;
+        print('error: ', error)") ReadPointerFromMemory;
 
     lldb::addr_t
     ReadPointerFromMemory (addr_t addr, lldb::SBError &error);

Modified: lldb/trunk/scripts/interface/SBTarget.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBTarget.i?rev=358846&r1=358845&r2=358846&view=diff
==============================================================================
--- lldb/trunk/scripts/interface/SBTarget.i (original)
+++ lldb/trunk/scripts/interface/SBTarget.i Sun Apr 21 05:48:53 2019
@@ -180,7 +180,6 @@ public:
 
     @return
          A process object for the newly created process.
-    //------------------------------------------------------------------
 
     For example,
 
@@ -232,7 +231,6 @@ public:
 
     @return
          A process object for the newly created process.
-    //------------------------------------------------------------------
 
     For example,
 
@@ -260,7 +258,6 @@ public:
 
     @return
          A process object for the newly created core file.
-    //------------------------------------------------------------------
 
     For example,
 
@@ -688,63 +685,63 @@ public:
     BreakpointCreateBySBAddress (SBAddress &sb_address);
 
     %feature("docstring", "
-  /// Create a breakpoint using a scripted resolver.
-  ///
-  /// @param[in] class_name
-  ///    This is the name of the class that implements a scripted resolver.
-  ///    The class should have the following signature:
-  ///    class Resolver:
-  ///        def __init__(self, bkpt, extra_args):
-  ///            # bkpt - the breakpoint for which this is the resolver.  When
-  ///            # the resolver finds an interesting address, call AddLocation
-  ///            # on this breakpoint to add it.
-  ///            #
-  ///            # extra_args - an SBStructuredData that can be used to
-  ///            # parametrize this instance.  Same as the extra_args passed
-  ///            # to BreakpointCreateFromScript.
-  ///
-  ///        def __get_depth__ (self):
-  ///            # This is optional, but if defined, you should return the
-  ///            # depth at which you want the callback to be called.  The
-  ///            # available options are:
-  ///            #    lldb.eSearchDepthModule
-  ///            #    lldb.eSearchDepthCompUnit
-  ///            # The default if you don't implement this method is
-  ///            # eSearchDepthModule.
-  ///
-  ///        def __callback__(self, sym_ctx):
-  ///            # sym_ctx - an SBSymbolContext that is the cursor in the
-  ///            # search through the program to resolve breakpoints.
-  ///            # The sym_ctx will be filled out to the depth requested in
-  ///            # __get_depth__.
-  ///            # Look in this sym_ctx for new breakpoint locations,
-  ///            # and if found use bkpt.AddLocation to add them.
-  ///            # Note, you will only get called for modules/compile_units that
-  ///            # pass the SearchFilter provided by the module_list & file_list
-  ///            # passed into BreakpointCreateFromScript.
-  ///
-  ///        def get_short_help(self):
-  ///            # Optional, but if implemented return a short string that will
-  ///            # be printed at the beginning of the break list output for the
-  ///            # breakpoint.
-  ///
-  /// @param[in] extra_args
-  ///    This is an SBStructuredData object that will get passed to the
-  ///    constructor of the class in class_name.  You can use this to
-  ///    reuse the same class, parametrizing it with entries from this
-  ///    dictionary.
-  ///
-  /// @param module_list
-  ///    If this is non-empty, this will be used as the module filter in the
-  ///    SearchFilter created for this breakpoint.
-  ///
-  /// @param file_list
-  ///    If this is non-empty, this will be used as the comp unit filter in the
-  ///    SearchFilter created for this breakpoint.
-  ///
-  /// @return
-  ///     An SBBreakpoint that will set locations based on the logic in the
-  ///     resolver's search callback.") BreakpointCreateFromScript;
+    Create a breakpoint using a scripted resolver.
+  
+    @param[in] class_name
+       This is the name of the class that implements a scripted resolver.
+       The class should have the following signature:
+       class Resolver:
+           def __init__(self, bkpt, extra_args):
+               # bkpt - the breakpoint for which this is the resolver.  When
+               # the resolver finds an interesting address, call AddLocation
+               # on this breakpoint to add it.
+               #
+               # extra_args - an SBStructuredData that can be used to
+               # parametrize this instance.  Same as the extra_args passed
+               # to BreakpointCreateFromScript.
+  
+           def __get_depth__ (self):
+               # This is optional, but if defined, you should return the
+               # depth at which you want the callback to be called.  The
+               # available options are:
+               #    lldb.eSearchDepthModule
+               #    lldb.eSearchDepthCompUnit
+               # The default if you don't implement this method is
+               # eSearchDepthModule.
+  
+           def __callback__(self, sym_ctx):
+               # sym_ctx - an SBSymbolContext that is the cursor in the
+               # search through the program to resolve breakpoints.
+               # The sym_ctx will be filled out to the depth requested in
+               # __get_depth__.
+               # Look in this sym_ctx for new breakpoint locations,
+               # and if found use bkpt.AddLocation to add them.
+               # Note, you will only get called for modules/compile_units that
+               # pass the SearchFilter provided by the module_list & file_list
+               # passed into BreakpointCreateFromScript.
+  
+           def get_short_help(self):
+               # Optional, but if implemented return a short string that will
+               # be printed at the beginning of the break list output for the
+               # breakpoint.
+  
+    @param[in] extra_args
+       This is an SBStructuredData object that will get passed to the
+       constructor of the class in class_name.  You can use this to
+       reuse the same class, parametrizing it with entries from this
+       dictionary.
+  
+    @param module_list
+       If this is non-empty, this will be used as the module filter in the
+       SearchFilter created for this breakpoint.
+  
+    @param file_list
+       If this is non-empty, this will be used as the comp unit filter in the
+       SearchFilter created for this breakpoint.
+  
+    @return
+        An SBBreakpoint that will set locations based on the logic in the
+        resolver's search callback.") BreakpointCreateFromScript;
     lldb::SBBreakpoint BreakpointCreateFromScript(
       const char *class_name,
       SBStructuredData &extra_args,




More information about the lldb-commits mailing list