clang
8.0.0
|
The basic abstraction for the target Objective-C runtime. More...
#include "clang/Basic/ObjCRuntime.h"
Public Types | |
enum | Kind { MacOSX, FragileMacOSX, iOS, WatchOS, GCC, GNUstep, ObjFW } |
The basic Objective-C runtimes that we know about. More... | |
Public Member Functions | |
ObjCRuntime ()=default | |
A bogus initialization of the runtime. More... | |
ObjCRuntime (Kind kind, const VersionTuple &version) | |
void | set (Kind kind, VersionTuple version) |
Kind | getKind () const |
const VersionTuple & | getVersion () const |
bool | isNonFragile () const |
Does this runtime follow the set of implied behaviors for a "non-fragile" ABI? More... | |
bool | isFragile () const |
The inverse of isNonFragile(): does this runtime follow the set of implied behaviors for a "fragile" ABI? More... | |
bool | isLegacyDispatchDefaultForArch (llvm::Triple::ArchType Arch) |
The default dispatch mechanism to use for the specified architecture. More... | |
bool | isGNUFamily () const |
Is this runtime basically of the GNU family of runtimes? More... | |
bool | isNeXTFamily () const |
Is this runtime basically of the NeXT family of runtimes? More... | |
bool | allowsARC () const |
Does this runtime allow ARC at all? More... | |
bool | hasNativeARC () const |
Does this runtime natively provide the ARC entrypoints? More... | |
bool | shouldUseARCFunctionsForRetainRelease () const |
Does this runtime provide ARC entrypoints that are likely to be faster than an ordinary message send of the appropriate selector? More... | |
bool | shouldUseRuntimeFunctionsForAlloc () const |
Does this runtime provide entrypoints that are likely to be faster than an ordinary message send of the "alloc" selector? More... | |
bool | hasOptimizedSetter () const |
Does this runtime supports optimized setter entrypoints? More... | |
bool | allowsWeak () const |
Does this runtime allow the use of __weak? More... | |
bool | hasNativeWeak () const |
Does this runtime natively provide ARC-compliant 'weak' entrypoints? More... | |
bool | hasSubscripting () const |
Does this runtime directly support the subscripting methods? More... | |
bool | allowsSizeofAlignof () const |
Does this runtime allow sizeof or alignof on object types? More... | |
bool | allowsPointerArithmetic () const |
Does this runtime allow pointer arithmetic on objects? More... | |
bool | isSubscriptPointerArithmetic () const |
Is subscripting pointer arithmetic? More... | |
bool | hasTerminate () const |
Does this runtime provide an objc_terminate function? More... | |
bool | hasWeakClassImport () const |
Does this runtime support weakly importing classes? More... | |
bool | hasUnwindExceptions () const |
Does this runtime use zero-cost exceptions? More... | |
bool | hasAtomicCopyHelper () const |
bool | hasARCUnsafeClaimAutoreleasedReturnValue () const |
Is objc_unsafeClaimAutoreleasedReturnValue available? More... | |
bool | hasEmptyCollections () const |
Are the empty collection symbols available? More... | |
bool | tryParse (StringRef input) |
Try to parse an Objective-C runtime specification from the given string. More... | |
std::string | getAsString () const |
Friends | |
bool | operator== (const ObjCRuntime &left, const ObjCRuntime &right) |
bool | operator!= (const ObjCRuntime &left, const ObjCRuntime &right) |
The basic abstraction for the target Objective-C runtime.
Definition at line 28 of file ObjCRuntime.h.
The basic Objective-C runtimes that we know about.
Definition at line 31 of file ObjCRuntime.h.
|
default |
A bogus initialization of the runtime.
|
inline |
Definition at line 69 of file ObjCRuntime.h.
|
inline |
Does this runtime allow ARC at all?
Definition at line 142 of file ObjCRuntime.h.
References FragileMacOSX, GCC, getKind(), getVersion(), GNUstep, iOS, MacOSX, ObjFW, and WatchOS.
|
inline |
Does this runtime allow pointer arithmetic on objects?
This covers +, -, ++, –, and (if isSubscriptPointerArithmetic() yields true) [].
Definition at line 308 of file ObjCRuntime.h.
References FragileMacOSX, GCC, getKind(), GNUstep, iOS, MacOSX, ObjFW, and WatchOS.
Referenced by isSubscriptPointerArithmetic().
|
inline |
Does this runtime allow sizeof or alignof on object types?
Definition at line 300 of file ObjCRuntime.h.
References isFragile().
|
inline |
Does this runtime allow the use of __weak?
Definition at line 267 of file ObjCRuntime.h.
References hasNativeWeak().
Referenced by RenderObjCOptions().
std::string ObjCRuntime::getAsString | ( | ) | const |
Definition at line 24 of file ObjCRuntime.cpp.
References clang::Result.
Referenced by hasEmptyCollections(), and clang::driver::tools::Clang::~Clang().
|
inline |
Definition at line 77 of file ObjCRuntime.h.
Referenced by allowsARC(), allowsPointerArithmetic(), getObjCPersonality(), getObjCXXPersonality(), hasARCUnsafeClaimAutoreleasedReturnValue(), hasAtomicCopyHelper(), hasEmptyCollections(), hasNativeARC(), hasOptimizedSetter(), hasSubscripting(), hasTerminate(), hasUnwindExceptions(), hasWeakClassImport(), isGNUFamily(), isLegacyDispatchDefaultForArch(), isNonFragile(), clang::operator<<(), RenderObjCOptions(), shouldUseARCFunctionsForRetainRelease(), shouldUseRuntimeFunctionsForAlloc(), clang::driver::tools::Clang::~Clang(), and clang::CodeGen::CodeGenModule::~CodeGenModule().
|
inline |
Definition at line 78 of file ObjCRuntime.h.
Referenced by allowsARC(), getObjCPersonality(), hasARCUnsafeClaimAutoreleasedReturnValue(), hasAtomicCopyHelper(), hasEmptyCollections(), hasNativeARC(), hasOptimizedSetter(), hasSubscripting(), hasTerminate(), isLegacyDispatchDefaultForArch(), clang::operator<<(), shouldUseARCFunctionsForRetainRelease(), shouldUseRuntimeFunctionsForAlloc(), and clang::driver::tools::Clang::~Clang().
|
inline |
Is objc_unsafeClaimAutoreleasedReturnValue available?
Definition at line 387 of file ObjCRuntime.h.
References FragileMacOSX, getKind(), getVersion(), GNUstep, iOS, MacOSX, and WatchOS.
Referenced by clang::CodeGen::CodeGenFunction::EmitARCReclaimReturnedObject().
|
inline |
Definition at line 373 of file ObjCRuntime.h.
References FragileMacOSX, getKind(), getVersion(), GNUstep, iOS, MacOSX, and WatchOS.
Referenced by clang::CodeGen::CodeGenFunction::GenerateObjCAtomicGetterCopyHelperFunction(), and clang::CodeGen::CodeGenFunction::GenerateObjCAtomicSetterCopyHelperFunction().
|
inline |
Are the empty collection symbols available?
Definition at line 404 of file ObjCRuntime.h.
References getAsString(), getKind(), getVersion(), iOS, MacOSX, tryParse(), and WatchOS.
Referenced by clang::Sema::MaybeBindToTemporary().
|
inline |
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.
Definition at line 162 of file ObjCRuntime.h.
References FragileMacOSX, GCC, getKind(), getVersion(), GNUstep, iOS, MacOSX, ObjFW, and WatchOS.
Referenced by clang::driver::toolchains::DarwinClang::AddLinkARCArgs(), hasNativeWeak(), and setARCRuntimeFunctionLinkage().
|
inline |
Does this runtime natively provide ARC-compliant 'weak' entrypoints?
Definition at line 273 of file ObjCRuntime.h.
References hasNativeARC().
Referenced by allowsWeak().
|
inline |
Does this runtime supports optimized setter entrypoints?
Definition at line 251 of file ObjCRuntime.h.
References getKind(), getVersion(), GNUstep, iOS, MacOSX, and WatchOS.
Referenced by UseOptimizedSetter().
|
inline |
Does this runtime directly support the subscripting methods?
This is really a property of the library, not the runtime.
Definition at line 282 of file ObjCRuntime.h.
References FragileMacOSX, GCC, getKind(), getVersion(), GNUstep, iOS, MacOSX, ObjFW, and WatchOS.
Referenced by clang::driver::toolchains::DarwinClang::AddLinkARCArgs().
|
inline |
Does this runtime provide an objc_terminate function?
This is used in handlers for exceptions during the unwind process; without it, abort() must be used in pure ObjC files.
Definition at line 332 of file ObjCRuntime.h.
References FragileMacOSX, GCC, getKind(), getVersion(), GNUstep, iOS, MacOSX, ObjFW, and WatchOS.
Referenced by clang::CodeGen::CodeGenModule::getTerminateFn().
|
inline |
Does this runtime use zero-cost exceptions?
Definition at line 360 of file ObjCRuntime.h.
References FragileMacOSX, GCC, getKind(), GNUstep, iOS, MacOSX, ObjFW, and WatchOS.
Referenced by hasUnwindExceptions().
|
inline |
Does this runtime support weakly importing classes?
Definition at line 346 of file ObjCRuntime.h.
References FragileMacOSX, GCC, getKind(), GNUstep, iOS, MacOSX, ObjFW, and WatchOS.
Referenced by clang::Decl::canBeWeakImported().
|
inline |
The inverse of isNonFragile(): does this runtime follow the set of implied behaviors for a "fragile" ABI?
Definition at line 97 of file ObjCRuntime.h.
References isNonFragile().
Referenced by allowsSizeofAlignof().
|
inline |
Is this runtime basically of the GNU family of runtimes?
Definition at line 119 of file ObjCRuntime.h.
References FragileMacOSX, GCC, getKind(), GNUstep, iOS, MacOSX, ObjFW, and WatchOS.
Referenced by isNeXTFamily().
|
inline |
The default dispatch mechanism to use for the specified architecture.
Definition at line 100 of file ObjCRuntime.h.
References getKind(), getVersion(), GNUstep, isNonFragile(), and MacOSX.
Referenced by RenderObjCOptions().
|
inline |
Is this runtime basically of the NeXT family of runtimes?
Definition at line 135 of file ObjCRuntime.h.
References isGNUFamily().
Referenced by PersonalityHasOnlyCXXUses(), and RenderObjCOptions().
|
inline |
Does this runtime follow the set of implied behaviors for a "non-fragile" ABI?
Definition at line 82 of file ObjCRuntime.h.
References FragileMacOSX, GCC, getKind(), GNUstep, iOS, MacOSX, ObjFW, and WatchOS.
Referenced by clang::Sema::CheckImplementationIvars(), clang::RewriteObjCAction::CreateASTConsumer(), FindIvarInterface(), isFragile(), isLegacyDispatchDefaultForArch(), clang::CodeGen::CGDebugInfo::remapDIPath(), RenderObjCOptions(), and shouldUseExceptionTablesForObjCExceptions().
|
inline |
Is subscripting pointer arithmetic?
Definition at line 324 of file ObjCRuntime.h.
References allowsPointerArithmetic().
Referenced by clang::LangOptions::isSubscriptPointerArithmetic().
|
inline |
Definition at line 72 of file ObjCRuntime.h.
|
inline |
Does this runtime provide ARC entrypoints that are likely to be faster than an ordinary message send of the appropriate selector?
The ARC entrypoints are guaranteed to be equivalent to just sending the corresponding message. If the entrypoint is implemented naively as just a message send, using it is a trade-off: it sacrifices a few cycles of overhead to save a small amount of code. However, it's possible for runtimes to detect and special-case classes that use "standard" retain/release behavior; if that's dynamically a large proportion of all retained objects, using the entrypoint will also be faster than using a message send.
When this method returns true, Clang will turn non-super message sends of certain selectors into calls to the correspond entrypoint: retain => objc_retain release => objc_release autorelease => objc_autorelease
Definition at line 193 of file ObjCRuntime.h.
References FragileMacOSX, GCC, getKind(), getVersion(), GNUstep, iOS, MacOSX, ObjFW, and WatchOS.
|
inline |
Does this runtime provide entrypoints that are likely to be faster than an ordinary message send of the "alloc" selector?
The "alloc" entrypoint is guaranteed to be equivalent to just sending the corresponding message. If the entrypoint is implemented naively as just a message send, using it is a trade-off: it sacrifices a few cycles of overhead to save a small amount of code. However, it's possible for runtimes to detect and special-case classes that use "standard" alloc behavior; if that's dynamically a large proportion of all objects, using the entrypoint will also be faster than using a message send.
When this method returns true, Clang will turn non-super message sends of certain selectors into calls to the corresponding entrypoint: alloc => objc_alloc allocWithZone:nil => objc_allocWithZone
Definition at line 229 of file ObjCRuntime.h.
References FragileMacOSX, GCC, getKind(), getVersion(), GNUstep, iOS, MacOSX, ObjFW, and WatchOS.
bool ObjCRuntime::tryParse | ( | StringRef | input | ) |
Try to parse an Objective-C runtime specification from the given string.
Definition at line 49 of file ObjCRuntime.cpp.
References FragileMacOSX, GCC, GNUstep, iOS, MacOSX, ObjFW, and WatchOS.
Referenced by hasEmptyCollections(), and clang::driver::tools::Clang::~Clang().
|
friend |
Definition at line 430 of file ObjCRuntime.h.
|
friend |
Definition at line 425 of file ObjCRuntime.h.