diff options
author | John McCall <rjmccall@apple.com> | 2012-08-21 02:47:43 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2012-08-21 02:47:43 +0000 |
commit | 0a7dd788dbef975f35f273c7ab913f480f7edd60 (patch) | |
tree | 4ff726c6ed21d7c822a307b124bf4fec48ffc89a /include/clang/Basic/ObjCRuntime.h | |
parent | eb8f2efb17c74620510a38cb437e792ea9c76021 (diff) |
Screw around with ObjCRuntime some more, changing the
diagnostics for bad deployment targets and adding a few
more predicates. Includes a patch by Jonathan Schleifer
to enable ARC for ObjFW.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162252 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/ObjCRuntime.h')
-rw-r--r-- | include/clang/Basic/ObjCRuntime.h | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/include/clang/Basic/ObjCRuntime.h b/include/clang/Basic/ObjCRuntime.h index b24fe7cd91..2ca421bb57 100644 --- a/include/clang/Basic/ObjCRuntime.h +++ b/include/clang/Basic/ObjCRuntime.h @@ -126,12 +126,25 @@ public: return !isGNUFamily(); } + /// \brief Does this runtime allow ARC at all? + bool allowsARC() const { + switch (getKind()) { + case FragileMacOSX: return false; + case MacOSX: return true; + case iOS: return true; + case GCC: return false; + case GNUstep: return true; + case ObjFW: return true; + } + llvm_unreachable("bad kind"); + } + /// \brief Does this runtime natively provide the ARC entrypoints? /// /// ARC cannot be directly supported on a platform that does not provide /// these entrypoints, although it may be supportable via a stub /// library. - bool hasARC() const { + bool hasNativeARC() const { switch (getKind()) { case FragileMacOSX: return false; case MacOSX: return getVersion() >= VersionTuple(10, 7); @@ -139,16 +152,22 @@ public: case GCC: return false; case GNUstep: return getVersion() >= VersionTuple(1, 6); - case ObjFW: return false; // XXX: this will change soon + case ObjFW: return true; } llvm_unreachable("bad kind"); } + /// Does this runtime allow the use of __weak? + bool allowsWeak() const { + return hasNativeWeak(); + } + /// \brief Does this runtime natively provide ARC-compliant 'weak' /// entrypoints? - bool hasWeak() const { - // Right now, this is always equivalent to the ARC decision. - return hasARC(); + bool hasNativeWeak() const { + // Right now, this is always equivalent to whether the runtime + // natively supports ARC decision. + return hasNativeARC(); } /// \brief Does this runtime directly support the subscripting methods? @@ -226,6 +245,7 @@ public: } llvm_unreachable("bad kind"); } + /// \brief Does this runtime use zero-cost exceptions? bool hasUnwindExceptions() const { switch (getKind()) { |