theos / logos

Preprocessor that simplifies Objective-C hooking.
https://theos.dev/docs/logos
Other
206 stars 34 forks source link

`super` in %subclass is dodgy #63

Closed jacobcxdev closed 4 years ago

jacobcxdev commented 4 years ago

What are the steps to reproduce this issue?

  1. Subclass an Objective-C class with %subclass.
  2. Call [super aMethod], where aMethod is a valid method, in a method.
  3. use of undeclared identifier 'super'.

What happens?

use of undeclared identifier 'super'.

What were you expecting to happen?

Succesful compilation.

Any logs, error output, etc?

Par example:

iDUTagCreationAlertCollectionViewController.x:36:13: error: use of undeclared identifier 'super'
    self = [super initWithCoder:coder];
            ^

Any other comments?

Nope.

What versions of software are you using?

Operating System: macOS 10.15.4

Toolchain Version:

SDK Version: 13.4

kirb commented 4 years ago

I think we discussed this in private already - but super won’t work here. You can instead use %orig like you would in a hook. If that’s insufficient, e.g. if you have to call something on super other than the current method, you’ll need to use objc_msgSendSuper() directly. The syntax for us to handle that would be pretty complex to get right, and it doesn’t seem to be a common problem at all, so I don’t think we’ll implement any super handling in Logos.