14#ifndef LLVM_CLANG_BASIC_OBJCRUNTIME_H
15#define LLVM_CLANG_BASIC_OBJCRUNTIME_H
18#include "llvm/ADT/StringRef.h"
19#include "llvm/Support/ErrorHandling.h"
20#include "llvm/Support/HashBuilder.h"
21#include "llvm/Support/VersionTuple.h"
22#include "llvm/TargetParser/Triple.h"
70 : TheKind(
kind), Version(version) {}
78 const VersionTuple &
getVersion()
const {
return Version; }
85 case GCC:
return false;
88 case ObjFW:
return true;
89 case iOS:
return true;
92 llvm_unreachable(
"bad kind");
105 case llvm::Triple::arm:
106 case llvm::Triple::x86:
107 case llvm::Triple::x86_64:
109 case llvm::Triple::aarch64:
110 case llvm::Triple::mips64:
112 case llvm::Triple::riscv64:
113 case llvm::Triple::riscv64be:
121 return Arch != llvm::Triple::x86_64;
140 llvm_unreachable(
"bad kind");
157 case iOS:
return true;
159 case GCC:
return false;
161 case ObjFW:
return true;
163 llvm_unreachable(
"bad kind");
178 case GCC:
return false;
180 case ObjFW:
return true;
182 llvm_unreachable(
"bad kind");
225 llvm_unreachable(
"bad kind");
262 llvm_unreachable(
"bad kind");
271 return getVersion() >= VersionTuple(10, 14, 4);
343 case GCC:
return true;
345 case ObjFW:
return true;
347 llvm_unreachable(
"bad kind");
371 llvm_unreachable(
"bad kind");
389 case GCC:
return false;
391 case ObjFW:
return false;
393 llvm_unreachable(
"bad kind");
400 case iOS:
return true;
403 case GCC:
return true;
405 case ObjFW:
return true;
407 llvm_unreachable(
"bad kind");
414 case iOS:
return true;
417 case GCC:
return true;
419 case ObjFW:
return true;
421 llvm_unreachable(
"bad kind");
433 default:
return false;
482 llvm_unreachable(
"bad kind");
490 case iOS:
return true;
492 case GCC:
return false;
495 case ObjFW:
return true;
497 llvm_unreachable(
"bad kind");
514 return !(left == right);
521 template <
typename HasherT, llvm::endianness Endianness>
522 friend void addHash(llvm::HashBuilder<HasherT, Endianness> &HBuilder,
528raw_ostream &
operator<<(raw_ostream &
out,
const ObjCRuntime &value);
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
*collection of selector each with an associated kind and an ordered *collection of selectors A selector has a kind
bool hasConstantEmptyCollections() const
bool allowsWeak() const
Does this runtime allow the use of __weak?
bool shouldUseRuntimeFunctionsForAlloc() const
Does this runtime provide entrypoints that are likely to be faster than an ordinary message send of t...
bool hasEmptyCollections() const
Are the empty collection symbols available?
friend bool operator!=(const ObjCRuntime &left, const ObjCRuntime &right)
bool hasAtomicCopyHelper() const
bool isSubscriptPointerArithmetic() const
Is subscripting pointer arithmetic?
bool shouldUseRuntimeFunctionForCombinedAllocInit() const
Does this runtime provide the objc_alloc_init entrypoint?
bool hasUnwindExceptions() const
Does this runtime use zero-cost exceptions?
friend bool operator==(const ObjCRuntime &left, const ObjCRuntime &right)
bool allowsSizeofAlignof() const
Does this runtime allow sizeof or alignof on object types?
bool hasARCUnsafeClaimAutoreleasedReturnValue() const
Is objc_unsafeClaimAutoreleasedReturnValue available?
void set(Kind kind, VersionTuple version)
bool hasTerminate() const
Does this runtime provide an objc_terminate function?
ObjCRuntime()=default
A bogus initialization of the runtime.
bool hasNativeARC() const
Does this runtime natively provide the ARC entrypoints?
bool isLegacyDispatchDefaultForArch(llvm::Triple::ArchType Arch)
The default dispatch mechanism to use for the specified architecture.
bool isNeXTFamily() const
Is this runtime basically of the NeXT family of runtimes?
bool hasConstantLiteralClasses() const
Are Foundation backed constant literal classes supported?
bool hasOptimizedSetter() const
Does this runtime supports optimized setter entrypoints?
bool hasNativeWeak() const
Does this runtime natively provide ARC-compliant 'weak' entrypoints?
ObjCRuntime(Kind kind, const VersionTuple &version)
bool allowsPointerArithmetic() const
Does this runtime allow pointer arithmetic on objects?
bool hasSubscripting() const
Does this runtime directly support the subscripting methods?
const VersionTuple & getVersion() const
bool tryParse(StringRef input)
Try to parse an Objective-C runtime specification from the given string.
bool isNonFragile() const
Does this runtime follow the set of implied behaviors for a "non-fragile" ABI?
std::string getAsString() const
friend llvm::hash_code hash_value(const ObjCRuntime &OCR)
bool hasWeakClassImport() const
Does this runtime support weakly importing classes?
bool hasConstantCFBooleans() const
bool isGNUFamily() const
Is this runtime basically of the GNU family of runtimes?
bool allowsARC() const
Does this runtime allow ARC at all?
bool allowsDirectDispatch() const
Does this runtime supports direct dispatch.
bool shouldUseARCFunctionsForRetainRelease() const
Does this runtime provide ARC entrypoints that are likely to be faster than an ordinary message send ...
friend void addHash(llvm::HashBuilder< HasherT, Endianness > &HBuilder, const ObjCRuntime &OCR)
Kind
The basic Objective-C runtimes that we know about.
@ MacOSX
'macosx' is the Apple-provided NeXT-derived runtime on Mac OS X platforms that use the non-fragile AB...
@ FragileMacOSX
'macosx-fragile' is the Apple-provided NeXT-derived runtime on Mac OS X platforms that use the fragil...
@ GNUstep
'gnustep' is the modern non-fragile GNUstep runtime.
@ ObjFW
'objfw' is the Objective-C runtime included in ObjFW
@ iOS
'ios' is the Apple-provided NeXT-derived runtime on iOS or the iOS simulator; it is always non-fragil...
@ GCC
'gcc' is the Objective-C runtime shipped with GCC, implementing a fragile Objective-C ABI
@ WatchOS
'watchos' is a variant of iOS for Apple's watchOS.
bool allowsClassStubs() const
Returns true if this Objective-C runtime supports Objective-C class stubs.
bool isFragile() const
The inverse of isNonFragile(): does this runtime follow the set of implied behaviors for a "fragile" ...
The JSON file list parser is used to communicate input to InstallAPI.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ConceptReference *C)
Insertion operator for diagnostics.