clang  16.0.0git
CGCXXABI.h
Go to the documentation of this file.
1 //===----- CGCXXABI.h - Interface to C++ ABIs -------------------*- C++ -*-===//
2 //
3 // 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
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This provides an abstract class for C++ code generation. Concrete subclasses
10 // of this implement code generation for specific C++ ABIs.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_LIB_CODEGEN_CGCXXABI_H
15 #define LLVM_CLANG_LIB_CODEGEN_CGCXXABI_H
16 
17 #include "CodeGenFunction.h"
18 #include "clang/Basic/LLVM.h"
20 
21 namespace llvm {
22 class Constant;
23 class Type;
24 class Value;
25 class CallInst;
26 }
27 
28 namespace clang {
29 class CastExpr;
30 class CXXConstructorDecl;
31 class CXXDestructorDecl;
32 class CXXMethodDecl;
33 class CXXRecordDecl;
34 class MangleContext;
35 
36 namespace CodeGen {
37 class CGCallee;
38 class CodeGenFunction;
39 class CodeGenModule;
40 struct CatchTypeInfo;
41 
42 /// Implements C++ ABI-specific code generation functions.
43 class CGCXXABI {
44  friend class CodeGenModule;
45 
46 protected:
48  std::unique_ptr<MangleContext> MangleCtx;
49 
51  : CGM(CGM), MangleCtx(CGM.getContext().createMangleContext()) {}
52 
53 protected:
55  return CGF.CXXABIThisDecl;
56  }
57  llvm::Value *getThisValue(CodeGenFunction &CGF) {
58  return CGF.CXXABIThisValue;
59  }
61  return Address(
62  CGF.CXXABIThisValue,
63  CGF.ConvertTypeForMem(CGF.CXXABIThisDecl->getType()->getPointeeType()),
64  CGF.CXXABIThisAlignment);
65  }
66 
67  /// Issue a diagnostic about unsupported features in the ABI.
68  void ErrorUnsupportedABI(CodeGenFunction &CGF, StringRef S);
69 
70  /// Get a null value for unsupported member pointers.
71  llvm::Constant *GetBogusMemberPointer(QualType T);
72 
74  return CGF.CXXStructorImplicitParamDecl;
75  }
77  return CGF.CXXStructorImplicitParamValue;
78  }
79 
80  /// Loads the incoming C++ this pointer as it was passed by the caller.
81  llvm::Value *loadIncomingCXXThis(CodeGenFunction &CGF);
82 
83  void setCXXABIThisValue(CodeGenFunction &CGF, llvm::Value *ThisPtr);
84 
85  ASTContext &getContext() const { return CGM.getContext(); }
86 
87  bool mayNeedDestruction(const VarDecl *VD) const;
88 
89  /// Determine whether we will definitely emit this variable with a constant
90  /// initializer, either because the language semantics demand it or because
91  /// we know that the initializer is a constant.
92  // For weak definitions, any initializer available in the current translation
93  // is not necessarily reflective of the initializer used; such initializers
94  // are ignored unless if InspectInitForWeakDef is true.
95  bool
97  bool InspectInitForWeakDef = false) const;
98 
99  virtual bool requiresArrayCookie(const CXXDeleteExpr *E, QualType eltType);
100  virtual bool requiresArrayCookie(const CXXNewExpr *E);
101 
102  /// Determine whether there's something special about the rules of
103  /// the ABI tell us that 'this' is a complete object within the
104  /// given function. Obvious common logic like being defined on a
105  /// final class will have been taken care of by the caller.
106  virtual bool isThisCompleteObject(GlobalDecl GD) const = 0;
107 
109  return CGM.getCodeGenOpts().CtorDtorReturnThis;
110  }
111 
112 public:
113 
114  virtual ~CGCXXABI();
115 
116  /// Gets the mangle context.
118  return *MangleCtx;
119  }
120 
121  /// Returns true if the given constructor or destructor is one of the
122  /// kinds that the ABI says returns 'this' (only applies when called
123  /// non-virtually for destructors).
124  ///
125  /// There currently is no way to indicate if a destructor returns 'this'
126  /// when called virtually, and code generation does not support the case.
127  virtual bool HasThisReturn(GlobalDecl GD) const {
128  if (isa<CXXConstructorDecl>(GD.getDecl()) ||
129  (isa<CXXDestructorDecl>(GD.getDecl()) &&
130  GD.getDtorType() != Dtor_Deleting))
132  return false;
133  }
134 
135  virtual bool hasMostDerivedReturn(GlobalDecl GD) const { return false; }
136 
137  virtual bool useSinitAndSterm() const { return false; }
138 
139  /// Returns true if the target allows calling a function through a pointer
140  /// with a different signature than the actual function (or equivalently,
141  /// bitcasting a function or function pointer to a different function type).
142  /// In principle in the most general case this could depend on the target, the
143  /// calling convention, and the actual types of the arguments and return
144  /// value. Here it just means whether the signature mismatch could *ever* be
145  /// allowed; in other words, does the target do strict checking of signatures
146  /// for all calls.
147  virtual bool canCallMismatchedFunctionType() const { return true; }
148 
149  /// If the C++ ABI requires the given type be returned in a particular way,
150  /// this method sets RetAI and returns true.
151  virtual bool classifyReturnType(CGFunctionInfo &FI) const = 0;
152 
153  /// Specify how one should pass an argument of a record type.
155  /// Pass it using the normal C aggregate rules for the ABI, potentially
156  /// introducing extra copies and passing some or all of it in registers.
158 
159  /// Pass it on the stack using its defined layout. The argument must be
160  /// evaluated directly into the correct stack position in the arguments area,
161  /// and the call machinery must not move it or introduce extra copies.
163 
164  /// Pass it as a pointer to temporary memory.
166  };
167 
168  /// Returns how an argument of the given record type should be passed.
169  virtual RecordArgABI getRecordArgABI(const CXXRecordDecl *RD) const = 0;
170 
171  /// Returns true if the implicit 'sret' parameter comes after the implicit
172  /// 'this' parameter of C++ instance methods.
173  virtual bool isSRetParameterAfterThis() const { return false; }
174 
175  /// Returns true if the ABI permits the argument to be a homogeneous
176  /// aggregate.
177  virtual bool
179  return true;
180  };
181 
182  /// Find the LLVM type used to represent the given member pointer
183  /// type.
184  virtual llvm::Type *
186 
187  /// Load a member function from an object and a member function
188  /// pointer. Apply the this-adjustment and set 'This' to the
189  /// adjusted value.
191  CodeGenFunction &CGF, const Expr *E, Address This,
192  llvm::Value *&ThisPtrForCall, llvm::Value *MemPtr,
193  const MemberPointerType *MPT);
194 
195  /// Calculate an l-value from an object and a data member pointer.
196  virtual llvm::Value *
198  Address Base, llvm::Value *MemPtr,
199  const MemberPointerType *MPT);
200 
201  /// Perform a derived-to-base, base-to-derived, or bitcast member
202  /// pointer conversion.
203  virtual llvm::Value *EmitMemberPointerConversion(CodeGenFunction &CGF,
204  const CastExpr *E,
205  llvm::Value *Src);
206 
207  /// Perform a derived-to-base, base-to-derived, or bitcast member
208  /// pointer conversion on a constant value.
209  virtual llvm::Constant *EmitMemberPointerConversion(const CastExpr *E,
210  llvm::Constant *Src);
211 
212  /// Return true if the given member pointer can be zero-initialized
213  /// (in the C++ sense) with an LLVM zeroinitializer.
214  virtual bool isZeroInitializable(const MemberPointerType *MPT);
215 
216  /// Return whether or not a member pointers type is convertible to an IR type.
217  virtual bool isMemberPointerConvertible(const MemberPointerType *MPT) const {
218  return true;
219  }
220 
221  /// Create a null member pointer of the given type.
222  virtual llvm::Constant *EmitNullMemberPointer(const MemberPointerType *MPT);
223 
224  /// Create a member pointer for the given method.
225  virtual llvm::Constant *EmitMemberFunctionPointer(const CXXMethodDecl *MD);
226 
227  /// Create a member pointer for the given field.
228  virtual llvm::Constant *EmitMemberDataPointer(const MemberPointerType *MPT,
229  CharUnits offset);
230 
231  /// Create a member pointer for the given member pointer constant.
232  virtual llvm::Constant *EmitMemberPointer(const APValue &MP, QualType MPT);
233 
234  /// Emit a comparison between two member pointers. Returns an i1.
235  virtual llvm::Value *
237  llvm::Value *L,
238  llvm::Value *R,
239  const MemberPointerType *MPT,
240  bool Inequality);
241 
242  /// Determine if a member pointer is non-null. Returns an i1.
243  virtual llvm::Value *
245  llvm::Value *MemPtr,
246  const MemberPointerType *MPT);
247 
248 protected:
249  /// A utility method for computing the offset required for the given
250  /// base-to-derived or derived-to-base member-pointer conversion.
251  /// Does not handle virtual conversions (in case we ever fully
252  /// support an ABI that allows this). Returns null if no adjustment
253  /// is required.
254  llvm::Constant *getMemberPointerAdjustment(const CastExpr *E);
255 
256 public:
257  virtual void emitVirtualObjectDelete(CodeGenFunction &CGF,
258  const CXXDeleteExpr *DE,
259  Address Ptr, QualType ElementType,
260  const CXXDestructorDecl *Dtor) = 0;
261  virtual void emitRethrow(CodeGenFunction &CGF, bool isNoReturn) = 0;
262  virtual void emitThrow(CodeGenFunction &CGF, const CXXThrowExpr *E) = 0;
263  virtual llvm::GlobalVariable *getThrowInfo(QualType T) { return nullptr; }
264 
265  /// Determine whether it's possible to emit a vtable for \p RD, even
266  /// though we do not know that the vtable has been marked as used by semantic
267  /// analysis.
268  virtual bool canSpeculativelyEmitVTable(const CXXRecordDecl *RD) const = 0;
269 
270  virtual void emitBeginCatch(CodeGenFunction &CGF, const CXXCatchStmt *C) = 0;
271 
272  virtual llvm::CallInst *
274  llvm::Value *Exn);
275 
276  virtual llvm::Constant *getAddrOfRTTIDescriptor(QualType Ty) = 0;
277  virtual CatchTypeInfo
278  getAddrOfCXXCatchHandlerType(QualType Ty, QualType CatchHandlerType) = 0;
280 
281  virtual bool shouldTypeidBeNullChecked(bool IsDeref,
282  QualType SrcRecordTy) = 0;
283  virtual void EmitBadTypeidCall(CodeGenFunction &CGF) = 0;
284  virtual llvm::Value *EmitTypeid(CodeGenFunction &CGF, QualType SrcRecordTy,
285  Address ThisPtr,
286  llvm::Type *StdTypeInfoPtrTy) = 0;
287 
288  virtual bool shouldDynamicCastCallBeNullChecked(bool SrcIsPtr,
289  QualType SrcRecordTy) = 0;
290 
291  virtual llvm::Value *
293  QualType SrcRecordTy, QualType DestTy,
294  QualType DestRecordTy, llvm::BasicBlock *CastEnd) = 0;
295 
296  virtual llvm::Value *EmitDynamicCastToVoid(CodeGenFunction &CGF,
297  Address Value,
298  QualType SrcRecordTy,
299  QualType DestTy) = 0;
300 
301  virtual bool EmitBadCastCall(CodeGenFunction &CGF) = 0;
302 
303  virtual llvm::Value *GetVirtualBaseClassOffset(CodeGenFunction &CGF,
304  Address This,
305  const CXXRecordDecl *ClassDecl,
306  const CXXRecordDecl *BaseClassDecl) = 0;
307 
308  virtual llvm::BasicBlock *EmitCtorCompleteObjectHandler(CodeGenFunction &CGF,
309  const CXXRecordDecl *RD);
310 
311  /// Emit the code to initialize hidden members required
312  /// to handle virtual inheritance, if needed by the ABI.
313  virtual void
315  const CXXRecordDecl *RD) {}
316 
317  /// Emit constructor variants required by this ABI.
318  virtual void EmitCXXConstructors(const CXXConstructorDecl *D) = 0;
319 
320  /// Additional implicit arguments to add to the beginning (Prefix) and end
321  /// (Suffix) of a constructor / destructor arg list.
322  ///
323  /// Note that Prefix should actually be inserted *after* the first existing
324  /// arg; `this` arguments always come first.
326  struct Arg {
327  llvm::Value *Value;
329  };
332  AddedStructorArgs() = default;
334  : Prefix(std::move(P)), Suffix(std::move(S)) {}
336  return {std::move(Args), {}};
337  }
339  return {{}, std::move(Args)};
340  }
341  };
342 
343  /// Similar to AddedStructorArgs, but only notes the number of additional
344  /// arguments.
346  unsigned Prefix = 0;
347  unsigned Suffix = 0;
348  AddedStructorArgCounts() = default;
349  AddedStructorArgCounts(unsigned P, unsigned S) : Prefix(P), Suffix(S) {}
350  static AddedStructorArgCounts prefix(unsigned N) { return {N, 0}; }
351  static AddedStructorArgCounts suffix(unsigned N) { return {0, N}; }
352  };
353 
354  /// Build the signature of the given constructor or destructor variant by
355  /// adding any required parameters. For convenience, ArgTys has been
356  /// initialized with the type of 'this'.
357  virtual AddedStructorArgCounts
359  SmallVectorImpl<CanQualType> &ArgTys) = 0;
360 
361  /// Returns true if the given destructor type should be emitted as a linkonce
362  /// delegating thunk, regardless of whether the dtor is defined in this TU or
363  /// not.
364  virtual bool useThunkForDtorVariant(const CXXDestructorDecl *Dtor,
365  CXXDtorType DT) const = 0;
366 
367  virtual void setCXXDestructorDLLStorage(llvm::GlobalValue *GV,
368  const CXXDestructorDecl *Dtor,
369  CXXDtorType DT) const;
370 
371  virtual llvm::GlobalValue::LinkageTypes
373  CXXDtorType DT) const;
374 
375  /// Emit destructor variants required by this ABI.
376  virtual void EmitCXXDestructors(const CXXDestructorDecl *D) = 0;
377 
378  /// Get the type of the implicit "this" parameter used by a method. May return
379  /// zero if no specific type is applicable, e.g. if the ABI expects the "this"
380  /// parameter to point to some artificial offset in a complete object due to
381  /// vbases being reordered.
382  virtual const CXXRecordDecl *
384  return MD->getParent();
385  }
386 
387  /// Perform ABI-specific "this" argument adjustment required prior to
388  /// a call of a virtual function.
389  /// The "VirtualCall" argument is true iff the call itself is virtual.
390  virtual Address
392  Address This, bool VirtualCall) {
393  return This;
394  }
395 
396  /// Build a parameter variable suitable for 'this'.
397  void buildThisParam(CodeGenFunction &CGF, FunctionArgList &Params);
398 
399  /// Insert any ABI-specific implicit parameters into the parameter list for a
400  /// function. This generally involves extra data for constructors and
401  /// destructors.
402  ///
403  /// ABIs may also choose to override the return type, which has been
404  /// initialized with the type of 'this' if HasThisReturn(CGF.CurGD) is true or
405  /// the formal return type of the function otherwise.
406  virtual void addImplicitStructorParams(CodeGenFunction &CGF, QualType &ResTy,
407  FunctionArgList &Params) = 0;
408 
409  /// Get the ABI-specific "this" parameter adjustment to apply in the prologue
410  /// of a virtual function.
412  return CharUnits::Zero();
413  }
414 
415  /// Emit the ABI-specific prolog for the function.
416  virtual void EmitInstanceFunctionProlog(CodeGenFunction &CGF) = 0;
417 
418  virtual AddedStructorArgs
420  CXXCtorType Type, bool ForVirtualBase,
421  bool Delegating) = 0;
422 
423  /// Add any ABI-specific implicit arguments needed to call a constructor.
424  ///
425  /// \return The number of arguments added at the beginning and end of the
426  /// call, which is typically zero or one.
427  AddedStructorArgCounts
429  CXXCtorType Type, bool ForVirtualBase,
430  bool Delegating, CallArgList &Args);
431 
432  /// Get the implicit (second) parameter that comes after the "this" pointer,
433  /// or nullptr if there is isn't one.
434  virtual llvm::Value *
437  bool ForVirtualBase, bool Delegating) = 0;
438 
439  /// Emit the destructor call.
440  virtual void EmitDestructorCall(CodeGenFunction &CGF,
442  bool ForVirtualBase, bool Delegating,
443  Address This, QualType ThisTy) = 0;
444 
445  /// Emits the VTable definitions required for the given record type.
446  virtual void emitVTableDefinitions(CodeGenVTables &CGVT,
447  const CXXRecordDecl *RD) = 0;
448 
449  /// Checks if ABI requires extra virtual offset for vtable field.
450  virtual bool
452  CodeGenFunction::VPtr Vptr) = 0;
453 
454  /// Checks if ABI requires to initialize vptrs for given dynamic class.
455  virtual bool doStructorsInitializeVPtrs(const CXXRecordDecl *VTableClass) = 0;
456 
457  /// Get the address point of the vtable for the given base subobject.
458  virtual llvm::Constant *
460  const CXXRecordDecl *VTableClass) = 0;
461 
462  /// Get the address point of the vtable for the given base subobject while
463  /// building a constructor or a destructor.
464  virtual llvm::Value *
467  const CXXRecordDecl *NearestVBase) = 0;
468 
469  /// Get the address point of the vtable for the given base subobject while
470  /// building a constexpr.
471  virtual llvm::Constant *
473  const CXXRecordDecl *VTableClass) = 0;
474 
475  /// Get the address of the vtable for the given record decl which should be
476  /// used for the vptr at the given offset in RD.
477  virtual llvm::GlobalVariable *getAddrOfVTable(const CXXRecordDecl *RD,
478  CharUnits VPtrOffset) = 0;
479 
480  /// Build a virtual function pointer in the ABI-specific way.
482  GlobalDecl GD, Address This,
483  llvm::Type *Ty,
484  SourceLocation Loc) = 0;
485 
486  using DeleteOrMemberCallExpr =
487  llvm::PointerUnion<const CXXDeleteExpr *, const CXXMemberCallExpr *>;
488 
489  /// Emit the ABI-specific virtual destructor call.
490  virtual llvm::Value *EmitVirtualDestructorCall(CodeGenFunction &CGF,
491  const CXXDestructorDecl *Dtor,
492  CXXDtorType DtorType,
493  Address This,
494  DeleteOrMemberCallExpr E) = 0;
495 
497  GlobalDecl GD,
498  CallArgList &CallArgs) {}
499 
500  /// Emit any tables needed to implement virtual inheritance. For Itanium,
501  /// this emits virtual table tables. For the MSVC++ ABI, this emits virtual
502  /// base tables.
503  virtual void emitVirtualInheritanceTables(const CXXRecordDecl *RD) = 0;
504 
505  virtual bool exportThunk() = 0;
506  virtual void setThunkLinkage(llvm::Function *Thunk, bool ForVTable,
507  GlobalDecl GD, bool ReturnAdjustment) = 0;
508 
509  virtual llvm::Value *performThisAdjustment(CodeGenFunction &CGF,
510  Address This,
511  const ThisAdjustment &TA) = 0;
512 
513  virtual llvm::Value *performReturnAdjustment(CodeGenFunction &CGF,
514  Address Ret,
515  const ReturnAdjustment &RA) = 0;
516 
517  virtual void EmitReturnFromThunk(CodeGenFunction &CGF,
518  RValue RV, QualType ResultType);
519 
520  virtual size_t getSrcArgforCopyCtor(const CXXConstructorDecl *,
521  FunctionArgList &Args) const = 0;
522 
523  /// Gets the offsets of all the virtual base pointers in a given class.
524  virtual std::vector<CharUnits> getVBPtrOffsets(const CXXRecordDecl *RD);
525 
526  /// Gets the pure virtual member call function.
527  virtual StringRef GetPureVirtualCallName() = 0;
528 
529  /// Gets the deleted virtual member call name.
530  virtual StringRef GetDeletedVirtualCallName() = 0;
531 
532  /**************************** Array cookies ******************************/
533 
534  /// Returns the extra size required in order to store the array
535  /// cookie for the given new-expression. May return 0 to indicate that no
536  /// array cookie is required.
537  ///
538  /// Several cases are filtered out before this method is called:
539  /// - non-array allocations never need a cookie
540  /// - calls to \::operator new(size_t, void*) never need a cookie
541  ///
542  /// \param expr - the new-expression being allocated.
544 
545  /// Initialize the array cookie for the given allocation.
546  ///
547  /// \param NewPtr - a char* which is the presumed-non-null
548  /// return value of the allocation function
549  /// \param NumElements - the computed number of elements,
550  /// potentially collapsed from the multidimensional array case;
551  /// always a size_t
552  /// \param ElementType - the base element allocated type,
553  /// i.e. the allocated type after stripping all array types
555  Address NewPtr,
556  llvm::Value *NumElements,
557  const CXXNewExpr *expr,
558  QualType ElementType);
559 
560  /// Reads the array cookie associated with the given pointer,
561  /// if it has one.
562  ///
563  /// \param Ptr - a pointer to the first element in the array
564  /// \param ElementType - the base element type of elements of the array
565  /// \param NumElements - an out parameter which will be initialized
566  /// with the number of elements allocated, or zero if there is no
567  /// cookie
568  /// \param AllocPtr - an out parameter which will be initialized
569  /// with a char* pointing to the address returned by the allocation
570  /// function
571  /// \param CookieSize - an out parameter which will be initialized
572  /// with the size of the cookie, or zero if there is no cookie
573  virtual void ReadArrayCookie(CodeGenFunction &CGF, Address Ptr,
574  const CXXDeleteExpr *expr,
575  QualType ElementType, llvm::Value *&NumElements,
576  llvm::Value *&AllocPtr, CharUnits &CookieSize);
577 
578  /// Return whether the given global decl needs a VTT parameter.
579  virtual bool NeedsVTTParameter(GlobalDecl GD);
580 
581 protected:
582  /// Returns the extra size required in order to store the array
583  /// cookie for the given type. Assumes that an array cookie is
584  /// required.
585  virtual CharUnits getArrayCookieSizeImpl(QualType elementType);
586 
587  /// Reads the array cookie for an allocation which is known to have one.
588  /// This is called by the standard implementation of ReadArrayCookie.
589  ///
590  /// \param ptr - a pointer to the allocation made for an array, as a char*
591  /// \param cookieSize - the computed cookie size of an array
592  ///
593  /// Other parameters are as above.
594  ///
595  /// \return a size_t
596  virtual llvm::Value *readArrayCookieImpl(CodeGenFunction &IGF, Address ptr,
597  CharUnits cookieSize);
598 
599 public:
600 
601  /*************************** Static local guards ****************************/
602 
603  /// Emits the guarded initializer and destructor setup for the given
604  /// variable, given that it couldn't be emitted as a constant.
605  /// If \p PerformInit is false, the initialization has been folded to a
606  /// constant and should not be performed.
607  ///
608  /// The variable may be:
609  /// - a static local variable
610  /// - a static data member of a class template instantiation
611  virtual void EmitGuardedInit(CodeGenFunction &CGF, const VarDecl &D,
612  llvm::GlobalVariable *DeclPtr,
613  bool PerformInit) = 0;
614 
615  /// Emit code to force the execution of a destructor during global
616  /// teardown. The default implementation of this uses atexit.
617  ///
618  /// \param Dtor - a function taking a single pointer argument
619  /// \param Addr - a pointer to pass to the destructor function.
620  virtual void registerGlobalDtor(CodeGenFunction &CGF, const VarDecl &D,
621  llvm::FunctionCallee Dtor,
622  llvm::Constant *Addr) = 0;
623 
624  /*************************** thread_local initialization ********************/
625 
626  /// Emits ABI-required functions necessary to initialize thread_local
627  /// variables in this translation unit.
628  ///
629  /// \param CXXThreadLocals - The thread_local declarations in this translation
630  /// unit.
631  /// \param CXXThreadLocalInits - If this translation unit contains any
632  /// non-constant initialization or non-trivial destruction for
633  /// thread_local variables, a list of functions to perform the
634  /// initialization.
635  virtual void EmitThreadLocalInitFuncs(
636  CodeGenModule &CGM, ArrayRef<const VarDecl *> CXXThreadLocals,
637  ArrayRef<llvm::Function *> CXXThreadLocalInits,
638  ArrayRef<const VarDecl *> CXXThreadLocalInitVars) = 0;
639 
640  // Determine if references to thread_local global variables can be made
641  // directly or require access through a thread wrapper function.
642  virtual bool usesThreadWrapperFunction(const VarDecl *VD) const = 0;
643 
644  /// Emit a reference to a non-local thread_local variable (including
645  /// triggering the initialization of all thread_local variables in its
646  /// translation unit).
648  const VarDecl *VD,
649  QualType LValType) = 0;
650 
651  /// Emit a single constructor/destructor with the given type from a C++
652  /// constructor Decl.
653  virtual void emitCXXStructor(GlobalDecl GD) = 0;
654 
655  /// Load a vtable from This, an object of polymorphic type RD, or from one of
656  /// its virtual bases if it does not have its own vtable. Returns the vtable
657  /// and the class from which the vtable was loaded.
658  virtual std::pair<llvm::Value *, const CXXRecordDecl *>
660  const CXXRecordDecl *RD) = 0;
661 };
662 
663 // Create an instance of a C++ ABI class:
664 
665 /// Creates an Itanium-family ABI.
666 CGCXXABI *CreateItaniumCXXABI(CodeGenModule &CGM);
667 
668 /// Creates a Microsoft-family ABI.
669 CGCXXABI *CreateMicrosoftCXXABI(CodeGenModule &CGM);
670 
672  llvm::CatchPadInst *CPI;
673 
674  CatchRetScope(llvm::CatchPadInst *CPI) : CPI(CPI) {}
675 
676  void Emit(CodeGenFunction &CGF, Flags flags) override {
677  llvm::BasicBlock *BB = CGF.createBasicBlock("catchret.dest");
678  CGF.Builder.CreateCatchRet(CPI, BB);
679  CGF.EmitBlock(BB);
680  }
681 };
682 }
683 }
684 
685 #endif
clang::CodeGen::CGCXXABI::canCallMismatchedFunctionType
virtual bool canCallMismatchedFunctionType() const
Returns true if the target allows calling a function through a pointer with a different signature tha...
Definition: CGCXXABI.h:147
clang::CodeGen::CGCXXABI::ReadArrayCookie
virtual void ReadArrayCookie(CodeGenFunction &CGF, Address Ptr, const CXXDeleteExpr *expr, QualType ElementType, llvm::Value *&NumElements, llvm::Value *&AllocPtr, CharUnits &CookieSize)
Reads the array cookie associated with the given pointer, if it has one.
Definition: CGCXXABI.cpp:248
clang::CodeGen::CreateItaniumCXXABI
CGCXXABI * CreateItaniumCXXABI(CodeGenModule &CGM)
Creates an Itanium-family ABI.
Definition: ItaniumCXXABI.cpp:502
clang::CodeGen::CodeGenFunction::ConvertTypeForMem
llvm::Type * ConvertTypeForMem(QualType T)
Definition: CodeGenFunction.cpp:210
clang::GlobalDecl::getDtorType
CXXDtorType getDtorType() const
Definition: GlobalDecl.h:110
clang::CodeGen::CGCXXABI::getCXXDestructorLinkage
virtual llvm::GlobalValue::LinkageTypes getCXXDestructorLinkage(GVALinkage Linkage, const CXXDestructorDecl *Dtor, CXXDtorType DT) const
Definition: CGCXXABI.cpp:315
llvm
YAML serialization mapping.
Definition: Dominators.h:30
clang::CXXConstructorDecl
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2436
clang::CodeGen::CGCXXABI::EmitMemberPointerConversion
virtual llvm::Value * EmitMemberPointerConversion(CodeGenFunction &CGF, const CastExpr *E, llvm::Value *Src)
Perform a derived-to-base, base-to-derived, or bitcast member pointer conversion.
Definition: CGCXXABI.cpp:67
clang::CodeGen::CGCXXABI::EmitBadCastCall
virtual bool EmitBadCastCall(CodeGenFunction &CGF)=0
clang::CodeGen::RValue
RValue - This trivial value class is used to represent the result of an expression that is evaluated.
Definition: CGValue.h:39
clang::CodeGen::CGCXXABI::EmitMemberFunctionPointer
virtual llvm::Constant * EmitMemberFunctionPointer(const CXXMethodDecl *MD)
Create a member pointer for the given method.
Definition: CGCXXABI.cpp:102
clang::CodeGen::CGCXXABI::ErrorUnsupportedABI
void ErrorUnsupportedABI(CodeGenFunction &CGF, StringRef S)
Issue a diagnostic about unsupported features in the ABI.
Definition: CGCXXABI.cpp:23
CodeGenFunction.h
clang::CodeGen::CGCXXABI::EmitThreadLocalVarDeclLValue
virtual LValue EmitThreadLocalVarDeclLValue(CodeGenFunction &CGF, const VarDecl *VD, QualType LValType)=0
Emit a reference to a non-local thread_local variable (including triggering the initialization of all...
Ret
static bool Ret(InterpState &S, CodePtr &PC, APValue &Result)
Definition: Interp.cpp:34
clang::CodeGen::CGCXXABI::getAddrOfCXXCatchHandlerType
virtual CatchTypeInfo getAddrOfCXXCatchHandlerType(QualType Ty, QualType CatchHandlerType)=0
clang::CodeGen::CGCXXABI::AddedStructorArgs::Arg
Definition: CGCXXABI.h:326
clang::CodeGen::CGCXXABI::HasThisReturn
virtual bool HasThisReturn(GlobalDecl GD) const
Returns true if the given constructor or destructor is one of the kinds that the ABI says returns 'th...
Definition: CGCXXABI.h:127
clang::CodeGen::CGCXXABI::LoadVTablePtr
virtual std::pair< llvm::Value *, const CXXRecordDecl * > LoadVTablePtr(CodeGenFunction &CGF, Address This, const CXXRecordDecl *RD)=0
Load a vtable from This, an object of polymorphic type RD, or from one of its virtual bases if it doe...
clang::CodeGen::CGCXXABI::RAA_DirectInMemory
@ RAA_DirectInMemory
Pass it on the stack using its defined layout.
Definition: CGCXXABI.h:162
clang::CodeGen::CGCXXABI::emitVirtualObjectDelete
virtual void emitVirtualObjectDelete(CodeGenFunction &CGF, const CXXDeleteExpr *DE, Address Ptr, QualType ElementType, const CXXDestructorDecl *Dtor)=0
clang::CodeGen::CGCXXABI::AddedStructorArgs::AddedStructorArgs
AddedStructorArgs(SmallVector< Arg, 1 > P, SmallVector< Arg, 1 > S)
Definition: CGCXXABI.h:333
llvm::SmallVector
Definition: LLVM.h:38
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::CodeGen::CGCXXABI::classifyReturnType
virtual bool classifyReturnType(CGFunctionInfo &FI) const =0
If the C++ ABI requires the given type be returned in a particular way, this method sets RetAI and re...
clang::CodeGen::CGCXXABI::getMangleContext
MangleContext & getMangleContext()
Gets the mangle context.
Definition: CGCXXABI.h:117
clang::CodeGen::CGCXXABI::AddedStructorArgs::Arg::Value
llvm::Value * Value
Definition: CGCXXABI.h:327
clang::CodeGen::CGCXXABI::AddedStructorArgs
Additional implicit arguments to add to the beginning (Prefix) and end (Suffix) of a constructor / de...
Definition: CGCXXABI.h:325
clang::CodeGen::CGCXXABI::EmitGuardedInit
virtual void EmitGuardedInit(CodeGenFunction &CGF, const VarDecl &D, llvm::GlobalVariable *DeclPtr, bool PerformInit)=0
Emits the guarded initializer and destructor setup for the given variable, given that it couldn't be ...
clang::CodeGen::CGCXXABI::NeedsVTTParameter
virtual bool NeedsVTTParameter(GlobalDecl GD)
Return whether the given global decl needs a VTT parameter.
Definition: CGCXXABI.cpp:322
clang::CodeGen::CGCXXABI::InitializeArrayCookie
virtual Address InitializeArrayCookie(CodeGenFunction &CGF, Address NewPtr, llvm::Value *NumElements, const CXXNewExpr *expr, QualType ElementType)
Initialize the array cookie for the given allocation.
Definition: CGCXXABI.cpp:219
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:737
clang::CodeGen::CGCXXABI::MangleCtx
std::unique_ptr< MangleContext > MangleCtx
Definition: CGCXXABI.h:48
AttributeLangSupport::C
@ C
Definition: SemaDeclAttr.cpp:56
clang::GVALinkage
GVALinkage
A more specific kind of linkage than enum Linkage.
Definition: Linkage.h:73
clang::CodeGen::CodeGenModule::getContext
ASTContext & getContext() const
Definition: CodeGenModule.h:722
clang::CodeGen::CGCXXABI::isVirtualOffsetNeededForVTableField
virtual bool isVirtualOffsetNeededForVTableField(CodeGenFunction &CGF, CodeGenFunction::VPtr Vptr)=0
Checks if ABI requires extra virtual offset for vtable field.
clang::CodeGen::CGCXXABI::getMemberPointerAdjustment
llvm::Constant * getMemberPointerAdjustment(const CastExpr *E)
A utility method for computing the offset required for the given base-to-derived or derived-to-base m...
Definition: CGCXXABI.cpp:280
clang::CodeGen::CGCXXABI::setCXXABIThisValue
void setCXXABIThisValue(CodeGenFunction &CGF, llvm::Value *ThisPtr)
Definition: CGCXXABI.cpp:150
clang::CodeGen::CGCXXABI::constructorsAndDestructorsReturnThis
virtual bool constructorsAndDestructorsReturnThis() const
Definition: CGCXXABI.h:108
clang::CodeGen::CodeGenFunction::createBasicBlock
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
Definition: CodeGenFunction.h:2428
clang::CXXNewExpr
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Definition: ExprCXX.h:2146
clang::CodeGen::CGCXXABI::usesThreadWrapperFunction
virtual bool usesThreadWrapperFunction(const VarDecl *VD) const =0
clang::CodeGen::CGCXXABI::isSRetParameterAfterThis
virtual bool isSRetParameterAfterThis() const
Returns true if the implicit 'sret' parameter comes after the implicit 'this' parameter of C++ instan...
Definition: CGCXXABI.h:173
clang::CodeGen::CatchRetScope::CPI
llvm::CatchPadInst * CPI
Definition: CGCXXABI.h:672
clang::CodeGen::CGCXXABI::registerGlobalDtor
virtual void registerGlobalDtor(CodeGenFunction &CGF, const VarDecl &D, llvm::FunctionCallee Dtor, llvm::Constant *Addr)=0
Emit code to force the execution of a destructor during global teardown.
clang::CodeGen::CGCXXABI::emitRethrow
virtual void emitRethrow(CodeGenFunction &CGF, bool isNoReturn)=0
clang::CodeGen::CatchRetScope::CatchRetScope
CatchRetScope(llvm::CatchPadInst *CPI)
Definition: CGCXXABI.h:674
clang::CodeGen::CGCXXABI::EmitTypeid
virtual llvm::Value * EmitTypeid(CodeGenFunction &CGF, QualType SrcRecordTy, Address ThisPtr, llvm::Type *StdTypeInfoPtrTy)=0
clang::CodeGen::CGCXXABI::EmitDestructorCall
virtual void EmitDestructorCall(CodeGenFunction &CGF, const CXXDestructorDecl *DD, CXXDtorType Type, bool ForVirtualBase, bool Delegating, Address This, QualType ThisTy)=0
Emit the destructor call.
clang::CodeGen::EHScopeStack::Cleanup::Flags
Generation flags.
Definition: EHScopeStack.h:156
clang::CodeGen::CodeGenFunction::Builder
CGBuilderTy Builder
Definition: CodeGenFunction.h:269
CodeGenABITypes.h
clang::CodeGen::CGCXXABI::getAddrOfRTTIDescriptor
virtual llvm::Constant * getAddrOfRTTIDescriptor(QualType Ty)=0
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1565
clang::CodeGen::CGCXXABI::mayNeedDestruction
bool mayNeedDestruction(const VarDecl *VD) const
Definition: CGCXXABI.cpp:156
clang::CXXThrowExpr
A C++ throw-expression (C++ [except.throw]).
Definition: ExprCXX.h:1188
clang::GlobalDecl
GlobalDecl - represents a global declaration.
Definition: GlobalDecl.h:56
clang::CodeGen::CGCXXABI::getAddrOfVTable
virtual llvm::GlobalVariable * getAddrOfVTable(const CXXRecordDecl *RD, CharUnits VPtrOffset)=0
Get the address of the vtable for the given record decl which should be used for the vptr at the give...
clang::CodeGen::CGCXXABI::RAA_Default
@ RAA_Default
Pass it using the normal C aggregate rules for the ABI, potentially introducing extra copies and pass...
Definition: CGCXXABI.h:157
clang::CodeGen::CGCXXABI::getCatchAllTypeInfo
virtual CatchTypeInfo getCatchAllTypeInfo()
Definition: CGCXXABI.cpp:333
clang::CodeGen::CGCXXABI::emitVirtualInheritanceTables
virtual void emitVirtualInheritanceTables(const CXXRecordDecl *RD)=0
Emit any tables needed to implement virtual inheritance.
clang::CodeGen::CGCXXABI::readArrayCookieImpl
virtual llvm::Value * readArrayCookieImpl(CodeGenFunction &IGF, Address ptr, CharUnits cookieSize)
Reads the array cookie for an allocation which is known to have one.
Definition: CGCXXABI.cpp:270
clang::CodeGen::CGCXXABI::loadIncomingCXXThis
llvm::Value * loadIncomingCXXThis(CodeGenFunction &CGF)
Loads the incoming C++ this pointer as it was passed by the caller.
Definition: CGCXXABI.cpp:145
clang::CodeGen::CGCXXABI::buildThisParam
void buildThisParam(CodeGenFunction &CGF, FunctionArgList &Params)
Build a parameter variable suitable for 'this'.
Definition: CGCXXABI.cpp:121
clang::CodeGen::CGCXXABI::EmitNullMemberPointer
virtual llvm::Constant * EmitNullMemberPointer(const MemberPointerType *MPT)
Create a null member pointer of the given type.
Definition: CGCXXABI.cpp:98
clang::ast_matchers::expr
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
Definition: ASTMatchersInternal.cpp:890
clang::CodeGen::CGCXXABI::initializeHiddenVirtualInheritanceMembers
virtual void initializeHiddenVirtualInheritanceMembers(CodeGenFunction &CGF, const CXXRecordDecl *RD)
Emit the code to initialize hidden members required to handle virtual inheritance,...
Definition: CGCXXABI.h:314
clang::MangleContext
MangleContext - Context for tracking state which persists across multiple calls to the C++ name mangl...
Definition: Mangle.h:44
clang::CXXCtorType
CXXCtorType
C++ constructor types.
Definition: ABI.h:24
clang::CodeGen::CGCXXABI::EmitMemberPointerComparison
virtual llvm::Value * EmitMemberPointerComparison(CodeGenFunction &CGF, llvm::Value *L, llvm::Value *R, const MemberPointerType *MPT, bool Inequality)
Emit a comparison between two member pointers. Returns an i1.
Definition: CGCXXABI.cpp:80
clang::CodeGen::EHScopeStack::Cleanup
Information for lazily generating a cleanup.
Definition: EHScopeStack.h:141
clang::CodeGen::CGCXXABI::getImplicitConstructorArgs
virtual AddedStructorArgs getImplicitConstructorArgs(CodeGenFunction &CGF, const CXXConstructorDecl *D, CXXCtorType Type, bool ForVirtualBase, bool Delegating)=0
clang::Linkage
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
Definition: Linkage.h:23
clang::CodeGen::CGCXXABI::getVTableAddressPoint
virtual llvm::Constant * getVTableAddressPoint(BaseSubobject Base, const CXXRecordDecl *VTableClass)=0
Get the address point of the vtable for the given base subobject.
clang::CodeGen::CGCXXABI::AddedStructorArgs::AddedStructorArgs
AddedStructorArgs()=default
clang::BaseSubobject
Definition: BaseSubobject.h:30
clang::CodeGen::CGCXXABI::EmitMemberDataPointer
virtual llvm::Constant * EmitMemberDataPointer(const MemberPointerType *MPT, CharUnits offset)
Create a member pointer for the given field.
Definition: CGCXXABI.cpp:107
clang::CodeGen::CGCXXABI::addImplicitConstructorArgs
AddedStructorArgCounts addImplicitConstructorArgs(CodeGenFunction &CGF, const CXXConstructorDecl *D, CXXCtorType Type, bool ForVirtualBase, bool Delegating, CallArgList &Args)
Add any ABI-specific implicit arguments needed to call a constructor.
Definition: CGCXXABI.cpp:341
clang::CodeGen::CodeGenModule::getCodeGenOpts
const CodeGenOptions & getCodeGenOpts() const
Definition: CodeGenModule.h:731
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:209
clang::CXXDtorType
CXXDtorType
C++ destructor types.
Definition: ABI.h:33
clang::CodeGen::CGCXXABI::performReturnAdjustment
virtual llvm::Value * performReturnAdjustment(CodeGenFunction &CGF, Address Ret, const ReturnAdjustment &RA)=0
clang::CodeGen::CGCXXABI::emitThrow
virtual void emitThrow(CodeGenFunction &CGF, const CXXThrowExpr *E)=0
clang::CodeGen::CGCXXABI::isMemberPointerConvertible
virtual bool isMemberPointerConvertible(const MemberPointerType *MPT) const
Return whether or not a member pointers type is convertible to an IR type.
Definition: CGCXXABI.h:217
clang::CodeGen::CGCXXABI::getThrowInfo
virtual llvm::GlobalVariable * getThrowInfo(QualType T)
Definition: CGCXXABI.h:263
clang::CodeGen::CGCXXABI::RecordArgABI
RecordArgABI
Specify how one should pass an argument of a record type.
Definition: CGCXXABI.h:154
clang::CodeGen::CGCXXABI::getVTableAddressPointInStructor
virtual llvm::Value * getVTableAddressPointInStructor(CodeGenFunction &CGF, const CXXRecordDecl *RD, BaseSubobject Base, const CXXRecordDecl *NearestVBase)=0
Get the address point of the vtable for the given base subobject while building a constructor or a de...
clang::CodeGen::CGCXXABI::getThisArgumentTypeForMethod
virtual const CXXRecordDecl * getThisArgumentTypeForMethod(const CXXMethodDecl *MD)
Get the type of the implicit "this" parameter used by a method.
Definition: CGCXXABI.h:383
clang::CodeGen::CGCXXABI::getThisValue
llvm::Value * getThisValue(CodeGenFunction &CGF)
Definition: CGCXXABI.h:57
clang::CodeGen::CGCXXABI::AddedStructorArgCounts::Suffix
unsigned Suffix
Definition: CGCXXABI.h:347
clang::CodeGen::CGCXXABI::AddedStructorArgCounts::AddedStructorArgCounts
AddedStructorArgCounts(unsigned P, unsigned S)
Definition: CGCXXABI.h:349
clang::CodeGen::CGCXXABI::adjustThisArgumentForVirtualFunctionCall
virtual Address adjustThisArgumentForVirtualFunctionCall(CodeGenFunction &CGF, GlobalDecl GD, Address This, bool VirtualCall)
Perform ABI-specific "this" argument adjustment required prior to a call of a virtual function.
Definition: CGCXXABI.h:391
clang::CXXDestructorDecl
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2703
clang::CodeGen::CGCXXABI::performThisAdjustment
virtual llvm::Value * performThisAdjustment(CodeGenFunction &CGF, Address This, const ThisAdjustment &TA)=0
clang::ImplicitParamDecl
Definition: Decl.h:1645
clang::CodeGen::CGCXXABI::getThisAddress
Address getThisAddress(CodeGenFunction &CGF)
Definition: CGCXXABI.h:60
clang::CodeGen::CGCXXABI::AddedStructorArgCounts::suffix
static AddedStructorArgCounts suffix(unsigned N)
Definition: CGCXXABI.h:351
clang::CodeGen::CGCXXABI::EmitBadTypeidCall
virtual void EmitBadTypeidCall(CodeGenFunction &CGF)=0
clang::CodeGen::CGCXXABI::EmitLoadOfMemberFunctionPointer
virtual CGCallee EmitLoadOfMemberFunctionPointer(CodeGenFunction &CGF, const Expr *E, Address This, llvm::Value *&ThisPtrForCall, llvm::Value *MemPtr, const MemberPointerType *MPT)
Load a member function from an object and a member function pointer.
Definition: CGCXXABI.cpp:41
clang::VarDecl
Represents a variable declaration or definition.
Definition: Decl.h:906
clang::CodeGen::CGCXXABI::~CGCXXABI
virtual ~CGCXXABI()
Definition: CGCXXABI.cpp:21
clang::Type::getPointeeType
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
Definition: Type.cpp:625
clang::ReturnAdjustment
A return adjustment.
Definition: Thunk.h:26
clang::CodeGen::CGCXXABI::isEmittedWithConstantInitializer
bool isEmittedWithConstantInitializer(const VarDecl *VD, bool InspectInitForWeakDef=false) const
Determine whether we will definitely emit this variable with a constant initializer,...
Definition: CGCXXABI.cpp:169
clang::CodeGen::CGCXXABI::getVBPtrOffsets
virtual std::vector< CharUnits > getVBPtrOffsets(const CXXRecordDecl *RD)
Gets the offsets of all the virtual base pointers in a given class.
Definition: CGCXXABI.cpp:337
clang::CodeGen::CGCXXABI::getVirtualFunctionPointer
virtual CGCallee getVirtualFunctionPointer(CodeGenFunction &CGF, GlobalDecl GD, Address This, llvm::Type *Ty, SourceLocation Loc)=0
Build a virtual function pointer in the ABI-specific way.
clang::CodeGen::CGCXXABI::emitBeginCatch
virtual void emitBeginCatch(CodeGenFunction &CGF, const CXXCatchStmt *C)=0
clang::CodeGen::CGCXXABI::getStructorImplicitParamValue
llvm::Value *& getStructorImplicitParamValue(CodeGenFunction &CGF)
Definition: CGCXXABI.h:76
clang::CharUnits::Zero
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
Definition: CharUnits.h:53
clang::CodeGen::Address
An aligned address.
Definition: Address.h:74
Base
clang::CodeGen::CGCXXABI::AddedStructorArgCounts::AddedStructorArgCounts
AddedStructorArgCounts()=default
clang::CodeGen::CatchRetScope::Emit
void Emit(CodeGenFunction &CGF, Flags flags) override
Emit the cleanup.
Definition: CGCXXABI.h:676
clang::CodeGen::CGCXXABI::GetBogusMemberPointer
llvm::Constant * GetBogusMemberPointer(QualType T)
Get a null value for unsupported member pointers.
Definition: CGCXXABI.cpp:32
clang::CodeGen::CGCXXABI::getRecordArgABI
virtual RecordArgABI getRecordArgABI(const CXXRecordDecl *RD) const =0
Returns how an argument of the given record type should be passed.
clang::CodeGen::CGCXXABI::emitCXXStructor
virtual void emitCXXStructor(GlobalDecl GD)=0
Emit a single constructor/destructor with the given type from a C++ constructor Decl.
clang::CodeGen::CGCXXABI::setCXXDestructorDLLStorage
virtual void setCXXDestructorDLLStorage(llvm::GlobalValue *GV, const CXXDestructorDecl *Dtor, CXXDtorType DT) const
Definition: CGCXXABI.cpp:308
clang::CodeGen::CGCXXABI::emitTerminateForUnexpectedException
virtual llvm::CallInst * emitTerminateForUnexpectedException(CodeGenFunction &CGF, llvm::Value *Exn)
Definition: CGCXXABI.cpp:327
clang::CodeGen::CGCXXABI::isPermittedToBeHomogeneousAggregate
virtual bool isPermittedToBeHomogeneousAggregate(const CXXRecordDecl *RD) const
Returns true if the ABI permits the argument to be a homogeneous aggregate.
Definition: CGCXXABI.h:178
clang::CodeGen::CGCXXABI::useThunkForDtorVariant
virtual bool useThunkForDtorVariant(const CXXDestructorDecl *Dtor, CXXDtorType DT) const =0
Returns true if the given destructor type should be emitted as a linkonce delegating thunk,...
clang::CodeGen::CGCXXABI::EmitMemberPointer
virtual llvm::Constant * EmitMemberPointer(const APValue &MP, QualType MPT)
Create a member pointer for the given member pointer constant.
Definition: CGCXXABI.cpp:112
clang::CodeGen::CGCXXABI::getVTableAddressPointForConstExpr
virtual llvm::Constant * getVTableAddressPointForConstExpr(BaseSubobject Base, const CXXRecordDecl *VTableClass)=0
Get the address point of the vtable for the given base subobject while building a constexpr.
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:254
clang::CodeGen::LValue
LValue - This represents an lvalue references.
Definition: CGValue.h:171
clang::RISCV::TA
@ TA
Definition: RISCVVIntrinsicUtils.h:98
P
StringRef P
Definition: ASTMatchersInternal.cpp:563
clang::CodeGen::CGCXXABI::doStructorsInitializeVPtrs
virtual bool doStructorsInitializeVPtrs(const CXXRecordDecl *VTableClass)=0
Checks if ABI requires to initialize vptrs for given dynamic class.
clang::CodeGen::CGCXXABI::addImplicitStructorParams
virtual void addImplicitStructorParams(CodeGenFunction &CGF, QualType &ResTy, FunctionArgList &Params)=0
Insert any ABI-specific implicit parameters into the parameter list for a function.
clang::CodeGen::CodeGenFunction
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
Definition: CodeGenFunction.h:231
clang::CodeGen::CGCXXABI::RAA_Indirect
@ RAA_Indirect
Pass it as a pointer to temporary memory.
Definition: CGCXXABI.h:165
clang::CodeGen::CGCXXABI::setThunkLinkage
virtual void setThunkLinkage(llvm::Function *Thunk, bool ForVTable, GlobalDecl GD, bool ReturnAdjustment)=0
clang::CodeGen::CGCXXABI::AddedStructorArgCounts
Similar to AddedStructorArgs, but only notes the number of additional arguments.
Definition: CGCXXABI.h:345
clang::CodeGen::CodeGenModule
This class organizes the cross-function state that is used while generating LLVM code.
Definition: CodeGenModule.h:279
clang::CXXDeleteExpr
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition: ExprCXX.h:2422
llvm::ArrayRef
Definition: LLVM.h:34
Value
Value
Definition: UninitializedValues.cpp:103
clang::CodeGen::CGCXXABI::buildStructorSignature
virtual AddedStructorArgCounts buildStructorSignature(GlobalDecl GD, SmallVectorImpl< CanQualType > &ArgTys)=0
Build the signature of the given constructor or destructor variant by adding any required parameters.
clang::CodeGen::CGCXXABI::requiresArrayCookie
virtual bool requiresArrayCookie(const CXXDeleteExpr *E, QualType eltType)
Definition: CGCXXABI.cpp:229
clang::CodeGen::CGCXXABI::GetDeletedVirtualCallName
virtual StringRef GetDeletedVirtualCallName()=0
Gets the deleted virtual member call name.
clang::CodeGen::CGCallee
All available information about a concrete callee.
Definition: CGCall.h:60
clang::CodeGen::FunctionArgList
FunctionArgList - Type for representing both the decl and type of parameters to a function.
Definition: CGCall.h:353
LLVM.h
clang::CodeGen::CGCXXABI::hasMostDerivedReturn
virtual bool hasMostDerivedReturn(GlobalDecl GD) const
Definition: CGCXXABI.h:135
clang::CodeGen::CGCXXABI::AddedStructorArgs::Suffix
SmallVector< Arg, 1 > Suffix
Definition: CGCXXABI.h:331
clang::CodeGen::CGCXXABI::CGM
CodeGenModule & CGM
Definition: CGCXXABI.h:47
clang::CodeGen::CGCXXABI::EmitReturnFromThunk
virtual void EmitReturnFromThunk(CodeGenFunction &CGF, RValue RV, QualType ResultType)
Definition: CGCXXABI.cpp:201
clang::CodeGen::CGCXXABI::EmitMemberPointerIsNotNull
virtual llvm::Value * EmitMemberPointerIsNotNull(CodeGenFunction &CGF, llvm::Value *MemPtr, const MemberPointerType *MPT)
Determine if a member pointer is non-null. Returns an i1.
Definition: CGCXXABI.cpp:90
clang::CodeGen::CGCXXABI::AddedStructorArgs::prefix
static AddedStructorArgs prefix(SmallVector< Arg, 1 > Args)
Definition: CGCXXABI.h:335
clang::CodeGen::CGCXXABI::shouldTypeidBeNullChecked
virtual bool shouldTypeidBeNullChecked(bool IsDeref, QualType SrcRecordTy)=0
clang::MemberPointerType
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:2960
clang::CodeGen::CGFunctionInfo
CGFunctionInfo - Class to encapsulate the information about a function definition.
Definition: CGFunctionInfo.h:546
clang::CodeGen::CGCXXABI::ConvertMemberPointerType
virtual llvm::Type * ConvertMemberPointerType(const MemberPointerType *MPT)
Find the LLVM type used to represent the given member pointer type.
Definition: CGCXXABI.cpp:37
clang::CodeGen::CGCXXABI::EmitMemberDataPointerAddress
virtual llvm::Value * EmitMemberDataPointerAddress(CodeGenFunction &CGF, const Expr *E, Address Base, llvm::Value *MemPtr, const MemberPointerType *MPT)
Calculate an l-value from an object and a data member pointer.
Definition: CGCXXABI.cpp:58
std
Definition: Format.h:4477
clang::CodeGen::CGCXXABI::shouldDynamicCastCallBeNullChecked
virtual bool shouldDynamicCastCallBeNullChecked(bool SrcIsPtr, QualType SrcRecordTy)=0
clang::interp::This
bool This(InterpState &S, CodePtr OpPC)
Definition: Interp.h:1137
clang::CodeGen::CGCXXABI::getCXXDestructorImplicitParam
virtual llvm::Value * getCXXDestructorImplicitParam(CodeGenFunction &CGF, const CXXDestructorDecl *DD, CXXDtorType Type, bool ForVirtualBase, bool Delegating)=0
Get the implicit (second) parameter that comes after the "this" pointer, or nullptr if there is isn't...
clang::CodeGen::CGCXXABI::EmitDynamicCastToVoid
virtual llvm::Value * EmitDynamicCastToVoid(CodeGenFunction &CGF, Address Value, QualType SrcRecordTy, QualType DestTy)=0
clang
Definition: CalledOnceCheck.h:17
clang::CodeGen::CGCXXABI::EmitCtorCompleteObjectHandler
virtual llvm::BasicBlock * EmitCtorCompleteObjectHandler(CodeGenFunction &CGF, const CXXRecordDecl *RD)
Definition: CGCXXABI.cpp:299
clang::CodeGen::CatchTypeInfo
The MS C++ ABI needs a pointer to RTTI data plus some flags to describe the type of a catch handler,...
Definition: CGCleanup.h:36
clang::CodeGen::CGCXXABI::canSpeculativelyEmitVTable
virtual bool canSpeculativelyEmitVTable(const CXXRecordDecl *RD) const =0
Determine whether it's possible to emit a vtable for RD, even though we do not know that the vtable h...
clang::CXXCatchStmt
CXXCatchStmt - This represents a C++ catch block.
Definition: StmtCXX.h:28
clang::CodeGen::CGCXXABI::EmitCXXConstructors
virtual void EmitCXXConstructors(const CXXConstructorDecl *D)=0
Emit constructor variants required by this ABI.
clang::CodeGen::CGCXXABI::EmitCXXDestructors
virtual void EmitCXXDestructors(const CXXDestructorDecl *D)=0
Emit destructor variants required by this ABI.
clang::CodeGen::CGCXXABI::DeleteOrMemberCallExpr
llvm::PointerUnion< const CXXDeleteExpr *, const CXXMemberCallExpr * > DeleteOrMemberCallExpr
Definition: CGCXXABI.h:487
clang::CodeGen::CGCXXABI::EmitInstanceFunctionProlog
virtual void EmitInstanceFunctionProlog(CodeGenFunction &CGF)=0
Emit the ABI-specific prolog for the function.
clang::CodeGen::CGCXXABI::getVirtualFunctionPrologueThisAdjustment
virtual CharUnits getVirtualFunctionPrologueThisAdjustment(GlobalDecl GD)
Get the ABI-specific "this" parameter adjustment to apply in the prologue of a virtual function.
Definition: CGCXXABI.h:411
clang::Dtor_Deleting
@ Dtor_Deleting
Deleting dtor.
Definition: ABI.h:34
clang::CodeGen::CGCXXABI::AddedStructorArgCounts::Prefix
unsigned Prefix
Definition: CGCXXABI.h:346
clang::CodeGen::CGCXXABI::emitVTableDefinitions
virtual void emitVTableDefinitions(CodeGenVTables &CGVT, const CXXRecordDecl *RD)=0
Emits the VTable definitions required for the given record type.
clang::CodeGen::CGCXXABI::GetVirtualBaseClassOffset
virtual llvm::Value * GetVirtualBaseClassOffset(CodeGenFunction &CGF, Address This, const CXXRecordDecl *ClassDecl, const CXXRecordDecl *BaseClassDecl)=0
clang::CodeGen::CodeGenFunction::VPtr
Struct with all information about dynamic [sub]class needed to set vptr.
Definition: CodeGenFunction.h:2268
clang::CodeGen::CodeGenVTables
Definition: CGVTables.h:32
clang::GlobalDecl::getDecl
const Decl * getDecl() const
Definition: GlobalDecl.h:103
clang::CodeGen::CGCXXABI::useSinitAndSterm
virtual bool useSinitAndSterm() const
Definition: CGCXXABI.h:137
clang::CodeGen::CGCXXABI
Implements C++ ABI-specific code generation functions.
Definition: CGCXXABI.h:43
clang::CodeGen::CGCXXABI::EmitVirtualDestructorCall
virtual llvm::Value * EmitVirtualDestructorCall(CodeGenFunction &CGF, const CXXDestructorDecl *Dtor, CXXDtorType DtorType, Address This, DeleteOrMemberCallExpr E)=0
Emit the ABI-specific virtual destructor call.
clang::CodeGen::CatchRetScope
Definition: CGCXXABI.h:671
clang::CharUnits
CharUnits - This is an opaque type for sizes expressed in character units.
Definition: CharUnits.h:38
clang::APValue
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition: APValue.h:122
clang::CodeGen::CGCXXABI::getStructorImplicitParamDecl
ImplicitParamDecl *& getStructorImplicitParamDecl(CodeGenFunction &CGF)
Definition: CGCXXABI.h:73
clang::CodeGen::CGCXXABI::AddedStructorArgs::Arg::Type
QualType Type
Definition: CGCXXABI.h:328
llvm::SmallVectorImpl
Definition: Randstruct.h:18
clang::ValueDecl::getType
QualType getType() const
Definition: Decl.h:712
clang::Expr
This represents one expression.
Definition: Expr.h:109
clang::CodeGen::CGCXXABI::isThisCompleteObject
virtual bool isThisCompleteObject(GlobalDecl GD) const =0
Determine whether there's something special about the rules of the ABI tell us that 'this' is a compl...
clang::CodeGen::CGCXXABI::adjustCallArgsForDestructorThunk
virtual void adjustCallArgsForDestructorThunk(CodeGenFunction &CGF, GlobalDecl GD, CallArgList &CallArgs)
Definition: CGCXXABI.h:496
clang::CodeGen::CreateMicrosoftCXXABI
CGCXXABI * CreateMicrosoftCXXABI(CodeGenModule &CGM)
Creates a Microsoft-family ABI.
Definition: MicrosoftCXXABI.cpp:3546
clang::ThisAdjustment
A this pointer adjustment.
Definition: Thunk.h:91
clang::CodeGen::CGCXXABI::exportThunk
virtual bool exportThunk()=0
clang::CodeGen::CGCXXABI::getArrayCookieSizeImpl
virtual CharUnits getArrayCookieSizeImpl(QualType elementType)
Returns the extra size required in order to store the array cookie for the given type.
Definition: CGCXXABI.cpp:214
clang::CodeGen::CGCXXABI::CGCXXABI
CGCXXABI(CodeGenModule &CGM)
Definition: CGCXXABI.h:50
clang::CodeGen::CGCXXABI::EmitThreadLocalInitFuncs
virtual void EmitThreadLocalInitFuncs(CodeGenModule &CGM, ArrayRef< const VarDecl * > CXXThreadLocals, ArrayRef< llvm::Function * > CXXThreadLocalInits, ArrayRef< const VarDecl * > CXXThreadLocalInitVars)=0
Emits ABI-required functions necessary to initialize thread_local variables in this translation unit.
clang::CastExpr
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3480
clang::CodeGen::CGCXXABI::GetPureVirtualCallName
virtual StringRef GetPureVirtualCallName()=0
Gets the pure virtual member call function.
clang::CodeGen::CallArgList
CallArgList - Type for representing both the value and type of arguments in a call.
Definition: CGCall.h:259
clang::CodeGen::CodeGenFunction::EmitBlock
void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false)
EmitBlock - Emit the given block.
Definition: CGStmt.cpp:563
clang::CodeGen::CGCXXABI::isZeroInitializable
virtual bool isZeroInitializable(const MemberPointerType *MPT)
Return true if the given member pointer can be zero-initialized (in the C++ sense) with an LLVM zeroi...
Definition: CGCXXABI.cpp:116
clang::CodeGen::CGCXXABI::AddedStructorArgCounts::prefix
static AddedStructorArgCounts prefix(unsigned N)
Definition: CGCXXABI.h:350
clang::CodeGen::CGCXXABI::GetArrayCookieSize
virtual CharUnits GetArrayCookieSize(const CXXNewExpr *expr)
Returns the extra size required in order to store the array cookie for the given new-expression.
Definition: CGCXXABI.cpp:208
clang::CodeGen::CGCXXABI::EmitDynamicCastCall
virtual llvm::Value * EmitDynamicCastCall(CodeGenFunction &CGF, Address Value, QualType SrcRecordTy, QualType DestTy, QualType DestRecordTy, llvm::BasicBlock *CastEnd)=0
clang::CodeGen::CGCXXABI::getContext
ASTContext & getContext() const
Definition: CGCXXABI.h:85
clang::CodeGen::CGCXXABI::AddedStructorArgs::Prefix
SmallVector< Arg, 1 > Prefix
Definition: CGCXXABI.h:330
clang::CodeGen::CGCXXABI::getThisDecl
ImplicitParamDecl * getThisDecl(CodeGenFunction &CGF)
Definition: CGCXXABI.h:54
clang::CXXMethodDecl::getParent
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
Definition: DeclCXX.h:2098
clang::CXXMethodDecl
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1983
clang::CodeGen::CGCXXABI::AddedStructorArgs::suffix
static AddedStructorArgs suffix(SmallVector< Arg, 1 > Args)
Definition: CGCXXABI.h:338
clang::CodeGen::CGCXXABI::getSrcArgforCopyCtor
virtual size_t getSrcArgforCopyCtor(const CXXConstructorDecl *, FunctionArgList &Args) const =0
Type
MatchType Type
Definition: ASTMatchFinder.cpp:71