tingraldi/SwiftScripting

sbhc.py iCal.h Traceback (most recent call last): File "/Users/mzAdmin/Downloads/SwiftScripting-master/sbhc.py", line 214, in <module> main(sys.argv[1]) File "/Users/mzAdmin/Downloads/SwiftScripting-master/sbhc.py", line 209, in main header_processor.emit_swift() File "/Users/mzAdmin/Downloads/SwiftScripting-master/sbhc.py", line 203, in emit_swift self.emit_protocol(child) File "/Users/mzAdmin/Downloads/SwiftScripting-master/sbhc.py", line 159, in emit_protocol if child.kind == CursorKind.OBJC_SUPER_CLASS_REF][0] IndexError: list index out of range

chutala opened this issue · 7 comments

sbhc.py iCal.h Traceback (most recent call last): File "/Users/mzAdmin/Downloads/SwiftScripting-master/sbhc.py", line 214, in main(sys.argv[1]) File "/Users/mzAdmin/Downloads/SwiftScripting-master/sbhc.py", line 209, in main header_processor.emit_swift() File "/Users/mzAdmin/Downloads/SwiftScripting-master/sbhc.py", line 203, in emit_swift self.emit_protocol(child) File "/Users/mzAdmin/Downloads/SwiftScripting-master/sbhc.py", line 159, in emit_protocol if child.kind == CursorKind.OBJC_SUPER_CLASS_REF][0] IndexError: list index out of range

I'm having the same issue. I'm running OS X 10.10.3 and Xcode 6.3.2. Is this a bug, or am I doing something wrong?

$ sdef /Applications/iTunes.app > iTunes.sdef
$ sdp -fh --basename iTunes iTunes.sdef
$ ../sbhc.py iTunes.h                        
Traceback (most recent call last):
  File "../sbhc.py", line 214, in <module>
    main(sys.argv[1])
  File "../sbhc.py", line 209, in main
    header_processor.emit_swift()
  File "../sbhc.py", line 203, in emit_swift
    self.emit_protocol(child)
  File "../sbhc.py", line 159, in emit_protocol
    if child.kind == CursorKind.OBJC_SUPER_CLASS_REF][0]
IndexError: list index out of range

The script is failing on some systems due to different behavior of clang as it traverses the source tree. The problem has to do with the fact that the superclass child of an interface is not being included in its list of children. So, when line 159 is encountered, the reference to element 0 of the list fails.

I've worked a bit with someone who encountered this problem on their system, but I've not found the root cause. I cannot reproduce the error on my system.

Any details you could provide about your system that might be relevant, would be greatly appreciated.

On 21 Jun 2015, at 06:07, Tony Ingraldi notifications@github.com wrote:

The script is failing on some systems due to different behavior of clang as it traverses the source tree. The problem has to do with the fact that the superclass child of an interface is not being included in its list of children. So, when line 159 is encountered, the reference to element 0 of the list fails.

I've worked a bit with someone who encountered this problem on their system, but I've not found the root cause. I cannot reproduce the error on my system.

Any details you could provide about your system that might be relevant, would be greatly appreciated.


Reply to this email directly or view it on GitHub #2 (comment).

I see. I don’t know, what kind of details do you think might be useful to you?

Do you have multiple versions of Xcode installed? Have you installed alternate (older) versions of clang? If so, in what locations have Xcode and/or clang been installed?

I've reproduced the issue on a system with Xcode 6.0.1 installed and updated the sbhc.py script on master to resolve the issue. The update uses a different approach than before to determine the superclass for a given interface declaration.

Fixed as of f968c31

Sorry for my late reply. Yes, I can confirm that the issue is fixed for me too. Thank you!