[cfe-commits] [PATCH] Add -fobjc-direct-class-refs

John McCall rjmccall at apple.com
Wed Jul 11 22:56:29 PDT 2012

On Jul 11, 2012, at 7:32 PM, Jonathan Schleifer wrote:
> Am 12.07.2012 um 04:21 schrieb John McCall:
>> On Jul 11, 2012, at 6:05 PM, Jonathan Schleifer wrote:
>>> Am 12.07.2012 um 02:58 schrieb John McCall:
>>>> Subscripting on objects has an existing meaning in fragile runtimes:  it's pointer arithmetic.  Is that meaning useful?  Well, possibly not, but nonetheless such code has historically been valid.
>>> As such code does not exist for ObjFW as there is not that historical part, I'd like to just forbid pointer arithmetics and allow subscripts.
>> That seems totally reasonable.
> Ok, then I'll add it using the way you described before.
>> I added a test case (please do include tests in your patches!) and committed this as r160102.
> Nice!
> I'm not exactly sure as to how these tests work. From looking at the commit, it seems it's ObjC code with comments that first specify the command to compile and then define the expected in LLVM ASM?

Yep.  There are a lot of examples in the various CodeGen test directories.  You can run "lit -v path/to/test" to run a specific test.  I usually write tests by introducing a CHECK line that I know will break, then "stealing" the command line from the failure log, piping the result through less instead of FileCheck, finding the appropriate area of output and checking carefully that it looks right, and then coming up with patterns that test for the things that I'm specifically interested in.

You may also find yourself wanting to test that certain errors do or not occur;  for that, you want a -verify test, which would go in test/SemaObjC (where there are many examples of -verify tests).

>> For the record, I should establish a policy here and give you some fair warning.  We're happy to keep support for ObjFW in the tree as long as you're maintaining your runtime.  If it ever looks like it's become a dead project, and we can't reach any maintainers for an extended period of time, we reserve the right to strip this code out as bit-rotted.  Okay?
> That sounds fair. Please contact me at this e-mail address if there are any questions regarding the ObjFW support. As long as you don't remove it without contacting me, everything is fine by me :).

We definitely won't rip it out without asking.


More information about the cfe-commits mailing list