blob: 51d52ae1731f1076dae8ba8ab1791432abd651b3 [file] [log] [blame]
Daniel Dunbar303e2c22008-08-11 02:45:11 +00001//===----- CGObjCRuntime.h - Interface to ObjC Runtimes ---------*- C++ -*-===//
Chris Lattnerb7256cd2008-03-01 08:50:34 +00002//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Chris Lattnerb7256cd2008-03-01 08:50:34 +00006//
7//===----------------------------------------------------------------------===//
8//
9// This provides an abstract class for Objective-C code generation. Concrete
10// subclasses of this implement code generation for specific Objective-C
11// runtime libraries.
12//
13//===----------------------------------------------------------------------===//
14
Benjamin Kramer2f5db8b2014-08-13 16:25:19 +000015#ifndef LLVM_CLANG_LIB_CODEGEN_CGOBJCRUNTIME_H
16#define LLVM_CLANG_LIB_CODEGEN_CGOBJCRUNTIME_H
Daniel Dunbarcb463852008-11-01 01:53:16 +000017#include "CGBuilder.h"
Daniel Dunbar41cf9de2008-09-09 01:06:48 +000018#include "CGCall.h"
David Chisnall93ce0182018-08-10 12:53:13 +000019#include "CGCleanup.h"
Daniel Dunbarcb463852008-11-01 01:53:16 +000020#include "CGValue.h"
Chandler Carruth3a022472012-12-04 09:13:33 +000021#include "clang/AST/DeclObjC.h"
22#include "clang/Basic/IdentifierTable.h" // Selector
Daniel Dunbar97db84c2008-08-23 03:46:30 +000023
Chris Lattnerb7256cd2008-03-01 08:50:34 +000024namespace llvm {
Chris Lattnerb7256cd2008-03-01 08:50:34 +000025 class Constant;
Daniel Dunbar9fd114d2009-04-22 07:32:20 +000026 class Function;
27 class Module;
28 class StructLayout;
Daniel Dunbar7b4dfc82009-04-22 09:39:34 +000029 class StructType;
Chris Lattnerb7256cd2008-03-01 08:50:34 +000030 class Type;
31 class Value;
Chris Lattnerb7256cd2008-03-01 08:50:34 +000032}
33
34namespace clang {
Daniel Dunbar41cf9de2008-09-09 01:06:48 +000035namespace CodeGen {
36 class CodeGenFunction;
37}
Daniel Dunbar97db84c2008-08-23 03:46:30 +000038
Daniel Dunbar9fd114d2009-04-22 07:32:20 +000039 class FieldDecl;
Anders Carlsson1963b0c2008-09-09 10:04:29 +000040 class ObjCAtTryStmt;
41 class ObjCAtThrowStmt;
Chris Lattnere132e242008-11-15 21:26:17 +000042 class ObjCAtSynchronizedStmt;
Fariborz Jahanian0196a1c2009-01-10 21:06:09 +000043 class ObjCContainerDecl;
Daniel Dunbar92992502008-08-15 22:20:32 +000044 class ObjCCategoryImplDecl;
45 class ObjCImplementationDecl;
Daniel Dunbar7c6d3a72008-08-16 00:25:02 +000046 class ObjCInterfaceDecl;
Daniel Dunbar97db84c2008-08-23 03:46:30 +000047 class ObjCMessageExpr;
Daniel Dunbar92992502008-08-15 22:20:32 +000048 class ObjCMethodDecl;
Daniel Dunbar89da6ad2008-08-13 00:59:25 +000049 class ObjCProtocolDecl;
Chris Lattner6d522c02008-06-26 04:37:12 +000050 class Selector;
Fariborz Jahanian9f84b782009-02-02 20:02:29 +000051 class ObjCIvarDecl;
Steve Naroff66afeb52009-03-31 16:53:37 +000052 class ObjCStringLiteral;
Fariborz Jahanianc05349e2010-08-04 16:57:49 +000053 class BlockDeclRefExpr;
Daniel Dunbar89da6ad2008-08-13 00:59:25 +000054
Chris Lattnerb7256cd2008-03-01 08:50:34 +000055namespace CodeGen {
Chris Lattner87ab27d2008-06-26 04:19:03 +000056 class CodeGenModule;
John McCall351762c2011-02-07 10:33:21 +000057 class CGBlockInfo;
Chris Lattnerb7256cd2008-03-01 08:50:34 +000058
Mike Stump18bb9282009-05-16 07:57:57 +000059// FIXME: Several methods should be pure virtual but aren't to avoid the
60// partially-implemented subclass breaking.
Anton Korobeynikov1200aca2008-06-01 14:13:53 +000061
62/// Implements runtime-specific code generation functions.
Chris Lattnerb7256cd2008-03-01 08:50:34 +000063class CGObjCRuntime {
Daniel Dunbardc406b82010-04-05 21:36:35 +000064protected:
John McCalla729c622012-02-17 03:33:10 +000065 CodeGen::CodeGenModule &CGM;
66 CGObjCRuntime(CodeGen::CodeGenModule &CGM) : CGM(CGM) {}
67
Daniel Dunbar9fd114d2009-04-22 07:32:20 +000068 // Utility functions for unified ivar access. These need to
69 // eventually be folded into other places (the structure layout
70 // code).
71
Daniel Dunbar7b4dfc82009-04-22 09:39:34 +000072 /// Compute an offset to the given ivar, suitable for passing to
73 /// EmitValueForIvarAtOffset. Note that the correct handling of
74 /// bit-fields is carefully coordinated by these two, use caution!
Daniel Dunbar961202372009-05-03 12:57:56 +000075 ///
76 /// The latter overload is suitable for computing the offset of a
77 /// sythesized ivar.
Eli Friedman8cbca202012-11-06 22:15:52 +000078 uint64_t ComputeIvarBaseOffset(CodeGen::CodeGenModule &CGM,
79 const ObjCInterfaceDecl *OID,
80 const ObjCIvarDecl *Ivar);
81 uint64_t ComputeIvarBaseOffset(CodeGen::CodeGenModule &CGM,
82 const ObjCImplementationDecl *OID,
83 const ObjCIvarDecl *Ivar);
Daniel Dunbar9fd114d2009-04-22 07:32:20 +000084
85 LValue EmitValueForIvarAtOffset(CodeGen::CodeGenFunction &CGF,
86 const ObjCInterfaceDecl *OID,
87 llvm::Value *BaseValue,
88 const ObjCIvarDecl *Ivar,
89 unsigned CVRQualifiers,
Mike Stump11289f42009-09-09 15:08:12 +000090 llvm::Value *Offset);
David Chisnalld3858d62011-03-25 11:57:33 +000091 /// Emits a try / catch statement. This function is intended to be called by
92 /// subclasses, and provides a generic mechanism for generating these, which
James Dennettbe302452012-06-15 22:10:14 +000093 /// should be usable by all runtimes. The caller must provide the functions
94 /// to call when entering and exiting a \@catch() block, and the function
95 /// used to rethrow exceptions. If the begin and end catch functions are
96 /// NULL, then the function assumes that the EH personality function provides
97 /// the thrown object directly.
David Chisnalld3858d62011-03-25 11:57:33 +000098 void EmitTryCatchStmt(CodeGenFunction &CGF,
99 const ObjCAtTryStmt &S,
David Chisnall3fe89562011-05-23 22:33:28 +0000100 llvm::Constant *beginCatchFn,
101 llvm::Constant *endCatchFn,
102 llvm::Constant *exceptionRethrowFn);
John McCall17f02752015-10-30 00:56:02 +0000103
104 void EmitInitOfCatchParam(CodeGenFunction &CGF, llvm::Value *exn,
105 const VarDecl *paramDecl);
106
James Dennettbe302452012-06-15 22:10:14 +0000107 /// Emits an \@synchronize() statement, using the \p syncEnterFn and
108 /// \p syncExitFn arguments as the functions called to lock and unlock
109 /// the object. This function can be called by subclasses that use
110 /// zero-cost exception handling.
David Chisnalld3858d62011-03-25 11:57:33 +0000111 void EmitAtSynchronizedStmt(CodeGenFunction &CGF,
112 const ObjCAtSynchronizedStmt &S,
113 llvm::Function *syncEnterFn,
114 llvm::Function *syncExitFn);
Daniel Dunbar48595de2008-08-11 16:50:21 +0000115
Chris Lattnerb7256cd2008-03-01 08:50:34 +0000116public:
117 virtual ~CGObjCRuntime();
Daniel Dunbar92992502008-08-15 22:20:32 +0000118
119 /// Generate the function required to register all Objective-C components in
120 /// this compilation unit with the runtime library.
121 virtual llvm::Function *ModuleInitFunction() = 0;
122
John McCall7f416cc2015-09-08 08:05:57 +0000123 /// Get a selector for the specified name and type values.
124 /// The result should have the LLVM type for ASTContext::getObjCSelType().
125 virtual llvm::Value *GetSelector(CodeGenFunction &CGF, Selector Sel) = 0;
126
127 /// Get the address of a selector for the specified name and type values.
128 /// This is a rarely-used language extension, but sadly it exists.
129 ///
130 /// The result should have the LLVM type for a pointer to
Daniel Dunbar92992502008-08-15 22:20:32 +0000131 /// ASTContext::getObjCSelType().
John McCall7f416cc2015-09-08 08:05:57 +0000132 virtual Address GetAddrOfSelector(CodeGenFunction &CGF, Selector Sel) = 0;
Daniel Dunbar92992502008-08-15 22:20:32 +0000133
Mike Stump11289f42009-09-09 15:08:12 +0000134 /// Get a typed selector.
John McCall882987f2013-02-28 19:01:20 +0000135 virtual llvm::Value *GetSelector(CodeGenFunction &CGF,
Fariborz Jahanianf3648b82009-05-05 21:36:57 +0000136 const ObjCMethodDecl *Method) = 0;
137
John McCall2ca705e2010-07-24 00:37:23 +0000138 /// Get the type constant to catch for the given ObjC pointer type.
139 /// This is used externally to implement catching ObjC types in C++.
140 /// Runtimes which don't support this should add the appropriate
141 /// error to Sema.
Fariborz Jahanian831f0fc2011-06-23 19:00:08 +0000142 virtual llvm::Constant *GetEHType(QualType T) = 0;
John McCall2ca705e2010-07-24 00:37:23 +0000143
David Chisnall93ce0182018-08-10 12:53:13 +0000144 virtual CatchTypeInfo getCatchAllTypeInfo() { return { nullptr, 0 }; }
145
Daniel Dunbar92992502008-08-15 22:20:32 +0000146 /// Generate a constant string object.
John McCall7f416cc2015-09-08 08:05:57 +0000147 virtual ConstantAddress GenerateConstantString(const StringLiteral *) = 0;
Fangrui Song6907ce22018-07-30 19:24:48 +0000148
Daniel Dunbar92992502008-08-15 22:20:32 +0000149 /// Generate a category. A category contains a list of methods (and
150 /// accompanying metadata) and a list of protocols.
151 virtual void GenerateCategory(const ObjCCategoryImplDecl *OCD) = 0;
152
Chris Lattner57540c52011-04-15 05:22:18 +0000153 /// Generate a class structure for this class.
Daniel Dunbar92992502008-08-15 22:20:32 +0000154 virtual void GenerateClass(const ObjCImplementationDecl *OID) = 0;
Mike Stump11289f42009-09-09 15:08:12 +0000155
David Chisnall92d436b2012-01-31 18:59:20 +0000156 /// Register an class alias.
157 virtual void RegisterAlias(const ObjCCompatibleAliasDecl *OAD) = 0;
158
Mike Stump11289f42009-09-09 15:08:12 +0000159 /// Generate an Objective-C message send operation.
Daniel Dunbaraff9fca2009-09-17 04:01:22 +0000160 ///
161 /// \param Method - The method being called, this may be null if synthesizing
162 /// a property setter or getter.
Mike Stump11289f42009-09-09 15:08:12 +0000163 virtual CodeGen::RValue
Daniel Dunbar97db84c2008-08-23 03:46:30 +0000164 GenerateMessageSend(CodeGen::CodeGenFunction &CGF,
John McCall78a15112010-05-22 01:48:05 +0000165 ReturnValueSlot ReturnSlot,
Daniel Dunbar4b8c6db2008-08-30 05:35:15 +0000166 QualType ResultType,
167 Selector Sel,
Daniel Dunbarca8531a2008-08-25 08:19:24 +0000168 llvm::Value *Receiver,
Fariborz Jahanianf3648b82009-05-05 21:36:57 +0000169 const CallArgList &CallArgs,
Craig Topper8a13c412014-05-21 05:09:00 +0000170 const ObjCInterfaceDecl *Class = nullptr,
171 const ObjCMethodDecl *Method = nullptr) = 0;
Daniel Dunbar89da6ad2008-08-13 00:59:25 +0000172
Daniel Dunbar92992502008-08-15 22:20:32 +0000173 /// Generate an Objective-C message send operation to the super
Daniel Dunbarca8531a2008-08-25 08:19:24 +0000174 /// class initiated in a method for Class and with the given Self
175 /// object.
Daniel Dunbaraff9fca2009-09-17 04:01:22 +0000176 ///
177 /// \param Method - The method being called, this may be null if synthesizing
178 /// a property setter or getter.
Daniel Dunbar97db84c2008-08-23 03:46:30 +0000179 virtual CodeGen::RValue
180 GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF,
John McCall78a15112010-05-22 01:48:05 +0000181 ReturnValueSlot ReturnSlot,
Daniel Dunbar4b8c6db2008-08-30 05:35:15 +0000182 QualType ResultType,
183 Selector Sel,
Daniel Dunbarca8531a2008-08-25 08:19:24 +0000184 const ObjCInterfaceDecl *Class,
Fariborz Jahanianbac73ac2009-02-28 20:07:56 +0000185 bool isCategoryImpl,
Daniel Dunbarca8531a2008-08-25 08:19:24 +0000186 llvm::Value *Self,
Daniel Dunbarc722b852008-08-30 03:02:31 +0000187 bool IsClassMessage,
Daniel Dunbaraff9fca2009-09-17 04:01:22 +0000188 const CallArgList &CallArgs,
Craig Topper8a13c412014-05-21 05:09:00 +0000189 const ObjCMethodDecl *Method = nullptr) = 0;
Daniel Dunbar6630e102008-08-12 05:08:18 +0000190
191 /// Emit the code to return the named protocol as an object, as in a
James Dennett1355bd12012-06-11 06:19:40 +0000192 /// \@protocol expression.
John McCall882987f2013-02-28 19:01:20 +0000193 virtual llvm::Value *GenerateProtocolRef(CodeGenFunction &CGF,
Daniel Dunbar92992502008-08-15 22:20:32 +0000194 const ObjCProtocolDecl *OPD) = 0;
Daniel Dunbar6630e102008-08-12 05:08:18 +0000195
Mike Stump11289f42009-09-09 15:08:12 +0000196 /// Generate the named protocol. Protocols contain method metadata but no
197 /// implementations.
Daniel Dunbar92992502008-08-15 22:20:32 +0000198 virtual void GenerateProtocol(const ObjCProtocolDecl *OPD) = 0;
Daniel Dunbar89da6ad2008-08-13 00:59:25 +0000199
Daniel Dunbar92992502008-08-15 22:20:32 +0000200 /// Generate a function preamble for a method with the specified
Mike Stump11289f42009-09-09 15:08:12 +0000201 /// types.
Daniel Dunbar92992502008-08-15 22:20:32 +0000202
Mike Stump18bb9282009-05-16 07:57:57 +0000203 // FIXME: Current this just generates the Function definition, but really this
204 // should also be generating the loads of the parameters, as the runtime
205 // should have full control over how parameters are passed.
Mike Stump11289f42009-09-09 15:08:12 +0000206 virtual llvm::Function *GenerateMethod(const ObjCMethodDecl *OMD,
Fariborz Jahanian0196a1c2009-01-10 21:06:09 +0000207 const ObjCContainerDecl *CD) = 0;
Daniel Dunbar89da6ad2008-08-13 00:59:25 +0000208
Daniel Dunbara91c3e02008-09-24 03:38:44 +0000209 /// Return the runtime function for getting properties.
Chris Lattnerd4808922009-03-22 21:03:39 +0000210 virtual llvm::Constant *GetPropertyGetFunction() = 0;
Mike Stump11289f42009-09-09 15:08:12 +0000211
Daniel Dunbara91c3e02008-09-24 03:38:44 +0000212 /// Return the runtime function for setting properties.
Chris Lattnerd4808922009-03-22 21:03:39 +0000213 virtual llvm::Constant *GetPropertySetFunction() = 0;
Daniel Dunbara91c3e02008-09-24 03:38:44 +0000214
Ted Kremeneke65b0862012-03-06 20:05:56 +0000215 /// Return the runtime function for optimized setting properties.
Fangrui Song6907ce22018-07-30 19:24:48 +0000216 virtual llvm::Constant *GetOptimizedPropertySetFunction(bool atomic,
Ted Kremeneke65b0862012-03-06 20:05:56 +0000217 bool copy) = 0;
218
David Chisnall168b80f2010-12-26 22:13:16 +0000219 // API for atomic copying of qualified aggregates in getter.
220 virtual llvm::Constant *GetGetStructFunction() = 0;
221 // API for atomic copying of qualified aggregates in setter.
222 virtual llvm::Constant *GetSetStructFunction() = 0;
David Chisnall0d75e062012-12-17 18:54:24 +0000223 /// API for atomic copying of qualified aggregates with non-trivial copy
224 /// assignment (c++) in setter.
225 virtual llvm::Constant *GetCppAtomicObjectSetFunction() = 0;
226 /// API for atomic copying of qualified aggregates with non-trivial copy
227 /// assignment (c++) in getter.
228 virtual llvm::Constant *GetCppAtomicObjectGetFunction() = 0;
Fangrui Song6907ce22018-07-30 19:24:48 +0000229
Daniel Dunbar7c6d3a72008-08-16 00:25:02 +0000230 /// GetClass - Return a reference to the class for the given
231 /// interface decl.
John McCall882987f2013-02-28 19:01:20 +0000232 virtual llvm::Value *GetClass(CodeGenFunction &CGF,
Daniel Dunbar7c6d3a72008-08-16 00:25:02 +0000233 const ObjCInterfaceDecl *OID) = 0;
Fangrui Song6907ce22018-07-30 19:24:48 +0000234
235
John McCall882987f2013-02-28 19:01:20 +0000236 virtual llvm::Value *EmitNSAutoreleasePoolClassRef(CodeGenFunction &CGF) {
David Blaikie83d382b2011-09-23 05:06:16 +0000237 llvm_unreachable("autoreleasepool unsupported in this ABI");
John McCall31168b02011-06-15 23:02:42 +0000238 }
Fangrui Song6907ce22018-07-30 19:24:48 +0000239
Anders Carlsson3f35a262008-08-31 04:05:03 +0000240 /// EnumerationMutationFunction - Return the function that's called by the
241 /// compiler when a mutation is detected during foreach iteration.
Chris Lattnerd4808922009-03-22 21:03:39 +0000242 virtual llvm::Constant *EnumerationMutationFunction() = 0;
Mike Stump11289f42009-09-09 15:08:12 +0000243
John McCallbd309292010-07-06 01:34:17 +0000244 virtual void EmitSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
245 const ObjCAtSynchronizedStmt &S) = 0;
246 virtual void EmitTryStmt(CodeGen::CodeGenFunction &CGF,
247 const ObjCAtTryStmt &S) = 0;
Anders Carlsson1963b0c2008-09-09 10:04:29 +0000248 virtual void EmitThrowStmt(CodeGen::CodeGenFunction &CGF,
Fariborz Jahanian1eab0522013-01-10 19:02:56 +0000249 const ObjCAtThrowStmt &S,
250 bool ClearInsertionPoint=true) = 0;
Daniel Dunbarbe9dae82009-04-21 00:49:20 +0000251 virtual llvm::Value *EmitObjCWeakRead(CodeGen::CodeGenFunction &CGF,
John McCall7f416cc2015-09-08 08:05:57 +0000252 Address AddrWeakObj) = 0;
Fariborz Jahanian83f45b552008-11-18 22:37:34 +0000253 virtual void EmitObjCWeakAssign(CodeGen::CodeGenFunction &CGF,
John McCall7f416cc2015-09-08 08:05:57 +0000254 llvm::Value *src, Address dest) = 0;
Fariborz Jahaniand7db9642008-11-19 00:59:10 +0000255 virtual void EmitObjCGlobalAssign(CodeGen::CodeGenFunction &CGF,
John McCall7f416cc2015-09-08 08:05:57 +0000256 llvm::Value *src, Address dest,
Fariborz Jahanian217af242010-07-20 20:30:03 +0000257 bool threadlocal=false) = 0;
Fariborz Jahaniane881b532008-11-20 19:23:36 +0000258 virtual void EmitObjCIvarAssign(CodeGen::CodeGenFunction &CGF,
John McCall7f416cc2015-09-08 08:05:57 +0000259 llvm::Value *src, Address dest,
Fariborz Jahanian7a95d722009-09-24 22:25:38 +0000260 llvm::Value *ivarOffset) = 0;
Fariborz Jahaniand7db9642008-11-19 00:59:10 +0000261 virtual void EmitObjCStrongCastAssign(CodeGen::CodeGenFunction &CGF,
John McCall7f416cc2015-09-08 08:05:57 +0000262 llvm::Value *src, Address dest) = 0;
Mike Stump11289f42009-09-09 15:08:12 +0000263
Fariborz Jahanian712bfa62009-02-03 19:03:09 +0000264 virtual LValue EmitObjCValueForIvar(CodeGen::CodeGenFunction &CGF,
265 QualType ObjectTy,
266 llvm::Value *BaseValue,
267 const ObjCIvarDecl *Ivar,
Fariborz Jahanian712bfa62009-02-03 19:03:09 +0000268 unsigned CVRQualifiers) = 0;
Fariborz Jahanian21fc74c2009-02-10 19:02:04 +0000269 virtual llvm::Value *EmitIvarOffset(CodeGen::CodeGenFunction &CGF,
Daniel Dunbar722f4242009-04-22 05:08:15 +0000270 const ObjCInterfaceDecl *Interface,
Fariborz Jahanian21fc74c2009-02-10 19:02:04 +0000271 const ObjCIvarDecl *Ivar) = 0;
Fariborz Jahanian5f21d2f2009-07-08 01:18:33 +0000272 virtual void EmitGCMemmoveCollectable(CodeGen::CodeGenFunction &CGF,
John McCall7f416cc2015-09-08 08:05:57 +0000273 Address DestPtr,
274 Address SrcPtr,
Fariborz Jahanian021510e2010-06-15 22:44:06 +0000275 llvm::Value *Size) = 0;
John McCall351762c2011-02-07 10:33:21 +0000276 virtual llvm::Constant *BuildGCBlockLayout(CodeGen::CodeGenModule &CGM,
277 const CodeGen::CGBlockInfo &blockInfo) = 0;
Fariborz Jahanian0c58ce92012-10-27 21:10:38 +0000278 virtual llvm::Constant *BuildRCBlockLayout(CodeGen::CodeGenModule &CGM,
279 const CodeGen::CGBlockInfo &blockInfo) = 0;
Akira Hatanaka2ec36f02018-08-17 15:46:07 +0000280 virtual std::string getRCBlockLayoutStr(CodeGen::CodeGenModule &CGM,
281 const CGBlockInfo &blockInfo) {
282 return {};
283 }
Vedant Kumar2f5bb1152015-12-21 20:21:15 +0000284
285 /// Returns an i8* which points to the byref layout information.
Fariborz Jahaniana9d44642012-11-14 17:15:51 +0000286 virtual llvm::Constant *BuildByrefLayout(CodeGen::CodeGenModule &CGM,
287 QualType T) = 0;
Vedant Kumar2f5bb1152015-12-21 20:21:15 +0000288
John McCalla729c622012-02-17 03:33:10 +0000289 struct MessageSendInfo {
290 const CGFunctionInfo &CallInfo;
291 llvm::PointerType *MessengerType;
292
293 MessageSendInfo(const CGFunctionInfo &callInfo,
294 llvm::PointerType *messengerType)
295 : CallInfo(callInfo), MessengerType(messengerType) {}
296 };
297
298 MessageSendInfo getMessageSendInfo(const ObjCMethodDecl *method,
299 QualType resultType,
300 CallArgList &callArgs);
Eli Friedman85937482012-11-06 23:40:48 +0000301
302 // FIXME: This probably shouldn't be here, but the code to compute
303 // it is here.
304 unsigned ComputeBitfieldBitOffset(CodeGen::CodeGenModule &CGM,
305 const ObjCInterfaceDecl *ID,
306 const ObjCIvarDecl *Ivar);
Chris Lattnerb7256cd2008-03-01 08:50:34 +0000307};
308
Mike Stump11289f42009-09-09 15:08:12 +0000309/// Creates an instance of an Objective-C runtime class.
Chris Lattner4bd55962008-03-30 23:03:07 +0000310//TODO: This should include some way of selecting which runtime to target.
Daniel Dunbar303e2c22008-08-11 02:45:11 +0000311CGObjCRuntime *CreateGNUObjCRuntime(CodeGenModule &CGM);
312CGObjCRuntime *CreateMacObjCRuntime(CodeGenModule &CGM);
Alexander Kornienkoab9db512015-06-22 23:07:51 +0000313}
314}
Chris Lattnerb7256cd2008-03-01 08:50:34 +0000315#endif