__has_feature() for the non-fragile ABI

Hi,

This tiny patch adds a __has_feature(objc_nonfragile_abi) when compiling with -fobjc-nonfragile-abi. This lets us hide instance variables in headers from the compiler when compiling with the non-fragile ABI or even hard-error when we are not if the header does not define ivars and so will break with the fragile ABI.

I was wondering slightly about whether we should be able to automatically generate some of these. Currently this and __has_feature(blocks) are the only two that are dependent on language options, but possibly in future we might want to add the means to automatically map certain options to __has_feature() definitions.

Any objections if I commit this?

David

clang.diff (556 Bytes)

Hi,

This tiny patch adds a __has_feature(objc_nonfragile_abi) when compiling with -fobjc-nonfragile-abi. This lets us hide instance variables in headers from the compiler when compiling with the non-fragile ABI or even hard-error when we are not if the header does not define ivars and so will break with the fragile ABI.

I was wondering slightly about whether we should be able to automatically generate some of these. Currently this and __has_feature(blocks) are the only two that are dependent on language options, but possibly in future we might want to add the means to automatically map certain options to __has_feature() definitions.

Any objections if I commit this?

OK with me. Please add a test case.

- Fariborz

I agree, thanks!

-Chris