Objective-C: Missing superclass child node

Hello,

I’ve written a python script (https://github.com/tingraldi/SwiftScripting/blob/master/sbhc.py) that uses libclang to translate Objective-C header files to Swift. This is solely intended to be used in relation to exposing Scripting Bridge interfaces to Swift code.

Some users have reported problems when running the script and the common symptom of the issues reported is that when traversing the source tree using a cursor, the superclass child of an interface definition is missing.

Example interface:

@interface iNumbersApplication : SBApplication

  • (SBElementArray *) documents;

  • (SBElementArray *) windows;

@property (copy, readonly) NSString *name; // The name of the application.

@property (readonly) BOOL frontmost; // Is this the active application?

@property (copy, readonly) NSString *version; // The version number of the application.

  • (id) open:(id)x; // Open a document.

  • (void) print:(id)x withProperties:(NSDictionary *)withProperties printDialog:(BOOL)printDialog; // Print a document.

  • (void) quitSaving:(iNumbersSaveOptions)saving; // Quit the application.

  • (BOOL) exists:(id)x; // Verify that an object exists.

@end

On a system that is working properly, the children of the iNumbersApplication node are as follows

[(‘SBApplication’, CursorKind.OBJC_SUPER_CLASS_REF),
(‘documents’, CursorKind.OBJC_INSTANCE_METHOD_DECL),
(‘windows’, CursorKind.OBJC_INSTANCE_METHOD_DECL),
(‘name’, CursorKind.OBJC_PROPERTY_DECL),
(‘frontmost’, CursorKind.OBJC_PROPERTY_DECL),
(‘version’, CursorKind.OBJC_PROPERTY_DECL),
(‘open:’, CursorKind.OBJC_INSTANCE_METHOD_DECL),
(‘print:withProperties:printDialog:’, CursorKind.OBJC_INSTANCE_METHOD_DECL),
(‘quitSaving:’, CursorKind.OBJC_INSTANCE_METHOD_DECL),
(‘exists:’, CursorKind.OBJC_INSTANCE_METHOD_DECL),
(‘name’, CursorKind.OBJC_INSTANCE_METHOD_DECL),
(‘frontmost’, CursorKind.OBJC_INSTANCE_METHOD_DECL),
(‘version’, CursorKind.OBJC_INSTANCE_METHOD_DECL)]

On a system that exhibits the failure, the children are as follows

[(‘documents’, CursorKind.OBJC_INSTANCE_METHOD_DECL),
(‘windows’, CursorKind.OBJC_INSTANCE_METHOD_DECL),
(‘name’, CursorKind.OBJC_PROPERTY_DECL),
(‘frontmost’, CursorKind.OBJC_PROPERTY_DECL),
(‘version’, CursorKind.OBJC_PROPERTY_DECL),
(‘open:’, CursorKind.OBJC_INSTANCE_METHOD_DECL),
(‘print:withProperties:printDialog:’, CursorKind.OBJC_INSTANCE_METHOD_DECL),
(‘quitSaving:’, CursorKind.OBJC_INSTANCE_METHOD_DECL),
(‘exists:’, CursorKind.OBJC_INSTANCE_METHOD_DECL),
(‘name’, CursorKind.OBJC_INSTANCE_METHOD_DECL),
(‘frontmost’, CursorKind.OBJC_INSTANCE_METHOD_DECL),
(‘version’, CursorKind.OBJC_INSTANCE_METHOD_DECL)]

Note that the SBApplication child is not present.

The only difference that I’ve noted between a working system and a non-working system is the LANG setting. The script works as expected on en_US.UTF-8 systems and is failing on a system configured for de_DE.UTF-8.

I’ve manually set the LANG environment variable on my system to de_DE.UTF-8 and the script still functions properly with this change. Could LANG/LOCALE be the source of the problem here?

Any suggestions as to what might be the cause would be greatly appreciated.

Thank you.