clang  6.0.0svn
Public Types | Public Member Functions | Friends | List of all members
clang::ObjCRuntime Class Reference

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 ()
 A bogus initialization of the runtime. More...
 
 ObjCRuntime (Kind kind, const VersionTuple &version)
 
void set (Kind kind, VersionTuple version)
 
Kind getKind () const
 
const VersionTuplegetVersion () 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 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)
 

Detailed Description

The basic abstraction for the target Objective-C runtime.

Definition at line 25 of file ObjCRuntime.h.

Member Enumeration Documentation

◆ Kind

The basic Objective-C runtimes that we know about.

Enumerator
MacOSX 

'macosx' is the Apple-provided NeXT-derived runtime on Mac OS X platforms that use the non-fragile ABI; the version is a release of that OS.

FragileMacOSX 

'macosx-fragile' is the Apple-provided NeXT-derived runtime on Mac OS X platforms that use the fragile ABI; the version is a release of that OS.

iOS 

'ios' is the Apple-provided NeXT-derived runtime on iOS or the iOS simulator; it is always non-fragile.

The version is a release version of iOS.

WatchOS 

'watchos' is a variant of iOS for Apple's watchOS.

The version is a release version of watchOS.

GCC 

'gcc' is the Objective-C runtime shipped with GCC, implementing a fragile Objective-C ABI

GNUstep 

'gnustep' is the modern non-fragile GNUstep runtime.

ObjFW 

'objfw' is the Objective-C runtime included in ObjFW

Definition at line 28 of file ObjCRuntime.h.

Constructor & Destructor Documentation

◆ ObjCRuntime() [1/2]

clang::ObjCRuntime::ObjCRuntime ( )
inline

A bogus initialization of the runtime.

Definition at line 65 of file ObjCRuntime.h.

◆ ObjCRuntime() [2/2]

clang::ObjCRuntime::ObjCRuntime ( Kind  kind,
const VersionTuple version 
)
inline

Definition at line 67 of file ObjCRuntime.h.

Member Function Documentation

◆ allowsARC()

bool clang::ObjCRuntime::allowsARC ( ) const
inline

Does this runtime allow ARC at all?

Definition at line 140 of file ObjCRuntime.h.

References FragileMacOSX, GCC, getKind(), getVersion(), GNUstep, iOS, MacOSX, ObjFW, and WatchOS.

Referenced by ParseLangArgs().

◆ allowsPointerArithmetic()

bool clang::ObjCRuntime::allowsPointerArithmetic ( ) const
inline

Does this runtime allow pointer arithmetic on objects?

This covers +, -, ++, –, and (if isSubscriptPointerArithmetic() yields true) [].

Definition at line 233 of file ObjCRuntime.h.

References FragileMacOSX, GCC, getKind(), GNUstep, iOS, MacOSX, ObjFW, and WatchOS.

Referenced by isSubscriptPointerArithmetic().

◆ allowsSizeofAlignof()

bool clang::ObjCRuntime::allowsSizeofAlignof ( ) const
inline

Does this runtime allow sizeof or alignof on object types?

Definition at line 225 of file ObjCRuntime.h.

References isFragile().

◆ allowsWeak()

bool clang::ObjCRuntime::allowsWeak ( ) const
inline

Does this runtime allow the use of __weak?

Definition at line 192 of file ObjCRuntime.h.

References hasNativeWeak().

Referenced by ParseLangArgs(), and RenderObjCOptions().

◆ getAsString()

std::string ObjCRuntime::getAsString ( ) const

Definition at line 19 of file ObjCRuntime.cpp.

References clang::Result.

Referenced by hasEmptyCollections(), and clang::driver::tools::Clang::~Clang().

◆ getKind()

Kind clang::ObjCRuntime::getKind ( ) const
inline

◆ getVersion()

const VersionTuple& clang::ObjCRuntime::getVersion ( ) const
inline

◆ hasARCUnsafeClaimAutoreleasedReturnValue()

bool clang::ObjCRuntime::hasARCUnsafeClaimAutoreleasedReturnValue ( ) const
inline

Is objc_unsafeClaimAutoreleasedReturnValue available?

Definition at line 312 of file ObjCRuntime.h.

References FragileMacOSX, getKind(), getVersion(), GNUstep, iOS, MacOSX, and WatchOS.

◆ hasAtomicCopyHelper()

bool clang::ObjCRuntime::hasAtomicCopyHelper ( ) const
inline

◆ hasEmptyCollections()

bool clang::ObjCRuntime::hasEmptyCollections ( ) const
inline

Are the empty collection symbols available?

Definition at line 330 of file ObjCRuntime.h.

References getAsString(), getKind(), getVersion(), iOS, MacOSX, tryParse(), and WatchOS.

◆ hasNativeARC()

bool clang::ObjCRuntime::hasNativeARC ( ) const
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 160 of file ObjCRuntime.h.

References FragileMacOSX, GCC, getKind(), getVersion(), GNUstep, iOS, MacOSX, ObjFW, and WatchOS.

Referenced by clang::driver::toolchains::DarwinClang::AddLinkARCArgs(), and hasNativeWeak().

◆ hasNativeWeak()

bool clang::ObjCRuntime::hasNativeWeak ( ) const
inline

Does this runtime natively provide ARC-compliant 'weak' entrypoints?

Definition at line 198 of file ObjCRuntime.h.

References hasNativeARC().

Referenced by allowsWeak().

◆ hasOptimizedSetter()

bool clang::ObjCRuntime::hasOptimizedSetter ( ) const
inline

Does this runtime supports optimized setter entrypoints?

Definition at line 175 of file ObjCRuntime.h.

References getKind(), getVersion(), GNUstep, iOS, MacOSX, and WatchOS.

Referenced by UseOptimizedSetter().

◆ hasSubscripting()

bool clang::ObjCRuntime::hasSubscripting ( ) const
inline

Does this runtime directly support the subscripting methods?

This is really a property of the library, not the runtime.

Definition at line 207 of file ObjCRuntime.h.

References FragileMacOSX, GCC, getKind(), getVersion(), GNUstep, iOS, MacOSX, ObjFW, and WatchOS.

Referenced by clang::driver::toolchains::DarwinClang::AddLinkARCArgs().

◆ hasTerminate()

bool clang::ObjCRuntime::hasTerminate ( ) const
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 257 of file ObjCRuntime.h.

References FragileMacOSX, GCC, getKind(), getVersion(), GNUstep, iOS, MacOSX, ObjFW, and WatchOS.

Referenced by clang::CodeGen::CodeGenModule::getTerminateFn().

◆ hasUnwindExceptions()

bool clang::ObjCRuntime::hasUnwindExceptions ( ) const
inline

Does this runtime use zero-cost exceptions?

Definition at line 285 of file ObjCRuntime.h.

References FragileMacOSX, GCC, getKind(), GNUstep, iOS, MacOSX, ObjFW, and WatchOS.

Referenced by hasUnwindExceptions().

◆ hasWeakClassImport()

bool clang::ObjCRuntime::hasWeakClassImport ( ) const
inline

Does this runtime support weakly importing classes?

Definition at line 271 of file ObjCRuntime.h.

References FragileMacOSX, GCC, getKind(), GNUstep, iOS, MacOSX, ObjFW, and WatchOS.

Referenced by clang::Decl::canBeWeakImported(), and HasFeature().

◆ isFragile()

bool clang::ObjCRuntime::isFragile ( ) const
inline

The inverse of isNonFragile(): does this runtime follow the set of implied behaviors for a "fragile" ABI?

Definition at line 95 of file ObjCRuntime.h.

References isNonFragile().

Referenced by allowsSizeofAlignof().

◆ isGNUFamily()

bool clang::ObjCRuntime::isGNUFamily ( ) const
inline

Is this runtime basically of the GNU family of runtimes?

Definition at line 117 of file ObjCRuntime.h.

References FragileMacOSX, GCC, getKind(), GNUstep, iOS, MacOSX, ObjFW, and WatchOS.

Referenced by isNeXTFamily().

◆ isLegacyDispatchDefaultForArch()

bool clang::ObjCRuntime::isLegacyDispatchDefaultForArch ( llvm::Triple::ArchType  Arch)
inline

The default dispatch mechanism to use for the specified architecture.

Definition at line 98 of file ObjCRuntime.h.

References getKind(), getVersion(), GNUstep, isNonFragile(), and MacOSX.

Referenced by RenderObjCOptions().

◆ isNeXTFamily()

bool clang::ObjCRuntime::isNeXTFamily ( ) const
inline

Is this runtime basically of the NeXT family of runtimes?

Definition at line 133 of file ObjCRuntime.h.

References isGNUFamily().

Referenced by RenderObjCOptions().

◆ isNonFragile()

bool clang::ObjCRuntime::isNonFragile ( ) const
inline

◆ isSubscriptPointerArithmetic()

bool clang::ObjCRuntime::isSubscriptPointerArithmetic ( ) const
inline

Is subscripting pointer arithmetic?

Definition at line 249 of file ObjCRuntime.h.

References allowsPointerArithmetic().

Referenced by clang::LangOptions::isSubscriptPointerArithmetic().

◆ set()

void clang::ObjCRuntime::set ( Kind  kind,
VersionTuple  version 
)
inline

Definition at line 70 of file ObjCRuntime.h.

◆ tryParse()

bool ObjCRuntime::tryParse ( StringRef  input)

Try to parse an Objective-C runtime specification from the given string.

Returns
true on error.

Definition at line 44 of file ObjCRuntime.cpp.

References FragileMacOSX, GCC, GNUstep, iOS, MacOSX, ObjFW, clang::VersionTuple::tryParse(), and WatchOS.

Referenced by hasEmptyCollections(), ParseLangArgs(), and clang::driver::tools::Clang::~Clang().

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const ObjCRuntime left,
const ObjCRuntime right 
)
friend

Definition at line 356 of file ObjCRuntime.h.

◆ operator==

bool operator== ( const ObjCRuntime left,
const ObjCRuntime right 
)
friend

Definition at line 351 of file ObjCRuntime.h.


The documentation for this class was generated from the following files: