CGCXXABI.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. //===----- CGCXXABI.h - Interface to C++ ABIs -------------------*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This provides an abstract class for C++ code generation. Concrete subclasses
  11. // of this implement code generation for specific C++ ABIs.
  12. //
  13. //===----------------------------------------------------------------------===//
  14. #ifndef LLVM_CLANG_LIB_CODEGEN_CGCXXABI_H
  15. #define LLVM_CLANG_LIB_CODEGEN_CGCXXABI_H
  16. #include "CodeGenFunction.h"
  17. #include "clang/Basic/LLVM.h"
  18. namespace llvm {
  19. class Constant;
  20. class Type;
  21. class Value;
  22. class CallInst;
  23. }
  24. namespace clang {
  25. class CastExpr;
  26. class CXXConstructorDecl;
  27. class CXXDestructorDecl;
  28. class CXXMethodDecl;
  29. class CXXRecordDecl;
  30. class FieldDecl;
  31. class MangleContext;
  32. namespace CodeGen {
  33. class CodeGenFunction;
  34. class CodeGenModule;
  35. /// \brief Implements C++ ABI-specific code generation functions.
  36. class CGCXXABI {
  37. protected:
  38. CodeGenModule &CGM;
  39. std::unique_ptr<MangleContext> MangleCtx;
  40. CGCXXABI(CodeGenModule &CGM)
  41. : CGM(CGM), MangleCtx(CGM.getContext().createMangleContext()) {}
  42. protected:
  43. ImplicitParamDecl *&getThisDecl(CodeGenFunction &CGF) {
  44. return CGF.CXXABIThisDecl;
  45. }
  46. llvm::Value *&getThisValue(CodeGenFunction &CGF) {
  47. return CGF.CXXABIThisValue;
  48. }
  49. /// Issue a diagnostic about unsupported features in the ABI.
  50. void ErrorUnsupportedABI(CodeGenFunction &CGF, StringRef S);
  51. /// Get a null value for unsupported member pointers.
  52. llvm::Constant *GetBogusMemberPointer(QualType T);
  53. ImplicitParamDecl *&getStructorImplicitParamDecl(CodeGenFunction &CGF) {
  54. return CGF.CXXStructorImplicitParamDecl;
  55. }
  56. llvm::Value *&getStructorImplicitParamValue(CodeGenFunction &CGF) {
  57. return CGF.CXXStructorImplicitParamValue;
  58. }
  59. /// Perform prolog initialization of the parameter variable suitable
  60. /// for 'this' emitted by buildThisParam.
  61. void EmitThisParam(CodeGenFunction &CGF);
  62. ASTContext &getContext() const { return CGM.getContext(); }
  63. virtual bool requiresArrayCookie(const CXXDeleteExpr *E, QualType eltType);
  64. virtual bool requiresArrayCookie(const CXXNewExpr *E);
  65. public:
  66. virtual ~CGCXXABI();
  67. /// Gets the mangle context.
  68. MangleContext &getMangleContext() {
  69. return *MangleCtx;
  70. }
  71. /// Returns true if the given constructor or destructor is one of the
  72. /// kinds that the ABI says returns 'this' (only applies when called
  73. /// non-virtually for destructors).
  74. ///
  75. /// There currently is no way to indicate if a destructor returns 'this'
  76. /// when called virtually, and code generation does not support the case.
  77. virtual bool HasThisReturn(GlobalDecl GD) const { return false; }
  78. virtual bool hasMostDerivedReturn(GlobalDecl GD) const { return false; }
  79. /// If the C++ ABI requires the given type be returned in a particular way,
  80. /// this method sets RetAI and returns true.
  81. virtual bool classifyReturnType(CGFunctionInfo &FI) const = 0;
  82. /// Specify how one should pass an argument of a record type.
  83. enum RecordArgABI {
  84. /// Pass it using the normal C aggregate rules for the ABI, potentially
  85. /// introducing extra copies and passing some or all of it in registers.
  86. RAA_Default = 0,
  87. /// Pass it on the stack using its defined layout. The argument must be
  88. /// evaluated directly into the correct stack position in the arguments area,
  89. /// and the call machinery must not move it or introduce extra copies.
  90. RAA_DirectInMemory,
  91. /// Pass it as a pointer to temporary memory.
  92. RAA_Indirect
  93. };
  94. /// Returns true if C++ allows us to copy the memory of an object of type RD
  95. /// when it is passed as an argument.
  96. bool canCopyArgument(const CXXRecordDecl *RD) const;
  97. /// Returns how an argument of the given record type should be passed.
  98. virtual RecordArgABI getRecordArgABI(const CXXRecordDecl *RD) const = 0;
  99. /// Returns true if the implicit 'sret' parameter comes after the implicit
  100. /// 'this' parameter of C++ instance methods.
  101. virtual bool isSRetParameterAfterThis() const { return false; }
  102. /// Find the LLVM type used to represent the given member pointer
  103. /// type.
  104. virtual llvm::Type *
  105. ConvertMemberPointerType(const MemberPointerType *MPT);
  106. /// Load a member function from an object and a member function
  107. /// pointer. Apply the this-adjustment and set 'This' to the
  108. /// adjusted value.
  109. virtual llvm::Value *EmitLoadOfMemberFunctionPointer(
  110. CodeGenFunction &CGF, const Expr *E, llvm::Value *&This,
  111. llvm::Value *MemPtr, const MemberPointerType *MPT);
  112. /// Calculate an l-value from an object and a data member pointer.
  113. virtual llvm::Value *
  114. EmitMemberDataPointerAddress(CodeGenFunction &CGF, const Expr *E,
  115. llvm::Value *Base, llvm::Value *MemPtr,
  116. const MemberPointerType *MPT);
  117. /// Perform a derived-to-base, base-to-derived, or bitcast member
  118. /// pointer conversion.
  119. virtual llvm::Value *EmitMemberPointerConversion(CodeGenFunction &CGF,
  120. const CastExpr *E,
  121. llvm::Value *Src);
  122. /// Perform a derived-to-base, base-to-derived, or bitcast member
  123. /// pointer conversion on a constant value.
  124. virtual llvm::Constant *EmitMemberPointerConversion(const CastExpr *E,
  125. llvm::Constant *Src);
  126. /// Return true if the given member pointer can be zero-initialized
  127. /// (in the C++ sense) with an LLVM zeroinitializer.
  128. virtual bool isZeroInitializable(const MemberPointerType *MPT);
  129. /// Return whether or not a member pointers type is convertible to an IR type.
  130. virtual bool isMemberPointerConvertible(const MemberPointerType *MPT) const {
  131. return true;
  132. }
  133. virtual bool isTypeInfoCalculable(QualType Ty) const {
  134. return !Ty->isIncompleteType();
  135. }
  136. /// Create a null member pointer of the given type.
  137. virtual llvm::Constant *EmitNullMemberPointer(const MemberPointerType *MPT);
  138. /// Create a member pointer for the given method.
  139. virtual llvm::Constant *EmitMemberFunctionPointer(const CXXMethodDecl *MD);
  140. /// Create a member pointer for the given field.
  141. virtual llvm::Constant *EmitMemberDataPointer(const MemberPointerType *MPT,
  142. CharUnits offset);
  143. /// Create a member pointer for the given member pointer constant.
  144. virtual llvm::Constant *EmitMemberPointer(const APValue &MP, QualType MPT);
  145. /// Emit a comparison between two member pointers. Returns an i1.
  146. virtual llvm::Value *
  147. EmitMemberPointerComparison(CodeGenFunction &CGF,
  148. llvm::Value *L,
  149. llvm::Value *R,
  150. const MemberPointerType *MPT,
  151. bool Inequality);
  152. /// Determine if a member pointer is non-null. Returns an i1.
  153. virtual llvm::Value *
  154. EmitMemberPointerIsNotNull(CodeGenFunction &CGF,
  155. llvm::Value *MemPtr,
  156. const MemberPointerType *MPT);
  157. protected:
  158. /// A utility method for computing the offset required for the given
  159. /// base-to-derived or derived-to-base member-pointer conversion.
  160. /// Does not handle virtual conversions (in case we ever fully
  161. /// support an ABI that allows this). Returns null if no adjustment
  162. /// is required.
  163. llvm::Constant *getMemberPointerAdjustment(const CastExpr *E);
  164. /// \brief Computes the non-virtual adjustment needed for a member pointer
  165. /// conversion along an inheritance path stored in an APValue. Unlike
  166. /// getMemberPointerAdjustment(), the adjustment can be negative if the path
  167. /// is from a derived type to a base type.
  168. CharUnits getMemberPointerPathAdjustment(const APValue &MP);
  169. public:
  170. virtual void emitVirtualObjectDelete(CodeGenFunction &CGF,
  171. const CXXDeleteExpr *DE,
  172. llvm::Value *Ptr, QualType ElementType,
  173. const CXXDestructorDecl *Dtor) = 0;
  174. virtual void emitRethrow(CodeGenFunction &CGF, bool isNoReturn) = 0;
  175. virtual void emitThrow(CodeGenFunction &CGF, const CXXThrowExpr *E) = 0;
  176. virtual llvm::GlobalVariable *getThrowInfo(QualType T) { return nullptr; }
  177. virtual void emitBeginCatch(CodeGenFunction &CGF, const CXXCatchStmt *C) = 0;
  178. virtual llvm::CallInst *
  179. emitTerminateForUnexpectedException(CodeGenFunction &CGF,
  180. llvm::Value *Exn);
  181. virtual llvm::Constant *getAddrOfRTTIDescriptor(QualType Ty) = 0;
  182. virtual llvm::Constant *
  183. getAddrOfCXXCatchHandlerType(QualType Ty, QualType CatchHandlerType) = 0;
  184. virtual bool shouldTypeidBeNullChecked(bool IsDeref,
  185. QualType SrcRecordTy) = 0;
  186. virtual void EmitBadTypeidCall(CodeGenFunction &CGF) = 0;
  187. virtual llvm::Value *EmitTypeid(CodeGenFunction &CGF, QualType SrcRecordTy,
  188. llvm::Value *ThisPtr,
  189. llvm::Type *StdTypeInfoPtrTy) = 0;
  190. virtual bool shouldDynamicCastCallBeNullChecked(bool SrcIsPtr,
  191. QualType SrcRecordTy) = 0;
  192. virtual llvm::Value *
  193. EmitDynamicCastCall(CodeGenFunction &CGF, llvm::Value *Value,
  194. QualType SrcRecordTy, QualType DestTy,
  195. QualType DestRecordTy, llvm::BasicBlock *CastEnd) = 0;
  196. virtual llvm::Value *EmitDynamicCastToVoid(CodeGenFunction &CGF,
  197. llvm::Value *Value,
  198. QualType SrcRecordTy,
  199. QualType DestTy) = 0;
  200. virtual bool EmitBadCastCall(CodeGenFunction &CGF) = 0;
  201. virtual llvm::Value *GetVirtualBaseClassOffset(CodeGenFunction &CGF,
  202. llvm::Value *This,
  203. const CXXRecordDecl *ClassDecl,
  204. const CXXRecordDecl *BaseClassDecl) = 0;
  205. virtual llvm::BasicBlock *EmitCtorCompleteObjectHandler(CodeGenFunction &CGF,
  206. const CXXRecordDecl *RD);
  207. /// Emit the code to initialize hidden members required
  208. /// to handle virtual inheritance, if needed by the ABI.
  209. virtual void
  210. initializeHiddenVirtualInheritanceMembers(CodeGenFunction &CGF,
  211. const CXXRecordDecl *RD) {}
  212. /// Emit constructor variants required by this ABI.
  213. virtual void EmitCXXConstructors(const CXXConstructorDecl *D) = 0;
  214. /// Build the signature of the given constructor or destructor variant by
  215. /// adding any required parameters. For convenience, ArgTys has been
  216. /// initialized with the type of 'this'.
  217. virtual void buildStructorSignature(const CXXMethodDecl *MD, StructorType T,
  218. SmallVectorImpl<CanQualType> &ArgTys) = 0;
  219. /// Returns true if the given destructor type should be emitted as a linkonce
  220. /// delegating thunk, regardless of whether the dtor is defined in this TU or
  221. /// not.
  222. virtual bool useThunkForDtorVariant(const CXXDestructorDecl *Dtor,
  223. CXXDtorType DT) const = 0;
  224. /// Emit destructor variants required by this ABI.
  225. virtual void EmitCXXDestructors(const CXXDestructorDecl *D) = 0;
  226. /// Get the type of the implicit "this" parameter used by a method. May return
  227. /// zero if no specific type is applicable, e.g. if the ABI expects the "this"
  228. /// parameter to point to some artificial offset in a complete object due to
  229. /// vbases being reordered.
  230. virtual const CXXRecordDecl *
  231. getThisArgumentTypeForMethod(const CXXMethodDecl *MD) {
  232. return MD->getParent();
  233. }
  234. /// Perform ABI-specific "this" argument adjustment required prior to
  235. /// a call of a virtual function.
  236. /// The "VirtualCall" argument is true iff the call itself is virtual.
  237. virtual llvm::Value *
  238. adjustThisArgumentForVirtualFunctionCall(CodeGenFunction &CGF, GlobalDecl GD,
  239. llvm::Value *This,
  240. bool VirtualCall) {
  241. return This;
  242. }
  243. /// Build a parameter variable suitable for 'this'.
  244. void buildThisParam(CodeGenFunction &CGF, FunctionArgList &Params);
  245. /// Insert any ABI-specific implicit parameters into the parameter list for a
  246. /// function. This generally involves extra data for constructors and
  247. /// destructors.
  248. ///
  249. /// ABIs may also choose to override the return type, which has been
  250. /// initialized with the type of 'this' if HasThisReturn(CGF.CurGD) is true or
  251. /// the formal return type of the function otherwise.
  252. virtual void addImplicitStructorParams(CodeGenFunction &CGF, QualType &ResTy,
  253. FunctionArgList &Params) = 0;
  254. /// Perform ABI-specific "this" parameter adjustment in a virtual function
  255. /// prologue.
  256. virtual llvm::Value *adjustThisParameterInVirtualFunctionPrologue(
  257. CodeGenFunction &CGF, GlobalDecl GD, llvm::Value *This) {
  258. return This;
  259. }
  260. /// Emit the ABI-specific prolog for the function.
  261. virtual void EmitInstanceFunctionProlog(CodeGenFunction &CGF) = 0;
  262. /// Add any ABI-specific implicit arguments needed to call a constructor.
  263. ///
  264. /// \return The number of args added to the call, which is typically zero or
  265. /// one.
  266. virtual unsigned
  267. addImplicitConstructorArgs(CodeGenFunction &CGF, const CXXConstructorDecl *D,
  268. CXXCtorType Type, bool ForVirtualBase,
  269. bool Delegating, CallArgList &Args) = 0;
  270. /// Emit the destructor call.
  271. virtual void EmitDestructorCall(CodeGenFunction &CGF,
  272. const CXXDestructorDecl *DD, CXXDtorType Type,
  273. bool ForVirtualBase, bool Delegating,
  274. llvm::Value *This) = 0;
  275. /// Emits the VTable definitions required for the given record type.
  276. virtual void emitVTableDefinitions(CodeGenVTables &CGVT,
  277. const CXXRecordDecl *RD) = 0;
  278. /// Get the address point of the vtable for the given base subobject while
  279. /// building a constructor or a destructor. On return, NeedsVirtualOffset
  280. /// tells if a virtual base adjustment is needed in order to get the offset
  281. /// of the base subobject.
  282. virtual llvm::Value *getVTableAddressPointInStructor(
  283. CodeGenFunction &CGF, const CXXRecordDecl *RD, BaseSubobject Base,
  284. const CXXRecordDecl *NearestVBase, bool &NeedsVirtualOffset) = 0;
  285. /// Get the address point of the vtable for the given base subobject while
  286. /// building a constexpr.
  287. virtual llvm::Constant *
  288. getVTableAddressPointForConstExpr(BaseSubobject Base,
  289. const CXXRecordDecl *VTableClass) = 0;
  290. /// Get the address of the vtable for the given record decl which should be
  291. /// used for the vptr at the given offset in RD.
  292. virtual llvm::GlobalVariable *getAddrOfVTable(const CXXRecordDecl *RD,
  293. CharUnits VPtrOffset) = 0;
  294. /// Build a virtual function pointer in the ABI-specific way.
  295. virtual llvm::Value *getVirtualFunctionPointer(CodeGenFunction &CGF,
  296. GlobalDecl GD,
  297. llvm::Value *This,
  298. llvm::Type *Ty,
  299. SourceLocation Loc) = 0;
  300. /// Emit the ABI-specific virtual destructor call.
  301. virtual llvm::Value *
  302. EmitVirtualDestructorCall(CodeGenFunction &CGF, const CXXDestructorDecl *Dtor,
  303. CXXDtorType DtorType, llvm::Value *This,
  304. const CXXMemberCallExpr *CE) = 0;
  305. virtual void adjustCallArgsForDestructorThunk(CodeGenFunction &CGF,
  306. GlobalDecl GD,
  307. CallArgList &CallArgs) {}
  308. /// Emit any tables needed to implement virtual inheritance. For Itanium,
  309. /// this emits virtual table tables. For the MSVC++ ABI, this emits virtual
  310. /// base tables.
  311. virtual void emitVirtualInheritanceTables(const CXXRecordDecl *RD) = 0;
  312. virtual void setThunkLinkage(llvm::Function *Thunk, bool ForVTable,
  313. GlobalDecl GD, bool ReturnAdjustment) = 0;
  314. virtual llvm::Value *performThisAdjustment(CodeGenFunction &CGF,
  315. llvm::Value *This,
  316. const ThisAdjustment &TA) = 0;
  317. virtual llvm::Value *performReturnAdjustment(CodeGenFunction &CGF,
  318. llvm::Value *Ret,
  319. const ReturnAdjustment &RA) = 0;
  320. virtual void EmitReturnFromThunk(CodeGenFunction &CGF,
  321. RValue RV, QualType ResultType);
  322. virtual size_t getSrcArgforCopyCtor(const CXXConstructorDecl *,
  323. FunctionArgList &Args) const = 0;
  324. /// Gets the pure virtual member call function.
  325. virtual StringRef GetPureVirtualCallName() = 0;
  326. /// Gets the deleted virtual member call name.
  327. virtual StringRef GetDeletedVirtualCallName() = 0;
  328. /**************************** Array cookies ******************************/
  329. /// Returns the extra size required in order to store the array
  330. /// cookie for the given new-expression. May return 0 to indicate that no
  331. /// array cookie is required.
  332. ///
  333. /// Several cases are filtered out before this method is called:
  334. /// - non-array allocations never need a cookie
  335. /// - calls to \::operator new(size_t, void*) never need a cookie
  336. ///
  337. /// \param expr - the new-expression being allocated.
  338. virtual CharUnits GetArrayCookieSize(const CXXNewExpr *expr);
  339. /// Initialize the array cookie for the given allocation.
  340. ///
  341. /// \param NewPtr - a char* which is the presumed-non-null
  342. /// return value of the allocation function
  343. /// \param NumElements - the computed number of elements,
  344. /// potentially collapsed from the multidimensional array case;
  345. /// always a size_t
  346. /// \param ElementType - the base element allocated type,
  347. /// i.e. the allocated type after stripping all array types
  348. virtual llvm::Value *InitializeArrayCookie(CodeGenFunction &CGF,
  349. llvm::Value *NewPtr,
  350. llvm::Value *NumElements,
  351. const CXXNewExpr *expr,
  352. QualType ElementType);
  353. /// Reads the array cookie associated with the given pointer,
  354. /// if it has one.
  355. ///
  356. /// \param Ptr - a pointer to the first element in the array
  357. /// \param ElementType - the base element type of elements of the array
  358. /// \param NumElements - an out parameter which will be initialized
  359. /// with the number of elements allocated, or zero if there is no
  360. /// cookie
  361. /// \param AllocPtr - an out parameter which will be initialized
  362. /// with a char* pointing to the address returned by the allocation
  363. /// function
  364. /// \param CookieSize - an out parameter which will be initialized
  365. /// with the size of the cookie, or zero if there is no cookie
  366. virtual void ReadArrayCookie(CodeGenFunction &CGF, llvm::Value *Ptr,
  367. const CXXDeleteExpr *expr,
  368. QualType ElementType, llvm::Value *&NumElements,
  369. llvm::Value *&AllocPtr, CharUnits &CookieSize);
  370. /// Return whether the given global decl needs a VTT parameter.
  371. virtual bool NeedsVTTParameter(GlobalDecl GD);
  372. protected:
  373. /// Returns the extra size required in order to store the array
  374. /// cookie for the given type. Assumes that an array cookie is
  375. /// required.
  376. virtual CharUnits getArrayCookieSizeImpl(QualType elementType);
  377. /// Reads the array cookie for an allocation which is known to have one.
  378. /// This is called by the standard implementation of ReadArrayCookie.
  379. ///
  380. /// \param ptr - a pointer to the allocation made for an array, as a char*
  381. /// \param cookieSize - the computed cookie size of an array
  382. ///
  383. /// Other parameters are as above.
  384. ///
  385. /// \return a size_t
  386. virtual llvm::Value *readArrayCookieImpl(CodeGenFunction &IGF,
  387. llvm::Value *ptr,
  388. CharUnits cookieSize);
  389. public:
  390. /*************************** Static local guards ****************************/
  391. /// Emits the guarded initializer and destructor setup for the given
  392. /// variable, given that it couldn't be emitted as a constant.
  393. /// If \p PerformInit is false, the initialization has been folded to a
  394. /// constant and should not be performed.
  395. ///
  396. /// The variable may be:
  397. /// - a static local variable
  398. /// - a static data member of a class template instantiation
  399. virtual void EmitGuardedInit(CodeGenFunction &CGF, const VarDecl &D,
  400. llvm::GlobalVariable *DeclPtr,
  401. bool PerformInit) = 0;
  402. /// Emit code to force the execution of a destructor during global
  403. /// teardown. The default implementation of this uses atexit.
  404. ///
  405. /// \param Dtor - a function taking a single pointer argument
  406. /// \param Addr - a pointer to pass to the destructor function.
  407. virtual void registerGlobalDtor(CodeGenFunction &CGF, const VarDecl &D,
  408. llvm::Constant *Dtor,
  409. llvm::Constant *Addr) = 0;
  410. /*************************** thread_local initialization ********************/
  411. /// Emits ABI-required functions necessary to initialize thread_local
  412. /// variables in this translation unit.
  413. ///
  414. /// \param CXXThreadLocals - The thread_local declarations in this translation
  415. /// unit.
  416. /// \param CXXThreadLocalInits - If this translation unit contains any
  417. /// non-constant initialization or non-trivial destruction for
  418. /// thread_local variables, a list of functions to perform the
  419. /// initialization.
  420. virtual void EmitThreadLocalInitFuncs(
  421. CodeGenModule &CGM,
  422. ArrayRef<std::pair<const VarDecl *, llvm::GlobalVariable *>>
  423. CXXThreadLocals,
  424. ArrayRef<llvm::Function *> CXXThreadLocalInits,
  425. ArrayRef<llvm::GlobalVariable *> CXXThreadLocalInitVars) = 0;
  426. // Determine if references to thread_local global variables can be made
  427. // directly or require access through a thread wrapper function.
  428. virtual bool usesThreadWrapperFunction() const = 0;
  429. /// Emit a reference to a non-local thread_local variable (including
  430. /// triggering the initialization of all thread_local variables in its
  431. /// translation unit).
  432. virtual LValue EmitThreadLocalVarDeclLValue(CodeGenFunction &CGF,
  433. const VarDecl *VD,
  434. QualType LValType) = 0;
  435. /// Emit a single constructor/destructor with the given type from a C++
  436. /// constructor Decl.
  437. virtual void emitCXXStructor(const CXXMethodDecl *MD, StructorType Type) = 0;
  438. };
  439. // Create an instance of a C++ ABI class:
  440. /// Creates an Itanium-family ABI.
  441. CGCXXABI *CreateItaniumCXXABI(CodeGenModule &CGM);
  442. /// Creates a Microsoft-family ABI.
  443. CGCXXABI *CreateMicrosoftCXXABI(CodeGenModule &CGM);
  444. }
  445. }
  446. #endif