RFC: Removing ObjC1 from LangOptions

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

RFC: Removing ObjC1 from LangOptions

via cfe-dev
Hi everyone,

It looks like we never set LangOptions::ObjC1 without also setting
LangOptions::ObjC2. This is a distinction without a difference, and only
leads to pointless confusion. Would anyone have a problem with me
replacing all uses of ObjC2 and ObjC1 with a new option, ObjC?

Thanks!
Erik
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: RFC: Removing ObjC1 from LangOptions

via cfe-dev
> On Sep 21, 2018, at 2:07 PM, Erik Pilkington via cfe-dev <[hidden email]> wrote:
> Hi everyone,
>
> It looks like we never set LangOptions::ObjC1 without also setting LangOptions::ObjC2. This is a distinction without a difference, and only leads to pointless confusion. Would anyone have a problem with me replacing all uses of ObjC2 and ObjC1 with a new option, ObjC?

That seems reasonable to me.

John.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: RFC: Removing ObjC1 from LangOptions

via cfe-dev
In reply to this post by via cfe-dev
Erik Pilkington via cfe-dev schrieb:
> Hi everyone,
>
> It looks like we never set LangOptions::ObjC1 without also setting
> LangOptions::ObjC2. This is a distinction without a difference, and only
> leads to pointless confusion. Would anyone have a problem with me
> replacing all uses of ObjC2 and ObjC1 with a new option, ObjC?
>
> Thanks!

I am not saying I myself would have a problem with that. But I don't see
this as a distinction without difference, when I grep through the sources.

If you're compiling via libclang, couldn't you set ObjC1 YES and ObjC2
NO and reduce the available Objective-C language feature set for example ?

Ciao
    Nat!

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: RFC: Removing ObjC1 from LangOptions

via cfe-dev
On 22 Sep 2018, at 15:34, Nat! via cfe-dev <[hidden email]> wrote:
>
> I am not saying I myself would have a problem with that. But I don't see this as a distinction without difference, when I grep through the sources.
>
> If you're compiling via libclang, couldn't you set ObjC1 YES and ObjC2 NO and reduce the available Objective-C language feature set for example ?

I agree that this is a useful feature, however the OBJC1 vs OBJC2 flag hasn’t been the recommended way of doing this for about 7-8 years (in fact, I think, since before libclang existed).  The -fobjc-runtime= flag lets you specify the target runtime, which defines the feature set.

The one thing that we don’t expose is a way of restricting yourself to a subset of language features that GCC or an older version of Clang supports.  I can imagine that this would be a useful thing to expose (though, ideally, via a set of -Wcompat-* warnings), but even some no-longer-supported versions of GCC support a greater subset of Objective-C features than those gated on the OBJC1 flag.  If someone wanted to provide a set of warnings for each of the newer features, so that an IDE could easily construct a set of flags that triggered warnings on code that wouldn’t compile with, say, clang 3.9 or gcc 6, I’d be happy to review them, but I don’t think it’s something that’s in particularly high demand at the moment.

David

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: RFC: Removing ObjC1 from LangOptions

via cfe-dev
In reply to this post by via cfe-dev
I put a patch up on phab to do this here: https://reviews.llvm.org/D53547


On 9/21/18 11:07 AM, Erik Pilkington wrote:
> Hi everyone,
>
> It looks like we never set LangOptions::ObjC1 without also setting
> LangOptions::ObjC2. This is a distinction without a difference, and
> only leads to pointless confusion. Would anyone have a problem with me
> replacing all uses of ObjC2 and ObjC1 with a new option, ObjC?
>
> Thanks!
> Erik

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev