objc_selector definition problem

Hi,

In Sema.cpp, the SEL type is declared as a pointer to a struct objc_selector, which is an opaque type. There seems to be a problem defining this. When compiling a trivial Objective-C program[1] the following error appears:

/usr/include/objc/objc.h:63:14: error: incomplete definition of type 'objc_selector'
     return s1->sel_id == s2->sel_id;
            ~~^

It appears that the objc_selector type is still treated as opaque, even though it is now defined. The objc.h header contains:

typedef const struct objc_selector
{
   void *sel_id;
   const char *sel_types;
} *SEL;

inline static BOOL
sel_eq (SEL s1, SEL s2)
{
   if (s1 == 0 || s2 == 0)
     return s1 == s2;
   else
     return s1->sel_id == s2->sel_id;
}

The penultimate line in this listing is the one which raises the error, even though the objc_selector type is defined immediately before the function.

Note: This compiles fine as a C program, where the implicit definition of objc_selector is not present.

David

[1]
#include <objc/objc.h>

int main(void)
{
     return 0;
}

David,

I just fixed this for you (http://llvm.org/viewvc/llvm-project?view=rev&revision=47538).

Please note the FIXME. If the other ObjC decls are giving you a problem, feel free to move the rest of them. I'd do it, however I'm working on some other stuff at the moment.

Thanks for the bug!

snaroff