diff options
author | Johnny Chen <johnny.chen@apple.com> | 2011-05-24 22:29:49 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2011-05-24 22:29:49 +0000 |
commit | 93e7b3a8bdbe1a9edb1c3d6524ed858377b35e62 (patch) | |
tree | 9a1e2a69174b4cfea31cfc204d9228f19d23685b /lldb/scripts/Python/modify-python-lldb.py | |
parent | d4562566b4887e4dd85100d8ca78ebfc199c556b (diff) | |
download | llvm-93e7b3a8bdbe1a9edb1c3d6524ed858377b35e62.zip llvm-93e7b3a8bdbe1a9edb1c3d6524ed858377b35e62.tar.gz llvm-93e7b3a8bdbe1a9edb1c3d6524ed858377b35e62.tar.bz2 |
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.
llvm-svn: 132016
Diffstat (limited to 'lldb/scripts/Python/modify-python-lldb.py')
-rw-r--r-- | lldb/scripts/Python/modify-python-lldb.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lldb/scripts/Python/modify-python-lldb.py b/lldb/scripts/Python/modify-python-lldb.py index 426a31a..fe7598e 100644 --- a/lldb/scripts/Python/modify-python-lldb.py +++ b/lldb/scripts/Python/modify-python-lldb.py @@ -133,10 +133,9 @@ lldb_iter_defined = False; # 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 @@ for line in content.splitlines(): 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 @@ for line in content.splitlines(): # 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 |