[cfe-dev] RFC: Removing ObjC1 from LangOptions
David Chisnall via cfe-dev
cfe-dev at lists.llvm.org
Sun Sep 23 03:24:30 PDT 2018
On 22 Sep 2018, at 15:34, Nat! via cfe-dev <cfe-dev at lists.llvm.org> 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
More information about the cfe-dev
mailing list