[Lldb-commits] [lldb] r132016 - /lldb/trunk/scripts/Python/modify-python-lldb.py

Johnny Chen johnny.chen at apple.com
Tue May 24 15:29:49 PDT 2011


Author: johnny
Date: Tue May 24 17:29:49 2011
New Revision: 132016

URL: http://llvm.org/viewvc/llvm-project?rev=132016&view=rev
Log:
Fix a potential bug resulting from the wrong assumption that SWIG puts out the __init__
method definition before other method definitions.  Instead, do without it and process
the class with IsValid() method definition in all possible states.

Modified:
    lldb/trunk/scripts/Python/modify-python-lldb.py

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=132016&r1=132015&r2=132016&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/modify-python-lldb.py (original)
+++ lldb/trunk/scripts/Python/modify-python-lldb.py Tue May 24 17:29:49 2011
@@ -133,10 +133,9 @@
 # method definition in order to insert the appropriate method(s) into the lldb
 # module.
 #
-# Assuming that SWIG puts out the __init__ method definition before other method
-# definitions, the FSM, while in NORMAL state, also checks the current input for
-# IsValid() definition, and inserts a __nonzero__() method definition to
-# implement truth value testing and the built-in operation bool().
+# The FSM, in all possible states, also checks the current input for IsValid()
+# definition, and inserts a __nonzero__() method definition to implement truth
+# value testing and the built-in operation bool().
 state = NORMAL
 for line in content.splitlines():
     if state == NORMAL:
@@ -157,10 +156,6 @@
             if cls in e:
                 # Adding support for eq and ne for the matched SB class.
                 state = (state | DEFINING_EQUALITY)
-        # Look for 'def IsValid(*args):', and once located, add implementation
-        # of truth value testing for objects by delegation.
-        elif isvalid_pattern.search(line):
-            print >> new_content, nonzero_def
     elif state > NORMAL:
         match = init_pattern.search(line)
         if match:
@@ -182,6 +177,11 @@
             # Next state will be NORMAL.
             state = NORMAL
 
+    # Look for 'def IsValid(*args):', and once located, add implementation
+    # of truth value testing for this object by delegation.
+    if isvalid_pattern.search(line):
+        print >> new_content, nonzero_def
+
     # Pass the original line of content to new_content.
     print >> new_content, line
     





More information about the lldb-commits mailing list