clang  14.0.0git
CodeGenModule.h
Go to the documentation of this file.
1 //===--- CodeGenModule.h - Per-Module state for LLVM CodeGen ----*- 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 is the internal per-translation-unit state used for llvm translation.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H
14 #define LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H
15 
16 #include "CGVTables.h"
17 #include "CodeGenTypeCache.h"
18 #include "CodeGenTypes.h"
19 #include "SanitizerMetadata.h"
20 #include "clang/AST/DeclCXX.h"
21 #include "clang/AST/DeclObjC.h"
22 #include "clang/AST/DeclOpenMP.h"
23 #include "clang/AST/GlobalDecl.h"
24 #include "clang/AST/Mangle.h"
25 #include "clang/Basic/ABI.h"
27 #include "clang/Basic/Module.h"
29 #include "clang/Basic/TargetInfo.h"
30 #include "clang/Basic/XRayLists.h"
32 #include "llvm/ADT/DenseMap.h"
33 #include "llvm/ADT/SetVector.h"
34 #include "llvm/ADT/SmallPtrSet.h"
35 #include "llvm/ADT/StringMap.h"
36 #include "llvm/IR/Module.h"
37 #include "llvm/IR/ValueHandle.h"
38 #include "llvm/Transforms/Utils/SanitizerStats.h"
39 
40 namespace llvm {
41 class Module;
42 class Constant;
43 class ConstantInt;
44 class Function;
45 class GlobalValue;
46 class DataLayout;
47 class FunctionType;
48 class LLVMContext;
49 class OpenMPIRBuilder;
50 class IndexedInstrProfReader;
51 }
52 
53 namespace clang {
54 class ASTContext;
55 class AtomicType;
56 class FunctionDecl;
57 class IdentifierInfo;
58 class ObjCMethodDecl;
59 class ObjCImplementationDecl;
60 class ObjCCategoryImplDecl;
61 class ObjCProtocolDecl;
62 class ObjCEncodeExpr;
63 class BlockExpr;
64 class CharUnits;
65 class Decl;
66 class Expr;
67 class Stmt;
68 class InitListExpr;
69 class StringLiteral;
70 class NamedDecl;
71 class ValueDecl;
72 class VarDecl;
73 class LangOptions;
74 class CodeGenOptions;
75 class HeaderSearchOptions;
76 class DiagnosticsEngine;
77 class AnnotateAttr;
78 class CXXDestructorDecl;
79 class Module;
80 class CoverageSourceInfo;
81 class TargetAttr;
82 class InitSegAttr;
83 struct ParsedTargetAttr;
84 
85 namespace CodeGen {
86 
87 class CallArgList;
88 class CodeGenFunction;
89 class CodeGenTBAA;
90 class CGCXXABI;
91 class CGDebugInfo;
92 class CGObjCRuntime;
93 class CGOpenCLRuntime;
94 class CGOpenMPRuntime;
95 class CGCUDARuntime;
96 class BlockFieldFlags;
97 class FunctionArgList;
98 class CoverageMappingModuleGen;
99 class TargetCodeGenInfo;
100 
101 enum ForDefinition_t : bool {
104 };
105 
107  unsigned int priority;
108  unsigned int lex_order;
109  OrderGlobalInitsOrStermFinalizers(unsigned int p, unsigned int l)
110  : priority(p), lex_order(l) {}
111 
113  return priority == RHS.priority && lex_order == RHS.lex_order;
114  }
115 
117  return std::tie(priority, lex_order) <
118  std::tie(RHS.priority, RHS.lex_order);
119  }
120 };
121 
123  ObjCEntrypoints() { memset(this, 0, sizeof(*this)); }
124 
125  /// void objc_alloc(id);
126  llvm::FunctionCallee objc_alloc;
127 
128  /// void objc_allocWithZone(id);
129  llvm::FunctionCallee objc_allocWithZone;
130 
131  /// void objc_alloc_init(id);
132  llvm::FunctionCallee objc_alloc_init;
133 
134  /// void objc_autoreleasePoolPop(void*);
135  llvm::FunctionCallee objc_autoreleasePoolPop;
136 
137  /// void objc_autoreleasePoolPop(void*);
138  /// Note this method is used when we are using exception handling
139  llvm::FunctionCallee objc_autoreleasePoolPopInvoke;
140 
141  /// void *objc_autoreleasePoolPush(void);
142  llvm::Function *objc_autoreleasePoolPush;
143 
144  /// id objc_autorelease(id);
145  llvm::Function *objc_autorelease;
146 
147  /// id objc_autorelease(id);
148  /// Note this is the runtime method not the intrinsic.
149  llvm::FunctionCallee objc_autoreleaseRuntimeFunction;
150 
151  /// id objc_autoreleaseReturnValue(id);
153 
154  /// void objc_copyWeak(id *dest, id *src);
155  llvm::Function *objc_copyWeak;
156 
157  /// void objc_destroyWeak(id*);
158  llvm::Function *objc_destroyWeak;
159 
160  /// id objc_initWeak(id*, id);
161  llvm::Function *objc_initWeak;
162 
163  /// id objc_loadWeak(id*);
164  llvm::Function *objc_loadWeak;
165 
166  /// id objc_loadWeakRetained(id*);
167  llvm::Function *objc_loadWeakRetained;
168 
169  /// void objc_moveWeak(id *dest, id *src);
170  llvm::Function *objc_moveWeak;
171 
172  /// id objc_retain(id);
173  llvm::Function *objc_retain;
174 
175  /// id objc_retain(id);
176  /// Note this is the runtime method not the intrinsic.
177  llvm::FunctionCallee objc_retainRuntimeFunction;
178 
179  /// id objc_retainAutorelease(id);
180  llvm::Function *objc_retainAutorelease;
181 
182  /// id objc_retainAutoreleaseReturnValue(id);
184 
185  /// id objc_retainAutoreleasedReturnValue(id);
187 
188  /// id objc_retainBlock(id);
189  llvm::Function *objc_retainBlock;
190 
191  /// void objc_release(id);
192  llvm::Function *objc_release;
193 
194  /// void objc_release(id);
195  /// Note this is the runtime method not the intrinsic.
196  llvm::FunctionCallee objc_releaseRuntimeFunction;
197 
198  /// void objc_storeStrong(id*, id);
199  llvm::Function *objc_storeStrong;
200 
201  /// id objc_storeWeak(id*, id);
202  llvm::Function *objc_storeWeak;
203 
204  /// id objc_unsafeClaimAutoreleasedReturnValue(id);
206 
207  /// A void(void) inline asm to use to mark that the return value of
208  /// a call will be immediately retain.
210 
211  /// void clang.arc.use(...);
212  llvm::Function *clang_arc_use;
213 
214  /// void clang.arc.noop.use(...);
215  llvm::Function *clang_arc_noop_use;
216 };
217 
218 /// This class records statistics on instrumentation based profiling.
220  uint32_t VisitedInMainFile;
221  uint32_t MissingInMainFile;
222  uint32_t Visited;
223  uint32_t Missing;
224  uint32_t Mismatched;
225 
226 public:
228  : VisitedInMainFile(0), MissingInMainFile(0), Visited(0), Missing(0),
229  Mismatched(0) {}
230  /// Record that we've visited a function and whether or not that function was
231  /// in the main source file.
232  void addVisited(bool MainFile) {
233  if (MainFile)
234  ++VisitedInMainFile;
235  ++Visited;
236  }
237  /// Record that a function we've visited has no profile data.
238  void addMissing(bool MainFile) {
239  if (MainFile)
240  ++MissingInMainFile;
241  ++Missing;
242  }
243  /// Record that a function we've visited has mismatched profile data.
244  void addMismatched(bool MainFile) { ++Mismatched; }
245  /// Whether or not the stats we've gathered indicate any potential problems.
246  bool hasDiagnostics() { return Missing || Mismatched; }
247  /// Report potential problems we've found to \c Diags.
248  void reportDiagnostics(DiagnosticsEngine &Diags, StringRef MainFile);
249 };
250 
251 /// A pair of helper functions for a __block variable.
252 class BlockByrefHelpers : public llvm::FoldingSetNode {
253  // MSVC requires this type to be complete in order to process this
254  // header.
255 public:
256  llvm::Constant *CopyHelper;
257  llvm::Constant *DisposeHelper;
258 
259  /// The alignment of the field. This is important because
260  /// different offsets to the field within the byref struct need to
261  /// have different helper functions.
263 
265  : CopyHelper(nullptr), DisposeHelper(nullptr), Alignment(alignment) {}
266  BlockByrefHelpers(const BlockByrefHelpers &) = default;
267  virtual ~BlockByrefHelpers();
268 
269  void Profile(llvm::FoldingSetNodeID &id) const {
270  id.AddInteger(Alignment.getQuantity());
271  profileImpl(id);
272  }
273  virtual void profileImpl(llvm::FoldingSetNodeID &id) const = 0;
274 
275  virtual bool needsCopy() const { return true; }
276  virtual void emitCopy(CodeGenFunction &CGF, Address dest, Address src) = 0;
277 
278  virtual bool needsDispose() const { return true; }
279  virtual void emitDispose(CodeGenFunction &CGF, Address field) = 0;
280 };
281 
282 /// This class organizes the cross-function state that is used while generating
283 /// LLVM code.
285  CodeGenModule(const CodeGenModule &) = delete;
286  void operator=(const CodeGenModule &) = delete;
287 
288 public:
289  struct Structor {
290  Structor() : Priority(0), Initializer(nullptr), AssociatedData(nullptr) {}
291  Structor(int Priority, llvm::Constant *Initializer,
292  llvm::Constant *AssociatedData)
295  int Priority;
296  llvm::Constant *Initializer;
297  llvm::Constant *AssociatedData;
298  };
299 
300  typedef std::vector<Structor> CtorList;
301 
302 private:
303  ASTContext &Context;
304  const LangOptions &LangOpts;
305  const HeaderSearchOptions &HeaderSearchOpts; // Only used for debug info.
306  const PreprocessorOptions &PreprocessorOpts; // Only used for debug info.
307  const CodeGenOptions &CodeGenOpts;
308  unsigned NumAutoVarInit = 0;
309  llvm::Module &TheModule;
310  DiagnosticsEngine &Diags;
311  const TargetInfo &Target;
312  std::unique_ptr<CGCXXABI> ABI;
313  llvm::LLVMContext &VMContext;
314  std::string ModuleNameHash = "";
315 
316  std::unique_ptr<CodeGenTBAA> TBAA;
317 
318  mutable std::unique_ptr<TargetCodeGenInfo> TheTargetCodeGenInfo;
319 
320  // This should not be moved earlier, since its initialization depends on some
321  // of the previous reference members being already initialized and also checks
322  // if TheTargetCodeGenInfo is NULL
323  CodeGenTypes Types;
324 
325  /// Holds information about C++ vtables.
326  CodeGenVTables VTables;
327 
328  std::unique_ptr<CGObjCRuntime> ObjCRuntime;
329  std::unique_ptr<CGOpenCLRuntime> OpenCLRuntime;
330  std::unique_ptr<CGOpenMPRuntime> OpenMPRuntime;
331  std::unique_ptr<CGCUDARuntime> CUDARuntime;
332  std::unique_ptr<CGDebugInfo> DebugInfo;
333  std::unique_ptr<ObjCEntrypoints> ObjCData;
334  llvm::MDNode *NoObjCARCExceptionsMetadata = nullptr;
335  std::unique_ptr<llvm::IndexedInstrProfReader> PGOReader;
336  InstrProfStats PGOStats;
337  std::unique_ptr<llvm::SanitizerStatReport> SanStats;
338 
339  // A set of references that have only been seen via a weakref so far. This is
340  // used to remove the weak of the reference if we ever see a direct reference
341  // or a definition.
343 
344  /// This contains all the decls which have definitions but/ which are deferred
345  /// for emission and therefore should only be output if they are actually
346  /// used. If a decl is in this, then it is known to have not been referenced
347  /// yet.
348  std::map<StringRef, GlobalDecl> DeferredDecls;
349 
350  /// This is a list of deferred decls which we have seen that *are* actually
351  /// referenced. These get code generated when the module is done.
352  std::vector<GlobalDecl> DeferredDeclsToEmit;
353  void addDeferredDeclToEmit(GlobalDecl GD) {
354  DeferredDeclsToEmit.emplace_back(GD);
355  }
356 
357  /// List of alias we have emitted. Used to make sure that what they point to
358  /// is defined once we get to the end of the of the translation unit.
359  std::vector<GlobalDecl> Aliases;
360 
361  /// List of multiversion functions that have to be emitted. Used to make sure
362  /// we properly emit the iFunc.
363  std::vector<GlobalDecl> MultiVersionFuncs;
364 
365  typedef llvm::StringMap<llvm::TrackingVH<llvm::Constant> > ReplacementsTy;
366  ReplacementsTy Replacements;
367 
368  /// List of global values to be replaced with something else. Used when we
369  /// want to replace a GlobalValue but can't identify it by its mangled name
370  /// anymore (because the name is already taken).
372  GlobalValReplacements;
373 
374  /// Variables for which we've emitted globals containing their constant
375  /// values along with the corresponding globals, for opportunistic reuse.
376  llvm::DenseMap<const VarDecl*, llvm::GlobalVariable*> InitializerConstants;
377 
378  /// Set of global decls for which we already diagnosed mangled name conflict.
379  /// Required to not issue a warning (on a mangling conflict) multiple times
380  /// for the same decl.
381  llvm::DenseSet<GlobalDecl> DiagnosedConflictingDefinitions;
382 
383  /// A queue of (optional) vtables to consider emitting.
384  std::vector<const CXXRecordDecl*> DeferredVTables;
385 
386  /// A queue of (optional) vtables that may be emitted opportunistically.
387  std::vector<const CXXRecordDecl *> OpportunisticVTables;
388 
389  /// List of global values which are required to be present in the object file;
390  /// bitcast to i8*. This is used for forcing visibility of symbols which may
391  /// otherwise be optimized out.
392  std::vector<llvm::WeakTrackingVH> LLVMUsed;
393  std::vector<llvm::WeakTrackingVH> LLVMCompilerUsed;
394 
395  /// Store the list of global constructors and their respective priorities to
396  /// be emitted when the translation unit is complete.
397  CtorList GlobalCtors;
398 
399  /// Store the list of global destructors and their respective priorities to be
400  /// emitted when the translation unit is complete.
401  CtorList GlobalDtors;
402 
403  /// An ordered map of canonical GlobalDecls to their mangled names.
404  llvm::MapVector<GlobalDecl, StringRef> MangledDeclNames;
405  llvm::StringMap<GlobalDecl, llvm::BumpPtrAllocator> Manglings;
406 
407  // An ordered map of canonical GlobalDecls paired with the cpu-index for
408  // cpu-specific name manglings.
409  llvm::MapVector<std::pair<GlobalDecl, unsigned>, StringRef>
410  CPUSpecificMangledDeclNames;
411  llvm::StringMap<std::pair<GlobalDecl, unsigned>, llvm::BumpPtrAllocator>
412  CPUSpecificManglings;
413 
414  /// Global annotations.
415  std::vector<llvm::Constant*> Annotations;
416 
417  /// Map used to get unique annotation strings.
418  llvm::StringMap<llvm::Constant*> AnnotationStrings;
419 
420  /// Used for uniquing of annotation arguments.
421  llvm::DenseMap<unsigned, llvm::Constant *> AnnotationArgs;
422 
423  llvm::StringMap<llvm::GlobalVariable *> CFConstantStringMap;
424 
425  llvm::DenseMap<llvm::Constant *, llvm::GlobalVariable *> ConstantStringMap;
426  llvm::DenseMap<const Decl*, llvm::Constant *> StaticLocalDeclMap;
427  llvm::DenseMap<const Decl*, llvm::GlobalVariable*> StaticLocalDeclGuardMap;
428  llvm::DenseMap<const Expr*, llvm::Constant *> MaterializedGlobalTemporaryMap;
429 
430  llvm::DenseMap<QualType, llvm::Constant *> AtomicSetterHelperFnMap;
431  llvm::DenseMap<QualType, llvm::Constant *> AtomicGetterHelperFnMap;
432 
433  /// Map used to get unique type descriptor constants for sanitizers.
434  llvm::DenseMap<QualType, llvm::Constant *> TypeDescriptorMap;
435 
436  /// Map used to track internal linkage functions declared within
437  /// extern "C" regions.
438  typedef llvm::MapVector<IdentifierInfo *,
439  llvm::GlobalValue *> StaticExternCMap;
440  StaticExternCMap StaticExternCValues;
441 
442  /// thread_local variables defined or used in this TU.
443  std::vector<const VarDecl *> CXXThreadLocals;
444 
445  /// thread_local variables with initializers that need to run
446  /// before any thread_local variable in this TU is odr-used.
447  std::vector<llvm::Function *> CXXThreadLocalInits;
448  std::vector<const VarDecl *> CXXThreadLocalInitVars;
449 
450  /// Global variables with initializers that need to run before main.
451  std::vector<llvm::Function *> CXXGlobalInits;
452 
453  /// When a C++ decl with an initializer is deferred, null is
454  /// appended to CXXGlobalInits, and the index of that null is placed
455  /// here so that the initializer will be performed in the correct
456  /// order. Once the decl is emitted, the index is replaced with ~0U to ensure
457  /// that we don't re-emit the initializer.
458  llvm::DenseMap<const Decl*, unsigned> DelayedCXXInitPosition;
459 
460  typedef std::pair<OrderGlobalInitsOrStermFinalizers, llvm::Function *>
461  GlobalInitData;
462 
463  struct GlobalInitPriorityCmp {
464  bool operator()(const GlobalInitData &LHS,
465  const GlobalInitData &RHS) const {
466  return LHS.first.priority < RHS.first.priority;
467  }
468  };
469 
470  /// Global variables with initializers whose order of initialization is set by
471  /// init_priority attribute.
472  SmallVector<GlobalInitData, 8> PrioritizedCXXGlobalInits;
473 
474  /// Global destructor functions and arguments that need to run on termination.
475  /// When UseSinitAndSterm is set, it instead contains sterm finalizer
476  /// functions, which also run on unloading a shared library.
477  typedef std::tuple<llvm::FunctionType *, llvm::WeakTrackingVH,
478  llvm::Constant *>
479  CXXGlobalDtorsOrStermFinalizer_t;
480  SmallVector<CXXGlobalDtorsOrStermFinalizer_t, 8>
481  CXXGlobalDtorsOrStermFinalizers;
482 
483  typedef std::pair<OrderGlobalInitsOrStermFinalizers, llvm::Function *>
484  StermFinalizerData;
485 
486  struct StermFinalizerPriorityCmp {
487  bool operator()(const StermFinalizerData &LHS,
488  const StermFinalizerData &RHS) const {
489  return LHS.first.priority < RHS.first.priority;
490  }
491  };
492 
493  /// Global variables with sterm finalizers whose order of initialization is
494  /// set by init_priority attribute.
495  SmallVector<StermFinalizerData, 8> PrioritizedCXXStermFinalizers;
496 
497  /// The complete set of modules that has been imported.
498  llvm::SetVector<clang::Module *> ImportedModules;
499 
500  /// The set of modules for which the module initializers
501  /// have been emitted.
502  llvm::SmallPtrSet<clang::Module *, 16> EmittedModuleInitializers;
503 
504  /// A vector of metadata strings for linker options.
505  SmallVector<llvm::MDNode *, 16> LinkerOptionsMetadata;
506 
507  /// A vector of metadata strings for dependent libraries for ELF.
508  SmallVector<llvm::MDNode *, 16> ELFDependentLibraries;
509 
510  /// @name Cache for Objective-C runtime types
511  /// @{
512 
513  /// Cached reference to the class for constant strings. This value has type
514  /// int * but is actually an Obj-C class pointer.
515  llvm::WeakTrackingVH CFConstantStringClassRef;
516 
517  /// The type used to describe the state of a fast enumeration in
518  /// Objective-C's for..in loop.
519  QualType ObjCFastEnumerationStateType;
520 
521  /// @}
522 
523  /// Lazily create the Objective-C runtime
524  void createObjCRuntime();
525 
526  void createOpenCLRuntime();
527  void createOpenMPRuntime();
528  void createCUDARuntime();
529 
530  bool isTriviallyRecursive(const FunctionDecl *F);
531  bool shouldEmitFunction(GlobalDecl GD);
532  bool shouldOpportunisticallyEmitVTables();
533  /// Map used to be sure we don't emit the same CompoundLiteral twice.
534  llvm::DenseMap<const CompoundLiteralExpr *, llvm::GlobalVariable *>
535  EmittedCompoundLiterals;
536 
537  /// Map of the global blocks we've emitted, so that we don't have to re-emit
538  /// them if the constexpr evaluator gets aggressive.
539  llvm::DenseMap<const BlockExpr *, llvm::Constant *> EmittedGlobalBlocks;
540 
541  /// @name Cache for Blocks Runtime Globals
542  /// @{
543 
544  llvm::Constant *NSConcreteGlobalBlock = nullptr;
545  llvm::Constant *NSConcreteStackBlock = nullptr;
546 
547  llvm::FunctionCallee BlockObjectAssign = nullptr;
548  llvm::FunctionCallee BlockObjectDispose = nullptr;
549 
550  llvm::Type *BlockDescriptorType = nullptr;
551  llvm::Type *GenericBlockLiteralType = nullptr;
552 
553  struct {
555  } Block;
556 
557  GlobalDecl initializedGlobalDecl;
558 
559  /// @}
560 
561  /// void @llvm.lifetime.start(i64 %size, i8* nocapture <ptr>)
562  llvm::Function *LifetimeStartFn = nullptr;
563 
564  /// void @llvm.lifetime.end(i64 %size, i8* nocapture <ptr>)
565  llvm::Function *LifetimeEndFn = nullptr;
566 
567  std::unique_ptr<SanitizerMetadata> SanitizerMD;
568 
569  llvm::MapVector<const Decl *, bool> DeferredEmptyCoverageMappingDecls;
570 
571  std::unique_ptr<CoverageMappingModuleGen> CoverageMapping;
572 
573  /// Mapping from canonical types to their metadata identifiers. We need to
574  /// maintain this mapping because identifiers may be formed from distinct
575  /// MDNodes.
576  typedef llvm::DenseMap<QualType, llvm::Metadata *> MetadataTypeMap;
577  MetadataTypeMap MetadataIdMap;
578  MetadataTypeMap VirtualMetadataIdMap;
579  MetadataTypeMap GeneralizedMetadataIdMap;
580 
581 public:
582  CodeGenModule(ASTContext &C, const HeaderSearchOptions &headersearchopts,
583  const PreprocessorOptions &ppopts,
584  const CodeGenOptions &CodeGenOpts, llvm::Module &M,
585  DiagnosticsEngine &Diags,
586  CoverageSourceInfo *CoverageInfo = nullptr);
587 
588  ~CodeGenModule();
589 
590  void clear();
591 
592  /// Finalize LLVM code generation.
593  void Release();
594 
595  /// Return true if we should emit location information for expressions.
596  bool getExpressionLocationsEnabled() const;
597 
598  /// Return a reference to the configured Objective-C runtime.
600  if (!ObjCRuntime) createObjCRuntime();
601  return *ObjCRuntime;
602  }
603 
604  /// Return true iff an Objective-C runtime has been configured.
605  bool hasObjCRuntime() { return !!ObjCRuntime; }
606 
607  const std::string &getModuleNameHash() const { return ModuleNameHash; }
608 
609  /// Return a reference to the configured OpenCL runtime.
611  assert(OpenCLRuntime != nullptr);
612  return *OpenCLRuntime;
613  }
614 
615  /// Return a reference to the configured OpenMP runtime.
617  assert(OpenMPRuntime != nullptr);
618  return *OpenMPRuntime;
619  }
620 
621  /// Return a reference to the configured CUDA runtime.
623  assert(CUDARuntime != nullptr);
624  return *CUDARuntime;
625  }
626 
628  assert(ObjCData != nullptr);
629  return *ObjCData;
630  }
631 
632  // Version checking functions, used to implement ObjC's @available:
633  // i32 @__isOSVersionAtLeast(i32, i32, i32)
634  llvm::FunctionCallee IsOSVersionAtLeastFn = nullptr;
635  // i32 @__isPlatformVersionAtLeast(i32, i32, i32, i32)
636  llvm::FunctionCallee IsPlatformVersionAtLeastFn = nullptr;
637 
638  InstrProfStats &getPGOStats() { return PGOStats; }
639  llvm::IndexedInstrProfReader *getPGOReader() const { return PGOReader.get(); }
640 
642  return CoverageMapping.get();
643  }
644 
645  llvm::Constant *getStaticLocalDeclAddress(const VarDecl *D) {
646  return StaticLocalDeclMap[D];
647  }
649  llvm::Constant *C) {
650  StaticLocalDeclMap[D] = C;
651  }
652 
653  llvm::Constant *
655  llvm::GlobalValue::LinkageTypes Linkage);
656 
657  llvm::GlobalVariable *getStaticLocalDeclGuardAddress(const VarDecl *D) {
658  return StaticLocalDeclGuardMap[D];
659  }
661  llvm::GlobalVariable *C) {
662  StaticLocalDeclGuardMap[D] = C;
663  }
664 
665  Address createUnnamedGlobalFrom(const VarDecl &D, llvm::Constant *Constant,
666  CharUnits Align);
667 
668  bool lookupRepresentativeDecl(StringRef MangledName,
669  GlobalDecl &Result) const;
670 
671  llvm::Constant *getAtomicSetterHelperFnMap(QualType Ty) {
672  return AtomicSetterHelperFnMap[Ty];
673  }
675  llvm::Constant *Fn) {
676  AtomicSetterHelperFnMap[Ty] = Fn;
677  }
678 
679  llvm::Constant *getAtomicGetterHelperFnMap(QualType Ty) {
680  return AtomicGetterHelperFnMap[Ty];
681  }
683  llvm::Constant *Fn) {
684  AtomicGetterHelperFnMap[Ty] = Fn;
685  }
686 
687  llvm::Constant *getTypeDescriptorFromMap(QualType Ty) {
688  return TypeDescriptorMap[Ty];
689  }
690  void setTypeDescriptorInMap(QualType Ty, llvm::Constant *C) {
691  TypeDescriptorMap[Ty] = C;
692  }
693 
694  CGDebugInfo *getModuleDebugInfo() { return DebugInfo.get(); }
695 
697  if (!NoObjCARCExceptionsMetadata)
698  NoObjCARCExceptionsMetadata = llvm::MDNode::get(getLLVMContext(), None);
699  return NoObjCARCExceptionsMetadata;
700  }
701 
702  ASTContext &getContext() const { return Context; }
703  const LangOptions &getLangOpts() const { return LangOpts; }
705  const { return HeaderSearchOpts; }
707  const { return PreprocessorOpts; }
708  const CodeGenOptions &getCodeGenOpts() const { return CodeGenOpts; }
709  llvm::Module &getModule() const { return TheModule; }
710  DiagnosticsEngine &getDiags() const { return Diags; }
711  const llvm::DataLayout &getDataLayout() const {
712  return TheModule.getDataLayout();
713  }
714  const TargetInfo &getTarget() const { return Target; }
715  const llvm::Triple &getTriple() const { return Target.getTriple(); }
716  bool supportsCOMDAT() const;
717  void maybeSetTrivialComdat(const Decl &D, llvm::GlobalObject &GO);
718 
719  CGCXXABI &getCXXABI() const { return *ABI; }
720  llvm::LLVMContext &getLLVMContext() { return VMContext; }
721 
722  bool shouldUseTBAA() const { return TBAA != nullptr; }
723 
725 
726  CodeGenTypes &getTypes() { return Types; }
727 
728  CodeGenVTables &getVTables() { return VTables; }
729 
731  return VTables.getItaniumVTableContext();
732  }
733 
735  return VTables.getMicrosoftVTableContext();
736  }
737 
738  CtorList &getGlobalCtors() { return GlobalCtors; }
739  CtorList &getGlobalDtors() { return GlobalDtors; }
740 
741  /// getTBAATypeInfo - Get metadata used to describe accesses to objects of
742  /// the given type.
743  llvm::MDNode *getTBAATypeInfo(QualType QTy);
744 
745  /// getTBAAAccessInfo - Get TBAA information that describes an access to
746  /// an object of the given type.
748 
749  /// getTBAAVTablePtrAccessInfo - Get the TBAA information that describes an
750  /// access to a virtual table pointer.
751  TBAAAccessInfo getTBAAVTablePtrAccessInfo(llvm::Type *VTablePtrType);
752 
753  llvm::MDNode *getTBAAStructInfo(QualType QTy);
754 
755  /// getTBAABaseTypeInfo - Get metadata that describes the given base access
756  /// type. Return null if the type is not suitable for use in TBAA access tags.
757  llvm::MDNode *getTBAABaseTypeInfo(QualType QTy);
758 
759  /// getTBAAAccessTagInfo - Get TBAA tag for a given memory access.
760  llvm::MDNode *getTBAAAccessTagInfo(TBAAAccessInfo Info);
761 
762  /// mergeTBAAInfoForCast - Get merged TBAA information for the purposes of
763  /// type casts.
766 
767  /// mergeTBAAInfoForConditionalOperator - Get merged TBAA information for the
768  /// purposes of conditional operator.
770  TBAAAccessInfo InfoB);
771 
772  /// mergeTBAAInfoForMemoryTransfer - Get merged TBAA information for the
773  /// purposes of memory transfer calls.
775  TBAAAccessInfo SrcInfo);
776 
777  /// getTBAAInfoForSubobject - Get TBAA information for an access with a given
778  /// base lvalue.
780  if (Base.getTBAAInfo().isMayAlias())
782  return getTBAAAccessInfo(AccessType);
783  }
784 
785  bool isTypeConstant(QualType QTy, bool ExcludeCtorDtor);
786 
788  bool isPaddedAtomicType(const AtomicType *type);
789 
790  /// DecorateInstructionWithTBAA - Decorate the instruction with a TBAA tag.
791  void DecorateInstructionWithTBAA(llvm::Instruction *Inst,
792  TBAAAccessInfo TBAAInfo);
793 
794  /// Adds !invariant.barrier !tag to instruction
795  void DecorateInstructionWithInvariantGroup(llvm::Instruction *I,
796  const CXXRecordDecl *RD);
797 
798  /// Emit the given number of characters as a value of type size_t.
799  llvm::ConstantInt *getSize(CharUnits numChars);
800 
801  /// Set the visibility for the given LLVM GlobalValue.
802  void setGlobalVisibility(llvm::GlobalValue *GV, const NamedDecl *D) const;
803 
804  void setDSOLocal(llvm::GlobalValue *GV) const;
805 
806  void setDLLImportDLLExport(llvm::GlobalValue *GV, GlobalDecl D) const;
807  void setDLLImportDLLExport(llvm::GlobalValue *GV, const NamedDecl *D) const;
808  /// Set visibility, dllimport/dllexport and dso_local.
809  /// This must be called after dllimport/dllexport is set.
810  void setGVProperties(llvm::GlobalValue *GV, GlobalDecl GD) const;
811  void setGVProperties(llvm::GlobalValue *GV, const NamedDecl *D) const;
812 
813  void setGVPropertiesAux(llvm::GlobalValue *GV, const NamedDecl *D) const;
814 
815  /// Set the TLS mode for the given LLVM GlobalValue for the thread-local
816  /// variable declaration D.
817  void setTLSMode(llvm::GlobalValue *GV, const VarDecl &D) const;
818 
819  /// Get LLVM TLS mode from CodeGenOptions.
820  llvm::GlobalVariable::ThreadLocalMode GetDefaultLLVMTLSModel() const;
821 
822  static llvm::GlobalValue::VisibilityTypes GetLLVMVisibility(Visibility V) {
823  switch (V) {
827  }
828  llvm_unreachable("unknown visibility!");
829  }
830 
831  llvm::Constant *GetAddrOfGlobal(GlobalDecl GD,
832  ForDefinition_t IsForDefinition
833  = NotForDefinition);
834 
835  /// Will return a global variable of the given type. If a variable with a
836  /// different type already exists then a new variable with the right type
837  /// will be created and all uses of the old variable will be replaced with a
838  /// bitcast to the new variable.
839  llvm::GlobalVariable *
840  CreateOrReplaceCXXRuntimeVariable(StringRef Name, llvm::Type *Ty,
841  llvm::GlobalValue::LinkageTypes Linkage,
842  unsigned Alignment);
843 
844  llvm::Function *CreateGlobalInitOrCleanUpFunction(
845  llvm::FunctionType *ty, const Twine &name, const CGFunctionInfo &FI,
846  SourceLocation Loc = SourceLocation(), bool TLS = false);
847 
848  /// Return the AST address space of the underlying global variable for D, as
849  /// determined by its declaration. Normally this is the same as the address
850  /// space of D's type, but in CUDA, address spaces are associated with
851  /// declarations, not types. If D is nullptr, return the default address
852  /// space for global variable.
853  ///
854  /// For languages without explicit address spaces, if D has default address
855  /// space, target-specific global or constant address space may be returned.
857 
858  /// Return the AST address space of constant literal, which is used to emit
859  /// the constant literal as global variable in LLVM IR.
860  /// Note: This is not necessarily the address space of the constant literal
861  /// in AST. For address space agnostic language, e.g. C++, constant literal
862  /// in AST is always in default address space.
864 
865  /// Return the llvm::Constant for the address of the given global variable.
866  /// If Ty is non-null and if the global doesn't exist, then it will be created
867  /// with the specified type instead of whatever the normal requested type
868  /// would be. If IsForDefinition is true, it is guaranteed that an actual
869  /// global with type Ty will be returned, not conversion of a variable with
870  /// the same mangled name but some other type.
871  llvm::Constant *GetAddrOfGlobalVar(const VarDecl *D,
872  llvm::Type *Ty = nullptr,
873  ForDefinition_t IsForDefinition
874  = NotForDefinition);
875 
876  /// Return the address of the given function. If Ty is non-null, then this
877  /// function will use the specified type if it has to create it.
878  llvm::Constant *GetAddrOfFunction(GlobalDecl GD, llvm::Type *Ty = nullptr,
879  bool ForVTable = false,
880  bool DontDefer = false,
881  ForDefinition_t IsForDefinition
882  = NotForDefinition);
883 
884  /// Get the address of the RTTI descriptor for the given type.
885  llvm::Constant *GetAddrOfRTTIDescriptor(QualType Ty, bool ForEH = false);
886 
887  /// Get the address of a GUID.
889 
890  /// Get the address of a template parameter object.
893 
894  /// Get the address of the thunk for the given global decl.
895  llvm::Constant *GetAddrOfThunk(StringRef Name, llvm::Type *FnTy,
896  GlobalDecl GD);
897 
898  /// Get a reference to the target of VD.
900 
901  /// Returns the assumed alignment of an opaque pointer to the given class.
903 
904  /// Returns the minimum object size for an object of the given class type
905  /// (or a class derived from it).
907 
908  /// Returns the minimum object size for an object of the given type.
910  if (CXXRecordDecl *RD = Ty->getAsCXXRecordDecl())
911  return getMinimumClassObjectSize(RD);
912  return getContext().getTypeSizeInChars(Ty);
913  }
914 
915  /// Returns the assumed alignment of a virtual base of a class.
917  const CXXRecordDecl *Derived,
918  const CXXRecordDecl *VBase);
919 
920  /// Given a class pointer with an actual known alignment, and the
921  /// expected alignment of an object at a dynamic offset w.r.t that
922  /// pointer, return the alignment to assume at the offset.
924  const CXXRecordDecl *Class,
925  CharUnits ExpectedTargetAlign);
926 
927  CharUnits
931 
932  /// Returns the offset from a derived class to a class. Returns null if the
933  /// offset is 0.
934  llvm::Constant *
938 
939  llvm::FoldingSet<BlockByrefHelpers> ByrefHelpersCache;
940 
941  /// Fetches the global unique block count.
942  int getUniqueBlockCount() { return ++Block.GlobalUniqueCount; }
943 
944  /// Fetches the type of a generic block descriptor.
945  llvm::Type *getBlockDescriptorType();
946 
947  /// The type of a generic block literal.
948  llvm::Type *getGenericBlockLiteralType();
949 
950  /// Gets the address of a block which requires no captures.
951  llvm::Constant *GetAddrOfGlobalBlock(const BlockExpr *BE, StringRef Name);
952 
953  /// Returns the address of a block which requires no caputres, or null if
954  /// we've yet to emit the block for BE.
955  llvm::Constant *getAddrOfGlobalBlockIfEmitted(const BlockExpr *BE) {
956  return EmittedGlobalBlocks.lookup(BE);
957  }
958 
959  /// Notes that BE's global block is available via Addr. Asserts that BE
960  /// isn't already emitted.
961  void setAddrOfGlobalBlock(const BlockExpr *BE, llvm::Constant *Addr);
962 
963  /// Return a pointer to a constant CFString object for the given string.
965 
966  /// Return a pointer to a constant NSString object for the given string. Or a
967  /// user defined String object as defined via
968  /// -fconstant-string-class=class_name option.
970 
971  /// Return a constant array for the given string.
972  llvm::Constant *GetConstantArrayFromStringLiteral(const StringLiteral *E);
973 
974  /// Return a pointer to a constant array for the given string literal.
977  StringRef Name = ".str");
978 
979  /// Return a pointer to a constant array for the given ObjCEncodeExpr node.
982 
983  /// Returns a pointer to a character array containing the literal and a
984  /// terminating '\0' character. The result has pointer to array type.
985  ///
986  /// \param GlobalName If provided, the name to use for the global (if one is
987  /// created).
990  const char *GlobalName = nullptr);
991 
992  /// Returns a pointer to a constant global variable for the given file-scope
993  /// compound literal expression.
995 
996  /// If it's been emitted already, returns the GlobalVariable corresponding to
997  /// a compound literal. Otherwise, returns null.
998  llvm::GlobalVariable *
1000 
1001  /// Notes that CLE's GlobalVariable is GV. Asserts that CLE isn't already
1002  /// emitted.
1004  llvm::GlobalVariable *GV);
1005 
1006  /// Returns a pointer to a global variable representing a temporary
1007  /// with static or thread storage duration.
1009  const Expr *Inner);
1010 
1011  /// Retrieve the record type that describes the state of an
1012  /// Objective-C fast enumeration loop (for..in).
1014 
1015  // Produce code for this constructor/destructor. This method doesn't try
1016  // to apply any ABI rules about which other constructors/destructors
1017  // are needed or if they are alias to each other.
1018  llvm::Function *codegenCXXStructor(GlobalDecl GD);
1019 
1020  /// Return the address of the constructor/destructor of the given type.
1021  llvm::Constant *
1022  getAddrOfCXXStructor(GlobalDecl GD, const CGFunctionInfo *FnInfo = nullptr,
1023  llvm::FunctionType *FnType = nullptr,
1024  bool DontDefer = false,
1025  ForDefinition_t IsForDefinition = NotForDefinition) {
1026  return cast<llvm::Constant>(getAddrAndTypeOfCXXStructor(GD, FnInfo, FnType,
1027  DontDefer,
1028  IsForDefinition)
1029  .getCallee());
1030  }
1031 
1032  llvm::FunctionCallee getAddrAndTypeOfCXXStructor(
1033  GlobalDecl GD, const CGFunctionInfo *FnInfo = nullptr,
1034  llvm::FunctionType *FnType = nullptr, bool DontDefer = false,
1035  ForDefinition_t IsForDefinition = NotForDefinition);
1036 
1037  /// Given a builtin id for a function like "__builtin_fabsf", return a
1038  /// Function* for "fabsf".
1039  llvm::Constant *getBuiltinLibFunction(const FunctionDecl *FD,
1040  unsigned BuiltinID);
1041 
1042  llvm::Function *getIntrinsic(unsigned IID, ArrayRef<llvm::Type*> Tys = None);
1043 
1044  /// Emit code for a single top level declaration.
1045  void EmitTopLevelDecl(Decl *D);
1046 
1047  /// Stored a deferred empty coverage mapping for an unused
1048  /// and thus uninstrumented top level declaration.
1050 
1051  /// Remove the deferred empty coverage mapping as this
1052  /// declaration is actually instrumented.
1053  void ClearUnusedCoverageMapping(const Decl *D);
1054 
1055  /// Emit all the deferred coverage mappings
1056  /// for the uninstrumented functions.
1058 
1059  /// Emit an alias for "main" if it has no arguments (needed for wasm).
1060  void EmitMainVoidAlias();
1061 
1062  /// Tell the consumer that this variable has been instantiated.
1064 
1065  /// If the declaration has internal linkage but is inside an
1066  /// extern "C" linkage specification, prepare to emit an alias for it
1067  /// to the expected name.
1068  template<typename SomeDecl>
1069  void MaybeHandleStaticInExternC(const SomeDecl *D, llvm::GlobalValue *GV);
1070 
1071  /// Add a global to a list to be added to the llvm.used metadata.
1072  void addUsedGlobal(llvm::GlobalValue *GV);
1073 
1074  /// Add a global to a list to be added to the llvm.compiler.used metadata.
1075  void addCompilerUsedGlobal(llvm::GlobalValue *GV);
1076 
1077  /// Add a global to a list to be added to the llvm.compiler.used metadata.
1078  void addUsedOrCompilerUsedGlobal(llvm::GlobalValue *GV);
1079 
1080  /// Add a destructor and object to add to the C++ global destructor function.
1081  void AddCXXDtorEntry(llvm::FunctionCallee DtorFn, llvm::Constant *Object) {
1082  CXXGlobalDtorsOrStermFinalizers.emplace_back(DtorFn.getFunctionType(),
1083  DtorFn.getCallee(), Object);
1084  }
1085 
1086  /// Add an sterm finalizer to the C++ global cleanup function.
1087  void AddCXXStermFinalizerEntry(llvm::FunctionCallee DtorFn) {
1088  CXXGlobalDtorsOrStermFinalizers.emplace_back(DtorFn.getFunctionType(),
1089  DtorFn.getCallee(), nullptr);
1090  }
1091 
1092  /// Add an sterm finalizer to its own llvm.global_dtors entry.
1093  void AddCXXStermFinalizerToGlobalDtor(llvm::Function *StermFinalizer,
1094  int Priority) {
1095  AddGlobalDtor(StermFinalizer, Priority);
1096  }
1097 
1098  void AddCXXPrioritizedStermFinalizerEntry(llvm::Function *StermFinalizer,
1099  int Priority) {
1101  PrioritizedCXXStermFinalizers.size());
1102  PrioritizedCXXStermFinalizers.push_back(
1103  std::make_pair(Key, StermFinalizer));
1104  }
1105 
1106  /// Create or return a runtime function declaration with the specified type
1107  /// and name. If \p AssumeConvergent is true, the call will have the
1108  /// convergent attribute added.
1109  llvm::FunctionCallee
1110  CreateRuntimeFunction(llvm::FunctionType *Ty, StringRef Name,
1111  llvm::AttributeList ExtraAttrs = llvm::AttributeList(),
1112  bool Local = false, bool AssumeConvergent = false);
1113 
1114  /// Create a new runtime global variable with the specified type and name.
1115  llvm::Constant *CreateRuntimeVariable(llvm::Type *Ty,
1116  StringRef Name);
1117 
1118  ///@name Custom Blocks Runtime Interfaces
1119  ///@{
1120 
1121  llvm::Constant *getNSConcreteGlobalBlock();
1122  llvm::Constant *getNSConcreteStackBlock();
1123  llvm::FunctionCallee getBlockObjectAssign();
1124  llvm::FunctionCallee getBlockObjectDispose();
1125 
1126  ///@}
1127 
1128  llvm::Function *getLLVMLifetimeStartFn();
1129  llvm::Function *getLLVMLifetimeEndFn();
1130 
1131  // Make sure that this type is translated.
1132  void UpdateCompletedType(const TagDecl *TD);
1133 
1134  llvm::Constant *getMemberPointerConstant(const UnaryOperator *e);
1135 
1136  /// Emit type info if type of an expression is a variably modified
1137  /// type. Also emit proper debug info for cast types.
1139  CodeGenFunction *CGF = nullptr);
1140 
1141  /// Return the result of value-initializing the given type, i.e. a null
1142  /// expression of the given type. This is usually, but not always, an LLVM
1143  /// null constant.
1144  llvm::Constant *EmitNullConstant(QualType T);
1145 
1146  /// Return a null constant appropriate for zero-initializing a base class with
1147  /// the given type. This is usually, but not always, an LLVM null constant.
1148  llvm::Constant *EmitNullConstantForBase(const CXXRecordDecl *Record);
1149 
1150  /// Emit a general error that something can't be done.
1151  void Error(SourceLocation loc, StringRef error);
1152 
1153  /// Print out an error that codegen doesn't support the specified stmt yet.
1154  void ErrorUnsupported(const Stmt *S, const char *Type);
1155 
1156  /// Print out an error that codegen doesn't support the specified decl yet.
1157  void ErrorUnsupported(const Decl *D, const char *Type);
1158 
1159  /// Set the attributes on the LLVM function for the given decl and function
1160  /// info. This applies attributes necessary for handling the ABI as well as
1161  /// user specified attributes like section.
1162  void SetInternalFunctionAttributes(GlobalDecl GD, llvm::Function *F,
1163  const CGFunctionInfo &FI);
1164 
1165  /// Set the LLVM function attributes (sext, zext, etc).
1167  llvm::Function *F, bool IsThunk);
1168 
1169  /// Set the LLVM function attributes which only apply to a function
1170  /// definition.
1171  void SetLLVMFunctionAttributesForDefinition(const Decl *D, llvm::Function *F);
1172 
1173  /// Set the LLVM function attributes that represent floating point
1174  /// environment.
1175  void setLLVMFunctionFEnvAttributes(const FunctionDecl *D, llvm::Function *F);
1176 
1177  /// Return true iff the given type uses 'sret' when used as a return type.
1178  bool ReturnTypeUsesSRet(const CGFunctionInfo &FI);
1179 
1180  /// Return true iff the given type uses an argument slot when 'sret' is used
1181  /// as a return type.
1183 
1184  /// Return true iff the given type uses 'fpret' when used as a return type.
1185  bool ReturnTypeUsesFPRet(QualType ResultType);
1186 
1187  /// Return true iff the given type uses 'fp2ret' when used as a return type.
1188  bool ReturnTypeUsesFP2Ret(QualType ResultType);
1189 
1190  /// Get the LLVM attributes and calling convention to use for a particular
1191  /// function type.
1192  ///
1193  /// \param Name - The function name.
1194  /// \param Info - The function type information.
1195  /// \param CalleeInfo - The callee information these attributes are being
1196  /// constructed for. If valid, the attributes applied to this decl may
1197  /// contribute to the function attributes and calling convention.
1198  /// \param Attrs [out] - On return, the attribute list to use.
1199  /// \param CallingConv [out] - On return, the LLVM calling convention to use.
1200  void ConstructAttributeList(StringRef Name, const CGFunctionInfo &Info,
1201  CGCalleeInfo CalleeInfo,
1202  llvm::AttributeList &Attrs, unsigned &CallingConv,
1203  bool AttrOnCallSite, bool IsThunk);
1204 
1205  /// Adds attributes to F according to our CodeGenOptions and LangOptions, as
1206  /// though we had emitted it ourselves. We remove any attributes on F that
1207  /// conflict with the attributes we add here.
1208  ///
1209  /// This is useful for adding attrs to bitcode modules that you want to link
1210  /// with but don't control, such as CUDA's libdevice. When linking with such
1211  /// a bitcode library, you might want to set e.g. its functions'
1212  /// "unsafe-fp-math" attribute to match the attr of the functions you're
1213  /// codegen'ing. Otherwise, LLVM will interpret the bitcode module's lack of
1214  /// unsafe-fp-math attrs as tantamount to unsafe-fp-math=false, and then LLVM
1215  /// will propagate unsafe-fp-math=false up to every transitive caller of a
1216  /// function in the bitcode library!
1217  ///
1218  /// With the exception of fast-math attrs, this will only make the attributes
1219  /// on the function more conservative. But it's unsafe to call this on a
1220  /// function which relies on particular fast-math attributes for correctness.
1221  /// It's up to you to ensure that this is safe.
1222  void addDefaultFunctionDefinitionAttributes(llvm::Function &F);
1223 
1224  /// Like the overload taking a `Function &`, but intended specifically
1225  /// for frontends that want to build on Clang's target-configuration logic.
1226  void addDefaultFunctionDefinitionAttributes(llvm::AttrBuilder &attrs);
1227 
1228  StringRef getMangledName(GlobalDecl GD);
1229  StringRef getBlockMangledName(GlobalDecl GD, const BlockDecl *BD);
1230 
1231  void EmitTentativeDefinition(const VarDecl *D);
1232 
1233  void EmitExternalDeclaration(const VarDecl *D);
1234 
1235  void EmitVTable(CXXRecordDecl *Class);
1236 
1237  void RefreshTypeCacheForClass(const CXXRecordDecl *Class);
1238 
1239  /// Appends Opts to the "llvm.linker.options" metadata value.
1240  void AppendLinkerOptions(StringRef Opts);
1241 
1242  /// Appends a detect mismatch command to the linker options.
1243  void AddDetectMismatch(StringRef Name, StringRef Value);
1244 
1245  /// Appends a dependent lib to the appropriate metadata value.
1246  void AddDependentLib(StringRef Lib);
1247 
1248 
1249  llvm::GlobalVariable::LinkageTypes getFunctionLinkage(GlobalDecl GD);
1250 
1251  void setFunctionLinkage(GlobalDecl GD, llvm::Function *F) {
1252  F->setLinkage(getFunctionLinkage(GD));
1253  }
1254 
1255  /// Return the appropriate linkage for the vtable, VTT, and type information
1256  /// of the given class.
1257  llvm::GlobalVariable::LinkageTypes getVTableLinkage(const CXXRecordDecl *RD);
1258 
1259  /// Return the store size, in character units, of the given LLVM type.
1260  CharUnits GetTargetTypeStoreSize(llvm::Type *Ty) const;
1261 
1262  /// Returns LLVM linkage for a declarator.
1263  llvm::GlobalValue::LinkageTypes
1265  bool IsConstantVariable);
1266 
1267  /// Returns LLVM linkage for a declarator.
1268  llvm::GlobalValue::LinkageTypes
1269  getLLVMLinkageVarDefinition(const VarDecl *VD, bool IsConstant);
1270 
1271  /// Emit all the global annotations.
1272  void EmitGlobalAnnotations();
1273 
1274  /// Emit an annotation string.
1275  llvm::Constant *EmitAnnotationString(StringRef Str);
1276 
1277  /// Emit the annotation's translation unit.
1278  llvm::Constant *EmitAnnotationUnit(SourceLocation Loc);
1279 
1280  /// Emit the annotation line number.
1281  llvm::Constant *EmitAnnotationLineNo(SourceLocation L);
1282 
1283  /// Emit additional args of the annotation.
1284  llvm::Constant *EmitAnnotationArgs(const AnnotateAttr *Attr);
1285 
1286  /// Generate the llvm::ConstantStruct which contains the annotation
1287  /// information for a given GlobalValue. The annotation struct is
1288  /// {i8 *, i8 *, i8 *, i32}. The first field is a constant expression, the
1289  /// GlobalValue being annotated. The second field is the constant string
1290  /// created from the AnnotateAttr's annotation. The third field is a constant
1291  /// string containing the name of the translation unit. The fourth field is
1292  /// the line number in the file of the annotated value declaration.
1293  llvm::Constant *EmitAnnotateAttr(llvm::GlobalValue *GV,
1294  const AnnotateAttr *AA,
1295  SourceLocation L);
1296 
1297  /// Add global annotations that are set on D, for the global GV. Those
1298  /// annotations are emitted during finalization of the LLVM code.
1299  void AddGlobalAnnotations(const ValueDecl *D, llvm::GlobalValue *GV);
1300 
1301  bool isInNoSanitizeList(SanitizerMask Kind, llvm::Function *Fn,
1302  SourceLocation Loc) const;
1303 
1304  bool isInNoSanitizeList(llvm::GlobalVariable *GV, SourceLocation Loc,
1305  QualType Ty, StringRef Category = StringRef()) const;
1306 
1307  /// Imbue XRay attributes to a function, applying the always/never attribute
1308  /// lists in the process. Returns true if we did imbue attributes this way,
1309  /// false otherwise.
1310  bool imbueXRayAttrs(llvm::Function *Fn, SourceLocation Loc,
1311  StringRef Category = StringRef()) const;
1312 
1313  /// Returns true if function at the given location should be excluded from
1314  /// profile instrumentation.
1315  bool isProfileInstrExcluded(llvm::Function *Fn, SourceLocation Loc) const;
1316 
1318  return SanitizerMD.get();
1319  }
1320 
1322  DeferredVTables.push_back(RD);
1323  }
1324 
1325  /// Emit code for a single global function or var decl. Forward declarations
1326  /// are emitted lazily.
1327  void EmitGlobal(GlobalDecl D);
1328 
1330 
1331  llvm::GlobalValue *GetGlobalValue(StringRef Ref);
1332 
1333  /// Set attributes which are common to any form of a global definition (alias,
1334  /// Objective-C method, function, global variable).
1335  ///
1336  /// NOTE: This should only be called for definitions.
1337  void SetCommonAttributes(GlobalDecl GD, llvm::GlobalValue *GV);
1338 
1339  void addReplacement(StringRef Name, llvm::Constant *C);
1340 
1341  void addGlobalValReplacement(llvm::GlobalValue *GV, llvm::Constant *C);
1342 
1343  /// Emit a code for threadprivate directive.
1344  /// \param D Threadprivate declaration.
1346 
1347  /// Emit a code for declare reduction construct.
1349  CodeGenFunction *CGF = nullptr);
1350 
1351  /// Emit a code for declare mapper construct.
1353  CodeGenFunction *CGF = nullptr);
1354 
1355  /// Emit a code for requires directive.
1356  /// \param D Requires declaration
1357  void EmitOMPRequiresDecl(const OMPRequiresDecl *D);
1358 
1359  /// Emit a code for the allocate directive.
1360  /// \param D The allocate declaration
1361  void EmitOMPAllocateDecl(const OMPAllocateDecl *D);
1362 
1363  /// Returns whether the given record has hidden LTO visibility and therefore
1364  /// may participate in (single-module) CFI and whole-program vtable
1365  /// optimization.
1366  bool HasHiddenLTOVisibility(const CXXRecordDecl *RD);
1367 
1368  /// Returns whether the given record has public std LTO visibility
1369  /// and therefore may not participate in (single-module) CFI and whole-program
1370  /// vtable optimization.
1371  bool HasLTOVisibilityPublicStd(const CXXRecordDecl *RD);
1372 
1373  /// Returns the vcall visibility of the given type. This is the scope in which
1374  /// a virtual function call could be made which ends up being dispatched to a
1375  /// member function of this class. This scope can be wider than the visibility
1376  /// of the class itself when the class has a more-visible dynamic base class.
1377  /// The client should pass in an empty Visited set, which is used to prevent
1378  /// redundant recursive processing.
1379  llvm::GlobalObject::VCallVisibility
1382 
1383  /// Emit type metadata for the given vtable using the given layout.
1384  void EmitVTableTypeMetadata(const CXXRecordDecl *RD,
1385  llvm::GlobalVariable *VTable,
1386  const VTableLayout &VTLayout);
1387 
1388  /// Generate a cross-DSO type identifier for MD.
1389  llvm::ConstantInt *CreateCrossDsoCfiTypeId(llvm::Metadata *MD);
1390 
1391  /// Create a metadata identifier for the given type. This may either be an
1392  /// MDString (for external identifiers) or a distinct unnamed MDNode (for
1393  /// internal identifiers).
1394  llvm::Metadata *CreateMetadataIdentifierForType(QualType T);
1395 
1396  /// Create a metadata identifier that is intended to be used to check virtual
1397  /// calls via a member function pointer.
1399 
1400  /// Create a metadata identifier for the generalization of the given type.
1401  /// This may either be an MDString (for external identifiers) or a distinct
1402  /// unnamed MDNode (for internal identifiers).
1403  llvm::Metadata *CreateMetadataIdentifierGeneralized(QualType T);
1404 
1405  /// Create and attach type metadata to the given function.
1407  llvm::Function *F);
1408 
1409  /// Whether this function's return type has no side effects, and thus may
1410  /// be trivially discarded if it is unused.
1411  bool MayDropFunctionReturn(const ASTContext &Context, QualType ReturnType);
1412 
1413  /// Returns whether this module needs the "all-vtables" type identifier.
1414  bool NeedAllVtablesTypeId() const;
1415 
1416  /// Create and attach type metadata for the given vtable.
1417  void AddVTableTypeMetadata(llvm::GlobalVariable *VTable, CharUnits Offset,
1418  const CXXRecordDecl *RD);
1419 
1420  /// Return a vector of most-base classes for RD. This is used to implement
1421  /// control flow integrity checks for member function pointers.
1422  ///
1423  /// A most-base class of a class C is defined as a recursive base class of C,
1424  /// including C itself, that does not have any bases.
1425  std::vector<const CXXRecordDecl *>
1426  getMostBaseClasses(const CXXRecordDecl *RD);
1427 
1428  /// Get the declaration of std::terminate for the platform.
1429  llvm::FunctionCallee getTerminateFn();
1430 
1431  llvm::SanitizerStatReport &getSanStats();
1432 
1433  llvm::Value *
1435 
1436  /// OpenCL v1.2 s5.6.4.6 allows the compiler to store kernel argument
1437  /// information in the program executable. The argument information stored
1438  /// includes the argument name, its type, the address and access qualifiers
1439  /// used. This helper can be used to generate metadata for source code kernel
1440  /// function as well as generated implicitly kernels. If a kernel is generated
1441  /// implicitly null value has to be passed to the last two parameters,
1442  /// otherwise all parameters must have valid non-null values.
1443  /// \param FN is a pointer to IR function being generated.
1444  /// \param FD is a pointer to function declaration if any.
1445  /// \param CGF is a pointer to CodeGenFunction that generates this function.
1446  void GenOpenCLArgMetadata(llvm::Function *FN,
1447  const FunctionDecl *FD = nullptr,
1448  CodeGenFunction *CGF = nullptr);
1449 
1450  /// Get target specific null pointer.
1451  /// \param T is the LLVM type of the null pointer.
1452  /// \param QT is the clang QualType of the null pointer.
1453  llvm::Constant *getNullPointer(llvm::PointerType *T, QualType QT);
1454 
1456  LValueBaseInfo *BaseInfo = nullptr,
1457  TBAAAccessInfo *TBAAInfo = nullptr,
1458  bool forPointeeType = false);
1460  LValueBaseInfo *BaseInfo = nullptr,
1461  TBAAAccessInfo *TBAAInfo = nullptr);
1462  bool stopAutoInit();
1463 
1464  /// Print the postfix for externalized static variable for single source
1465  /// offloading languages CUDA and HIP.
1466  void printPostfixForExternalizedStaticVar(llvm::raw_ostream &OS) const;
1467 
1468 private:
1469  llvm::Constant *GetOrCreateLLVMFunction(
1470  StringRef MangledName, llvm::Type *Ty, GlobalDecl D, bool ForVTable,
1471  bool DontDefer = false, bool IsThunk = false,
1472  llvm::AttributeList ExtraAttrs = llvm::AttributeList(),
1473  ForDefinition_t IsForDefinition = NotForDefinition);
1474 
1475  llvm::Constant *GetOrCreateMultiVersionResolver(GlobalDecl GD,
1476  llvm::Type *DeclTy,
1477  const FunctionDecl *FD);
1478  void UpdateMultiVersionNames(GlobalDecl GD, const FunctionDecl *FD);
1479 
1480  llvm::Constant *
1481  GetOrCreateLLVMGlobal(StringRef MangledName, llvm::Type *Ty, LangAS AddrSpace,
1482  const VarDecl *D,
1483  ForDefinition_t IsForDefinition = NotForDefinition);
1484 
1485  bool GetCPUAndFeaturesAttributes(GlobalDecl GD,
1486  llvm::AttrBuilder &AttrBuilder);
1487  void setNonAliasAttributes(GlobalDecl GD, llvm::GlobalObject *GO);
1488 
1489  /// Set function attributes for a function declaration.
1490  void SetFunctionAttributes(GlobalDecl GD, llvm::Function *F,
1491  bool IsIncompleteFunction, bool IsThunk);
1492 
1493  void EmitGlobalDefinition(GlobalDecl D, llvm::GlobalValue *GV = nullptr);
1494 
1495  void EmitGlobalFunctionDefinition(GlobalDecl GD, llvm::GlobalValue *GV);
1496  void EmitMultiVersionFunctionDefinition(GlobalDecl GD, llvm::GlobalValue *GV);
1497 
1498  void EmitGlobalVarDefinition(const VarDecl *D, bool IsTentative = false);
1499  void EmitExternalVarDeclaration(const VarDecl *D);
1500  void EmitAliasDefinition(GlobalDecl GD);
1501  void emitIFuncDefinition(GlobalDecl GD);
1502  void emitCPUDispatchDefinition(GlobalDecl GD);
1503  void EmitObjCPropertyImplementations(const ObjCImplementationDecl *D);
1504  void EmitObjCIvarInitializations(ObjCImplementationDecl *D);
1505 
1506  // C++ related functions.
1507 
1508  void EmitDeclContext(const DeclContext *DC);
1509  void EmitLinkageSpec(const LinkageSpecDecl *D);
1510 
1511  /// Emit the function that initializes C++ thread_local variables.
1512  void EmitCXXThreadLocalInitFunc();
1513 
1514  /// Emit the function that initializes C++ globals.
1515  void EmitCXXGlobalInitFunc();
1516 
1517  /// Emit the function that performs cleanup associated with C++ globals.
1518  void EmitCXXGlobalCleanUpFunc();
1519 
1520  /// Emit the function that initializes the specified global (if PerformInit is
1521  /// true) and registers its destructor.
1522  void EmitCXXGlobalVarDeclInitFunc(const VarDecl *D,
1523  llvm::GlobalVariable *Addr,
1524  bool PerformInit);
1525 
1526  void EmitPointerToInitFunc(const VarDecl *VD, llvm::GlobalVariable *Addr,
1527  llvm::Function *InitFunc, InitSegAttr *ISA);
1528 
1529  // FIXME: Hardcoding priority here is gross.
1530  void AddGlobalCtor(llvm::Function *Ctor, int Priority = 65535,
1531  llvm::Constant *AssociatedData = nullptr);
1532  void AddGlobalDtor(llvm::Function *Dtor, int Priority = 65535,
1533  bool IsDtorAttrFunc = false);
1534 
1535  /// EmitCtorList - Generates a global array of functions and priorities using
1536  /// the given list and name. This array will have appending linkage and is
1537  /// suitable for use as a LLVM constructor or destructor array. Clears Fns.
1538  void EmitCtorList(CtorList &Fns, const char *GlobalName);
1539 
1540  /// Emit any needed decls for which code generation was deferred.
1541  void EmitDeferred();
1542 
1543  /// Try to emit external vtables as available_externally if they have emitted
1544  /// all inlined virtual functions. It runs after EmitDeferred() and therefore
1545  /// is not allowed to create new references to things that need to be emitted
1546  /// lazily.
1547  void EmitVTablesOpportunistically();
1548 
1549  /// Call replaceAllUsesWith on all pairs in Replacements.
1550  void applyReplacements();
1551 
1552  /// Call replaceAllUsesWith on all pairs in GlobalValReplacements.
1553  void applyGlobalValReplacements();
1554 
1555  void checkAliases();
1556 
1557  std::map<int, llvm::TinyPtrVector<llvm::Function *>> DtorsUsingAtExit;
1558 
1559  /// Register functions annotated with __attribute__((destructor)) using
1560  /// __cxa_atexit, if it is available, or atexit otherwise.
1561  void registerGlobalDtorsWithAtExit();
1562 
1563  // When using sinit and sterm functions, unregister
1564  // __attribute__((destructor)) annotated functions which were previously
1565  // registered by the atexit subroutine using unatexit.
1566  void unregisterGlobalDtorsWithUnAtExit();
1567 
1568  void emitMultiVersionFunctions();
1569 
1570  /// Emit any vtables which we deferred and still have a use for.
1571  void EmitDeferredVTables();
1572 
1573  /// Emit a dummy function that reference a CoreFoundation symbol when
1574  /// @available is used on Darwin.
1575  void emitAtAvailableLinkGuard();
1576 
1577  /// Emit the llvm.used and llvm.compiler.used metadata.
1578  void emitLLVMUsed();
1579 
1580  /// Emit the link options introduced by imported modules.
1581  void EmitModuleLinkOptions();
1582 
1583  /// Emit aliases for internal-linkage declarations inside "C" language
1584  /// linkage specifications, giving them the "expected" name where possible.
1585  void EmitStaticExternCAliases();
1586 
1587  void EmitDeclMetadata();
1588 
1589  /// Emit the Clang version as llvm.ident metadata.
1590  void EmitVersionIdentMetadata();
1591 
1592  /// Emit the Clang commandline as llvm.commandline metadata.
1593  void EmitCommandLineMetadata();
1594 
1595  /// Emit the module flag metadata used to pass options controlling the
1596  /// the backend to LLVM.
1597  void EmitBackendOptionsMetadata(const CodeGenOptions CodeGenOpts);
1598 
1599  /// Emits OpenCL specific Metadata e.g. OpenCL version.
1600  void EmitOpenCLMetadata();
1601 
1602  /// Emit the llvm.gcov metadata used to tell LLVM where to emit the .gcno and
1603  /// .gcda files in a way that persists in .bc files.
1604  void EmitCoverageFile();
1605 
1606  /// Determine whether the definition must be emitted; if this returns \c
1607  /// false, the definition can be emitted lazily if it's used.
1608  bool MustBeEmitted(const ValueDecl *D);
1609 
1610  /// Determine whether the definition can be emitted eagerly, or should be
1611  /// delayed until the end of the translation unit. This is relevant for
1612  /// definitions whose linkage can change, e.g. implicit function instantions
1613  /// which may later be explicitly instantiated.
1614  bool MayBeEmittedEagerly(const ValueDecl *D);
1615 
1616  /// Check whether we can use a "simpler", more core exceptions personality
1617  /// function.
1618  void SimplifyPersonality();
1619 
1620  /// Helper function for ConstructAttributeList and
1621  /// addDefaultFunctionDefinitionAttributes. Builds a set of function
1622  /// attributes to add to a function with the given properties.
1623  void getDefaultFunctionAttributes(StringRef Name, bool HasOptnone,
1624  bool AttrOnCallSite,
1625  llvm::AttrBuilder &FuncAttrs);
1626 
1627  llvm::Metadata *CreateMetadataIdentifierImpl(QualType T, MetadataTypeMap &Map,
1628  StringRef Suffix);
1629 };
1630 
1631 } // end namespace CodeGen
1632 } // end namespace clang
1633 
1634 #endif // LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H
clang::CodeGen::CodeGenModule::isTypeConstant
bool isTypeConstant(QualType QTy, bool ExcludeCtorDtor)
isTypeConstant - Determine whether an object of this type can be emitted as a constant.
Definition: CodeGenModule.cpp:3822
clang::CodeGen::ObjCEntrypoints::objc_autoreleasePoolPop
llvm::FunctionCallee objc_autoreleasePoolPop
void objc_autoreleasePoolPop(void*);
Definition: CodeGenModule.h:135
CodeGenTypeCache.h
clang::CodeGen::BlockByrefHelpers::~BlockByrefHelpers
virtual ~BlockByrefHelpers()
Definition: CGBlocks.cpp:48
clang::ASTContext::getTypeSizeInChars
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
Definition: ASTContext.cpp:2452
clang::CodeGen::CodeGenModule::createOpenCLIntToSamplerConversion
llvm::Value * createOpenCLIntToSamplerConversion(const Expr *E, CodeGenFunction &CGF)
Definition: CodeGenModule.cpp:6359
clang::OMPAllocateDecl
This represents '#pragma omp allocate ...' directive.
Definition: DeclOpenMP.h:473
clang::CodeGen::CodeGenModule::addUsedOrCompilerUsedGlobal
void addUsedOrCompilerUsedGlobal(llvm::GlobalValue *GV)
Add a global to a list to be added to the llvm.compiler.used metadata.
Definition: CodeGenModule.cpp:2208
clang::CodeGen::CodeGenModule::MaybeHandleStaticInExternC
void MaybeHandleStaticInExternC(const SomeDecl *D, llvm::GlobalValue *GV)
If the declaration has internal linkage but is inside an extern "C" linkage specification,...
Definition: CodeGenModule.cpp:4243
clang::CodeGen::ObjCEntrypoints::objc_allocWithZone
llvm::FunctionCallee objc_allocWithZone
void objc_allocWithZone(id);
Definition: CodeGenModule.h:129
clang::CodeGen::CodeGenModule::CreateGlobalInitOrCleanUpFunction
llvm::Function * CreateGlobalInitOrCleanUpFunction(llvm::FunctionType *ty, const Twine &name, const CGFunctionInfo &FI, SourceLocation Loc=SourceLocation(), bool TLS=false)
Definition: CGDeclCXX.cpp:423
clang::CodeGen::CodeGenModule::getStaticLocalDeclGuardAddress
llvm::GlobalVariable * getStaticLocalDeclGuardAddress(const VarDecl *D)
Definition: CodeGenModule.h:657
clang::CodeGen::LValueBaseInfo
Definition: CGValue.h:150
clang::HiddenVisibility
@ HiddenVisibility
Objects with "hidden" visibility are not seen by the dynamic linker.
Definition: Visibility.h:36
clang::CodeGen::CodeGenModule::GetAddrOfGlobalVar
llvm::Constant * GetAddrOfGlobalVar(const VarDecl *D, llvm::Type *Ty=nullptr, ForDefinition_t IsForDefinition=NotForDefinition)
Return the llvm::Constant for the address of the given global variable.
Definition: CodeGenModule.cpp:4114
llvm
Definition: Dominators.h:30
clang::CodeGen::CodeGenModule::Structor::Priority
int Priority
Definition: CodeGenModule.h:295
clang::CodeGen::ConstantAddress
A specialization of Address that requires the address to be an LLVM Constant.
Definition: Address.h:74
clang::CodeGen::CodeGenModule::addDeferredVTable
void addDeferredVTable(const CXXRecordDecl *RD)
Definition: CodeGenModule.h:1321
clang::CodeGen::CGCUDARuntime
Definition: CGCUDARuntime.h:41
clang::CodeGen::CodeGenModule::lookupRepresentativeDecl
bool lookupRepresentativeDecl(StringRef MangledName, GlobalDecl &Result) const
Definition: CodeGenModule.cpp:6119
clang::CodeGen::ObjCEntrypoints::objc_retainAutoreleasedReturnValue
llvm::Function * objc_retainAutoreleasedReturnValue
id objc_retainAutoreleasedReturnValue(id);
Definition: CodeGenModule.h:186
clang::CodeGen::CodeGenModule::EmitNullConstant
llvm::Constant * EmitNullConstant(QualType T)
Return the result of value-initializing the given type, i.e.
Definition: CGExprConstant.cpp:2306
clang::CodeGen::CodeGenModule::CreateRuntimeFunction
llvm::FunctionCallee CreateRuntimeFunction(llvm::FunctionType *Ty, StringRef Name, llvm::AttributeList ExtraAttrs=llvm::AttributeList(), bool Local=false, bool AssumeConvergent=false)
Create or return a runtime function declaration with the specified type and name.
Definition: CodeGenModule.cpp:3779
clang::CodeGen::OrderGlobalInitsOrStermFinalizers
Definition: CodeGenModule.h:106
clang::CodeGen::CodeGenModule::setAddrOfGlobalBlock
void setAddrOfGlobalBlock(const BlockExpr *BE, llvm::Constant *Addr)
Notes that BE's global block is available via Addr.
Definition: CGBlocks.cpp:1279
type
clang::CodeGen::CGOpenMPRuntime
Definition: CGOpenMPRuntime.h:225
clang::CodeGen::CodeGenModule::ClearUnusedCoverageMapping
void ClearUnusedCoverageMapping(const Decl *D)
Remove the deferred empty coverage mapping as this declaration is actually instrumented.
Definition: CodeGenModule.cpp:6014
clang::CodeGen::BlockByrefHelpers::BlockByrefHelpers
BlockByrefHelpers(CharUnits alignment)
Definition: CodeGenModule.h:264
clang::CodeGen::CodeGenModule::getItaniumVTableContext
ItaniumVTableContext & getItaniumVTableContext()
Definition: CodeGenModule.h:730
clang::LinkageSpecDecl
Represents a linkage specification.
Definition: DeclCXX.h:2797
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::CodeGen::CodeGenModule::CreateMetadataIdentifierGeneralized
llvm::Metadata * CreateMetadataIdentifierGeneralized(QualType T)
Create a metadata identifier for the generalization of the given type.
Definition: CodeGenModule.cpp:6314
clang::PreprocessorOptions
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
Definition: PreprocessorOptions.h:64
clang::DeclContext
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1347
clang::CodeGen::InstrProfStats::hasDiagnostics
bool hasDiagnostics()
Whether or not the stats we've gathered indicate any potential problems.
Definition: CodeGenModule.h:246
clang::CodeGen::ForDefinition_t
ForDefinition_t
Definition: CodeGenModule.h:101
clang::ObjCImplementationDecl
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2536
clang::CodeGen::CodeGenModule::addUsedGlobal
void addUsedGlobal(llvm::GlobalValue *GV)
Add a global to a list to be added to the llvm.used metadata.
Definition: CodeGenModule.cpp:2196
clang::CodeGen::CodeGenModule::getOpenCLRuntime
CGOpenCLRuntime & getOpenCLRuntime()
Return a reference to the configured OpenCL runtime.
Definition: CodeGenModule.h:610
clang::CodeGen::InstrProfStats
This class records statistics on instrumentation based profiling.
Definition: CodeGenModule.h:219
clang::CodeGen::ObjCEntrypoints::clang_arc_noop_use
llvm::Function * clang_arc_noop_use
void clang.arc.noop.use(...);
Definition: CodeGenModule.h:215
clang::CodeGen::CodeGenModule::codegenCXXStructor
llvm::Function * codegenCXXStructor(GlobalDecl GD)
Definition: CGCXX.cpp:207
clang::CodeGen::CodeGenModule::getDynamicOffsetAlignment
CharUnits getDynamicOffsetAlignment(CharUnits ActualAlign, const CXXRecordDecl *Class, CharUnits ExpectedTargetAlign)
Given a class pointer with an actual known alignment, and the expected alignment of an object at a dy...
Definition: CGClass.cpp:89
clang::CodeGen::CodeGenModule::GetAddrOfFunction
llvm::Constant * GetAddrOfFunction(GlobalDecl GD, llvm::Type *Ty=nullptr, bool ForVTable=false, bool DontDefer=false, ForDefinition_t IsForDefinition=NotForDefinition)
Return the address of the given function.
Definition: CodeGenModule.cpp:3699
clang::CodeGen::CodeGenModule::getTBAAAccessTagInfo
llvm::MDNode * getTBAAAccessTagInfo(TBAAAccessInfo Info)
getTBAAAccessTagInfo - Get TBAA tag for a given memory access.
Definition: CodeGenModule.cpp:911
clang::CodeGen::ObjCEntrypoints::objc_retainAutoreleaseReturnValue
llvm::Function * objc_retainAutoreleaseReturnValue
id objc_retainAutoreleaseReturnValue(id);
Definition: CodeGenModule.h:183
clang::CodeGen::CodeGenModule::setAtomicSetterHelperFnMap
void setAtomicSetterHelperFnMap(QualType Ty, llvm::Constant *Fn)
Definition: CodeGenModule.h:674
llvm::SmallVector
Definition: LLVM.h:38
clang::CodeGen::CodeGenModule::Structor::Structor
Structor(int Priority, llvm::Constant *Initializer, llvm::Constant *AssociatedData)
Definition: CodeGenModule.h:291
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:88
clang::CodeGen::TargetCodeGenInfo
TargetCodeGenInfo - This class organizes various target-specific codegeneration issues,...
Definition: TargetInfo.h:46
clang::CodeGen::CodeGenModule::mergeTBAAInfoForCast
TBAAAccessInfo mergeTBAAInfoForCast(TBAAAccessInfo SourceInfo, TBAAAccessInfo TargetInfo)
mergeTBAAInfoForCast - Get merged TBAA information for the purposes of type casts.
Definition: CodeGenModule.cpp:917
clang::OMPThreadPrivateDecl
This represents '#pragma omp threadprivate ...' directive.
Definition: DeclOpenMP.h:110
clang::CodeGen::CodeGenModule::SetInternalFunctionAttributes
void SetInternalFunctionAttributes(GlobalDecl GD, llvm::Function *F, const CGFunctionInfo &FI)
Set the attributes on the LLVM function for the given decl and function info.
Definition: CodeGenModule.cpp:2053
clang::CodeGen::CodeGenModule::HasHiddenLTOVisibility
bool HasHiddenLTOVisibility(const CXXRecordDecl *RD)
Returns whether the given record has hidden LTO visibility and therefore may participate in (single-m...
Definition: CGVTables.cpp:1196
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:249
clang::CodeGen::CodeGenModule::getGlobalDtors
CtorList & getGlobalDtors()
Definition: CodeGenModule.h:739
TargetInfo.h
clang::MultiVersionKind::Target
@ Target
clang::CodeGen::CodeGenModule::getSize
llvm::ConstantInt * getSize(CharUnits numChars)
Emit the given number of characters as a value of type size_t.
Definition: CodeGenModule.cpp:976
clang::CodeGen::ObjCEntrypoints::objc_autoreleaseReturnValue
llvm::Function * objc_autoreleaseReturnValue
id objc_autoreleaseReturnValue(id);
Definition: CodeGenModule.h:152
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:673
clang::CodeGen::CodeGenModule::setAtomicGetterHelperFnMap
void setAtomicGetterHelperFnMap(QualType Ty, llvm::Constant *Fn)
Definition: CodeGenModule.h:682
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:702
clang::DiagnosticsEngine
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:191
clang::CodeGen::BlockByrefHelpers::DisposeHelper
llvm::Constant * DisposeHelper
Definition: CodeGenModule.h:257
clang::CodeGen::CodeGenModule::getLLVMLinkageForDeclarator
llvm::GlobalValue::LinkageTypes getLLVMLinkageForDeclarator(const DeclaratorDecl *D, GVALinkage Linkage, bool IsConstantVariable)
Returns LLVM linkage for a declarator.
Definition: CodeGenModule.cpp:4632
clang::CodeGen::CodeGenModule::AddCXXStermFinalizerToGlobalDtor
void AddCXXStermFinalizerToGlobalDtor(llvm::Function *StermFinalizer, int Priority)
Add an sterm finalizer to its own llvm.global_dtors entry.
Definition: CodeGenModule.h:1093
clang::TargetInfo
Exposes information about the current target.
Definition: TargetInfo.h:189
DeclCXX.h
clang::CodeGen::CodeGenModule::Release
void Release()
Finalize LLVM code generation.
Definition: CodeGenModule.cpp:478
Module.h
clang::CodeGen::CodeGenModule::getMinimumClassObjectSize
CharUnits getMinimumClassObjectSize(const CXXRecordDecl *CD)
Returns the minimum object size for an object of the given class type (or a class derived from it).
Definition: CGClass.cpp:57
clang::CodeGen::CodeGenModule::getTBAAInfoForSubobject
TBAAAccessInfo getTBAAInfoForSubobject(LValue Base, QualType AccessType)
getTBAAInfoForSubobject - Get TBAA information for an access with a given base lvalue.
Definition: CodeGenModule.h:779
DeclOpenMP.h
clang::CodeGen::OrderGlobalInitsOrStermFinalizers::operator<
bool operator<(const OrderGlobalInitsOrStermFinalizers &RHS) const
Definition: CodeGenModule.h:116
clang::CodeGen::OrderGlobalInitsOrStermFinalizers::OrderGlobalInitsOrStermFinalizers
OrderGlobalInitsOrStermFinalizers(unsigned int p, unsigned int l)
Definition: CodeGenModule.h:109
clang::CodeGen::CodeGenModule::GetGlobalVarAddressSpace
LangAS GetGlobalVarAddressSpace(const VarDecl *D)
Return the AST address space of the underlying global variable for D, as determined by its declaratio...
Definition: CodeGenModule.cpp:4171
clang::CodeGen::CodeGenModule::AddCXXStermFinalizerEntry
void AddCXXStermFinalizerEntry(llvm::FunctionCallee DtorFn)
Add an sterm finalizer to the C++ global cleanup function.
Definition: CodeGenModule.h:1087
clang::CodeGen::CodeGenModule::getGenericBlockLiteralType
llvm::Type * getGenericBlockLiteralType()
The type of a generic block literal.
Definition: CGBlocks.cpp:1141
clang::CodeGen::CodeGenModule::ReturnTypeUsesFPRet
bool ReturnTypeUsesFPRet(QualType ResultType)
Return true iff the given type uses 'fpret' when used as a return type.
Definition: CGCall.cpp:1561
clang::CodeGen::BlockByrefHelpers::emitCopy
virtual void emitCopy(CodeGenFunction &CGF, Address dest, Address src)=0
llvm::SmallPtrSet< llvm::GlobalValue *, 10 >
clang::UnaryOperator
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Definition: Expr.h:2157
clang::CodeGen::CodeGenModule::SetLLVMFunctionAttributes
void SetLLVMFunctionAttributes(GlobalDecl GD, const CGFunctionInfo &Info, llvm::Function *F, bool IsThunk)
Set the LLVM function attributes (sext, zext, etc).
Definition: CodeGenModule.cpp:1512
clang::CodeGen::CodeGenModule::getLangOpts
const LangOptions & getLangOpts() const
Definition: CodeGenModule.h:703
clang::CodeGen::CodeGenModule::getAtomicGetterHelperFnMap
llvm::Constant * getAtomicGetterHelperFnMap(QualType Ty)
Definition: CodeGenModule.h:679
clang::CodeGen::CodeGenModule::EmitMainVoidAlias
void EmitMainVoidAlias()
Emit an alias for "main" if it has no arguments (needed for wasm).
Definition: CodeGenModule.cpp:6069
clang::CodeGen::CodeGenModule::getTargetCodeGenInfo
const TargetCodeGenInfo & getTargetCodeGenInfo()
Definition: TargetInfo.cpp:11080
clang::CodeGen::CodeGenModule::ReturnSlotInterferesWithArgs
bool ReturnSlotInterferesWithArgs(const CGFunctionInfo &FI)
Return true iff the given type uses an argument slot when 'sret' is used as a return type.
Definition: CGCall.cpp:1556
clang::CoverageSourceInfo
Stores additional source code information like skipped ranges which is required by the coverage mappi...
Definition: CoverageMappingGen.h:48
clang::CodeGen::ObjCEntrypoints::objc_autoreleasePoolPush
llvm::Function * objc_autoreleasePoolPush
void *objc_autoreleasePoolPush(void);
Definition: CodeGenModule.h:142
clang::CodeGen::CodeGenModule::computeNonVirtualBaseClassOffset
CharUnits computeNonVirtualBaseClassOffset(const CXXRecordDecl *DerivedClass, CastExpr::path_const_iterator Start, CastExpr::path_const_iterator End)
Definition: CGClass.cpp:168
End
SourceLocation End
Definition: USRLocFinder.cpp:167
clang::CodeGen::CodeGenModule::printPostfixForExternalizedStaticVar
void printPostfixForExternalizedStaticVar(llvm::raw_ostream &OS) const
Print the postfix for externalized static variable for single source offloading languages CUDA and HI...
Definition: CodeGenModule.cpp:6466
clang::CodeGen::InstrProfStats::addMismatched
void addMismatched(bool MainFile)
Record that a function we've visited has mismatched profile data.
Definition: CodeGenModule.h:244
clang::ProtectedVisibility
@ ProtectedVisibility
Objects with "protected" visibility are seen by the dynamic linker but always dynamically resolve to ...
Definition: Visibility.h:41
clang::CodeGen::CodeGenModule::EmitAnnotationUnit
llvm::Constant * EmitAnnotationUnit(SourceLocation Loc)
Emit the annotation's translation unit.
Definition: CodeGenModule.cpp:2518
clang::CodeGen::CodeGenModule::getPGOReader
llvm::IndexedInstrProfReader * getPGOReader() const
Definition: CodeGenModule.h:639
clang::CodeGen::CodeGenModule::getMangledName
StringRef getMangledName(GlobalDecl GD)
Definition: CodeGenModule.cpp:1346
clang::CodeGen::CodeGenModule::ConstructAttributeList
void ConstructAttributeList(StringRef Name, const CGFunctionInfo &Info, CGCalleeInfo CalleeInfo, llvm::AttributeList &Attrs, unsigned &CallingConv, bool AttrOnCallSite, bool IsThunk)
Get the LLVM attributes and calling convention to use for a particular function type.
Definition: CGCall.cpp:2000
clang::CodeGen::CodeGenModule::EmitGlobal
void EmitGlobal(GlobalDecl D)
Emit code for a single global function or var decl.
Definition: CodeGenModule.cpp:2871
clang::CodeGen::CodeGenModule::setDLLImportDLLExport
void setDLLImportDLLExport(llvm::GlobalValue *GV, GlobalDecl D) const
Definition: CodeGenModule.cpp:1104
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1490
clang::CodeGen::CodeGenModule::setGlobalVisibility
void setGlobalVisibility(llvm::GlobalValue *GV, const NamedDecl *D) const
Set the visibility for the given LLVM GlobalValue.
Definition: CodeGenModule.cpp:980
clang::CodeGen::BlockByrefHelpers::needsDispose
virtual bool needsDispose() const
Definition: CodeGenModule.h:278
DeclObjC.h
Offset
unsigned Offset
Definition: Format.cpp:2335
clang::CodeGen::CodeGenModule::getOpenMPRuntime
CGOpenMPRuntime & getOpenMPRuntime()
Return a reference to the configured OpenMP runtime.
Definition: CodeGenModule.h:616
ABI.h
clang::CodeGen::CodeGenModule::GlobalUniqueCount
int GlobalUniqueCount
Definition: CodeGenModule.h:554
clang::CodeGen::CodeGenModule::GetGlobalValue
llvm::GlobalValue * GetGlobalValue(StringRef Ref)
Definition: CodeGenModule.cpp:1420
clang::GlobalDecl
GlobalDecl - represents a global declaration.
Definition: GlobalDecl.h:55
clang::CodeGen::CodeGenModule::setAddrOfConstantCompoundLiteral
void setAddrOfConstantCompoundLiteral(const CompoundLiteralExpr *CLE, llvm::GlobalVariable *GV)
Notes that CLE's GlobalVariable is GV.
Definition: CGExprConstant.cpp:2170
clang::CodeGen::CodeGenModule::GetGlobalConstantAddressSpace
LangAS GetGlobalConstantAddressSpace() const
Return the AST address space of constant literal, which is used to emit the constant literal as globa...
Definition: CodeGenModule.cpp:4208
clang::CodeGen::CodeGenModule::EmitTopLevelDecl
void EmitTopLevelDecl(Decl *D)
Emit code for a single top level declaration.
Definition: CodeGenModule.cpp:5701
clang::CodeGen::ObjCEntrypoints::clang_arc_use
llvm::Function * clang_arc_use
void clang.arc.use(...);
Definition: CodeGenModule.h:212
clang::CodeGen::AlignmentSource::Decl
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
clang::CodeGen::CodeGenModule::stopAutoInit
bool stopAutoInit()
Definition: CodeGenModule.cpp:6441
clang::CodeGen::CodeGenModule::getOrCreateStaticVarDecl
llvm::Constant * getOrCreateStaticVarDecl(const VarDecl &D, llvm::GlobalValue::LinkageTypes Linkage)
Definition: CGDecl.cpp:239
clang::CodeGen::ObjCEntrypoints::objc_copyWeak
llvm::Function * objc_copyWeak
void objc_copyWeak(id *dest, id *src);
Definition: CodeGenModule.h:155
clang::CodeGen::CodeGenModule::isProfileInstrExcluded
bool isProfileInstrExcluded(llvm::Function *Fn, SourceLocation Loc) const
Returns true if function at the given location should be excluded from profile instrumentation.
Definition: CodeGenModule.cpp:2680
clang::CodeGen::CodeGenModule::MayDropFunctionReturn
bool MayDropFunctionReturn(const ASTContext &Context, QualType ReturnType)
Whether this function's return type has no side effects, and thus may be trivially discarded if it is...
Definition: CGCall.cpp:1750
clang::CodeGen::InstrProfStats::addMissing
void addMissing(bool MainFile)
Record that a function we've visited has no profile data.
Definition: CodeGenModule.h:238
V
#define V(N, I)
Definition: ASTContext.h:3113
clang::CodeGen::CodeGenModule::GetAddrOfConstantCFString
ConstantAddress GetAddrOfConstantCFString(const StringLiteral *Literal)
Return a pointer to a constant CFString object for the given string.
Definition: CodeGenModule.cpp:5075
clang::CodeGen::CodeGenModule::AddDependentLib
void AddDependentLib(StringRef Lib)
Appends a dependent lib to the appropriate metadata value.
Definition: CodeGenModule.cpp:2262
clang::CodeGen::CodeGenTypeCache
This structure provides a set of types that are commonly used during IR emission.
Definition: CodeGenTypeCache.h:32
clang::CodeGen::CodeGenModule::EmitOMPDeclareMapper
void EmitOMPDeclareMapper(const OMPDeclareMapperDecl *D, CodeGenFunction *CGF=nullptr)
Emit a code for declare mapper construct.
Definition: CGDecl.cpp:2612
clang::CodeGen::CodeGenModule::SetLLVMFunctionAttributesForDefinition
void SetLLVMFunctionAttributesForDefinition(const Decl *D, llvm::Function *F)
Set the LLVM function attributes which only apply to a function definition.
Definition: CodeGenModule.cpp:1756
clang::CodeGen::TBAAAccessInfo
Definition: CodeGenTBAA.h:42
clang::CodeGen::CodeGenModule::GenOpenCLArgMetadata
void GenOpenCLArgMetadata(llvm::Function *FN, const FunctionDecl *FD=nullptr, CodeGenFunction *CGF=nullptr)
OpenCL v1.2 s5.6.4.6 allows the compiler to store kernel argument information in the program executab...
Definition: CodeGenModule.cpp:1568
clang::CodeGen::ObjCEntrypoints::retainAutoreleasedReturnValueMarker
llvm::InlineAsm * retainAutoreleasedReturnValueMarker
A void(void) inline asm to use to mark that the return value of a call will be immediately retain.
Definition: CodeGenModule.h:209
clang::CodeGen::CodeGenModule::CreateMetadataIdentifierForType
llvm::Metadata * CreateMetadataIdentifierForType(QualType T)
Create a metadata identifier for the given type.
Definition: CodeGenModule.cpp:6273
clang::CodeGen::CodeGenModule::getAddrOfGlobalBlockIfEmitted
llvm::Constant * getAddrOfGlobalBlockIfEmitted(const BlockExpr *BE)
Returns the address of a block which requires no caputres, or null if we've yet to emit the block for...
Definition: CodeGenModule.h:955
clang::CodeGen::SanitizerMetadata
Definition: SanitizerMetadata.h:32
clang::CodeGen::CoverageMappingModuleGen
Organizes the cross-function state that is used while generating code coverage mapping data.
Definition: CoverageMappingGen.h:82
clang::OMPDeclareReductionDecl
This represents '#pragma omp declare reduction ...' directive.
Definition: DeclOpenMP.h:171
clang::CodeGen::CodeGenModule::getVBaseAlignment
CharUnits getVBaseAlignment(CharUnits DerivedAlign, const CXXRecordDecl *Derived, const CXXRecordDecl *VBase)
Returns the assumed alignment of a virtual base of a class.
Definition: CGClass.cpp:74
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::ObjCEntrypoints::objc_release
llvm::Function * objc_release
void objc_release(id);
Definition: CodeGenModule.h:192
clang::CodeGen::CodeGenModule::getObjCRuntime
CGObjCRuntime & getObjCRuntime()
Return a reference to the configured Objective-C runtime.
Definition: CodeGenModule.h:599
clang::BlockDecl
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4153
clang::CodeGen::CodeGenModule::getClassPointerAlignment
CharUnits getClassPointerAlignment(const CXXRecordDecl *CD)
Returns the assumed alignment of an opaque pointer to the given class.
Definition: CGClass.cpp:38
clang::CodeGen::CodeGenModule::getSanStats
llvm::SanitizerStatReport & getSanStats()
Definition: CodeGenModule.cpp:6351
clang::CodeGen::BlockByrefHelpers
A pair of helper functions for a __block variable.
Definition: CodeGenModule.h:252
clang::CodeGen::CodeGenModule::isPaddedAtomicType
bool isPaddedAtomicType(QualType type)
Definition: CodeGenTypes.cpp:802
clang::CodeGen::CodeGenModule::getNaturalPointeeTypeAlignment
CharUnits getNaturalPointeeTypeAlignment(QualType T, LValueBaseInfo *BaseInfo=nullptr, TBAAAccessInfo *TBAAInfo=nullptr)
Definition: CodeGenModule.cpp:6369
clang::CodeGen::CodeGenModule::setTypeDescriptorInMap
void setTypeDescriptorInMap(QualType Ty, llvm::Constant *C)
Definition: CodeGenModule.h:690
clang::CodeGen::CodeGenModule::ReturnTypeUsesSRet
bool ReturnTypeUsesSRet(const CGFunctionInfo &FI)
Return true iff the given type uses 'sret' when used as a return type.
Definition: CGCall.cpp:1551
clang::CodeGen::CodeGenModule::getCodeGenOpts
const CodeGenOptions & getCodeGenOpts() const
Definition: CodeGenModule.h:708
clang::CodeGen::CodeGenModule::createUnnamedGlobalFrom
Address createUnnamedGlobalFrom(const VarDecl &D, llvm::Constant *Constant, CharUnits Align)
Definition: CGDecl.cpp:1102
clang::MaterializeTemporaryExpr
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Definition: ExprCXX.h:4462
clang::CodeGen::CodeGenModule::getMinimumObjectSize
CharUnits getMinimumObjectSize(QualType Ty)
Returns the minimum object size for an object of the given type.
Definition: CodeGenModule.h:909
clang::index::SymbolKind::Module
@ Module
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:211
clang::CodeGen::CodeGenModule::EmitAnnotationArgs
llvm::Constant * EmitAnnotationArgs(const AnnotateAttr *Attr)
Emit additional args of the annotation.
Definition: CodeGenModule.cpp:2534
clang::CodeGen::CodeGenModule::maybeSetTrivialComdat
void maybeSetTrivialComdat(const Decl &D, llvm::GlobalObject &GO)
Definition: CodeGenModule.cpp:4305
LangOptions.h
clang::CodeGen::InstrProfStats::addVisited
void addVisited(bool MainFile)
Record that we've visited a function and whether or not that function was in the main source file.
Definition: CodeGenModule.h:232
clang::CodeGen::CodeGenModule::getTBAABaseTypeInfo
llvm::MDNode * getTBAABaseTypeInfo(QualType QTy)
getTBAABaseTypeInfo - Get metadata that describes the given base access type.
Definition: CodeGenModule.cpp:905
clang::CodeGen::CodeGenVTables::getMicrosoftVTableContext
MicrosoftVTableContext & getMicrosoftVTableContext()
Definition: CGVTables.h:105
clang::CodeGen::CodeGenModule::RefreshTypeCacheForClass
void RefreshTypeCacheForClass(const CXXRecordDecl *Class)
Definition: CodeGenModule.cpp:862
clang::CodeGen::BlockByrefHelpers::needsCopy
virtual bool needsCopy() const
Definition: CodeGenModule.h:275
clang::CodeGen::CodeGenModule::getGlobalCtors
CtorList & getGlobalCtors()
Definition: CodeGenModule.h:738
clang::CodeGen::CodeGenModule::GetAddrOfGlobal
llvm::Constant * GetAddrOfGlobal(GlobalDecl GD, ForDefinition_t IsForDefinition=NotForDefinition)
Definition: CodeGenModule.cpp:4040
clang::CodeGen::ObjCEntrypoints::objc_storeStrong
llvm::Function * objc_storeStrong
void objc_storeStrong(id*, id);
Definition: CodeGenModule.h:199
clang::CodeGen::InstrProfStats::InstrProfStats
InstrProfStats()
Definition: CodeGenModule.h:227
clang::CodeGen::CodeGenModule::getTBAAVTablePtrAccessInfo
TBAAAccessInfo getTBAAVTablePtrAccessInfo(llvm::Type *VTablePtrType)
getTBAAVTablePtrAccessInfo - Get the TBAA information that describes an access to a virtual table poi...
Definition: CodeGenModule.cpp:893
clang::CodeGen::CodeGenModule::getModule
llvm::Module & getModule() const
Definition: CodeGenModule.h:709
clang::MSGuidDecl
A global _GUID constant.
Definition: DeclCXX.h:4139
clang::CXXDestructorDecl
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2668
clang::CodeGen::CGDebugInfo
This class gathers all debug information during compilation and is responsible for emitting to llvm g...
Definition: CGDebugInfo.h:56
clang::CodeGen::CodeGenModule::~CodeGenModule
~CodeGenModule()
Definition: CodeGenModule.cpp:215
clang::CodeGen::CodeGenModule::shouldUseTBAA
bool shouldUseTBAA() const
Definition: CodeGenModule.h:722
clang::CodeGen::CodeGenModule::setFunctionLinkage
void setFunctionLinkage(GlobalDecl GD, llvm::Function *F)
Definition: CodeGenModule.h:1251
clang::CodeGen::CodeGenModule::EmitTentativeDefinition
void EmitTentativeDefinition(const VarDecl *D)
Definition: CodeGenModule.cpp:4139
clang::CallingConv
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition: Specifiers.h:254
clang::CodeGen::CGOpenCLRuntime
Definition: CGOpenCLRuntime.h:35
clang::VarDecl
Represents a variable declaration or definition.
Definition: Decl.h:876
clang::CodeGen::CodeGenModule::EmitDeferredUnusedCoverageMappings
void EmitDeferredUnusedCoverageMappings()
Emit all the deferred coverage mappings for the uninstrumented functions.
Definition: CodeGenModule.cpp:6029
clang::CodeGen::CodeGenModule::AddGlobalAnnotations
void AddGlobalAnnotations(const ValueDecl *D, llvm::GlobalValue *GV)
Add global annotations that are set on D, for the global GV.
Definition: CodeGenModule.cpp:2595
clang::CodeGen::CodeGenModule::imbueXRayAttrs
bool imbueXRayAttrs(llvm::Function *Fn, SourceLocation Loc, StringRef Category=StringRef()) const
Imbue XRay attributes to a function, applying the always/never attribute lists in the process.
Definition: CodeGenModule.cpp:2654
clang::CodeGen::CodeGenModule::Structor::Initializer
llvm::Constant * Initializer
Definition: CodeGenModule.h:296
clang::CodeGen::CodeGenModule::EmitOMPAllocateDecl
void EmitOMPAllocateDecl(const OMPAllocateDecl *D)
Emit a code for the allocate directive.
Definition: CGDecl.cpp:2624
clang::TagDecl
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3328
clang::OMPDeclareMapperDecl
This represents '#pragma omp declare mapper ...' directive.
Definition: DeclOpenMP.h:286
clang::CodeGen::CodeGenModule::EmitOMPThreadPrivateDecl
void EmitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D)
Emit a code for threadprivate directive.
Definition: CodeGenModule.cpp:6233
clang::StringLiteral
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1761
clang::CodeGen::CodeGenModule::getTypes
CodeGenTypes & getTypes()
Definition: CodeGenModule.h:726
clang::CodeGen::CodeGenModule::getCoverageMapping
CoverageMappingModuleGen * getCoverageMapping() const
Definition: CodeGenModule.h:641
llvm::DenseSet
Definition: Sema.h:78
clang::Type::getAsCXXRecordDecl
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Definition: Type.cpp:1753
NoSanitizeList.h
clang::CodeGen::CodeGenModule::getBlockObjectDispose
llvm::FunctionCallee getBlockObjectDispose()
Definition: CGBlocks.cpp:2883
clang::CodeGen::CodeGenModule::GetAddrOfConstantCompoundLiteral
ConstantAddress GetAddrOfConstantCompoundLiteral(const CompoundLiteralExpr *E)
Returns a pointer to a constant global variable for the given file-scope compound literal expression.
Definition: CGExprConstant.cpp:2178
clang::CodeGen::Address
An aligned address.
Definition: Address.h:24
Base
clang::CodeGen::CodeGenModule::clear
void clear()
Definition: CodeGenModule.cpp:413
clang::ObjCEncodeExpr
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:409
clang::CodeGen::CodeGenModule::GetAddrOfGlobalBlock
llvm::Constant * GetAddrOfGlobalBlock(const BlockExpr *BE, StringRef Name)
Gets the address of a block which requires no captures.
Definition: CGBlocks.cpp:1287
clang::CodeGen::CodeGenModule::Structor
Definition: CodeGenModule.h:289
clang::CodeGen::CodeGenModule::AddCXXPrioritizedStermFinalizerEntry
void AddCXXPrioritizedStermFinalizerEntry(llvm::Function *StermFinalizer, int Priority)
Definition: CodeGenModule.h:1098
clang::CodeGen::CodeGenModule::AppendLinkerOptions
void AppendLinkerOptions(StringRef Opts)
Appends Opts to the "llvm.linker.options" metadata value.
Definition: CodeGenModule.cpp:2248
clang::CodeGen::CodeGenModule::getAddrAndTypeOfCXXStructor
llvm::FunctionCallee getAddrAndTypeOfCXXStructor(GlobalDecl GD, const CGFunctionInfo *FnInfo=nullptr, llvm::FunctionType *FnType=nullptr, bool DontDefer=false, ForDefinition_t IsForDefinition=NotForDefinition)
Definition: CGCXX.cpp:221
clang::CodeGen::OrderGlobalInitsOrStermFinalizers::operator==
bool operator==(const OrderGlobalInitsOrStermFinalizers &RHS) const
Definition: CodeGenModule.h:112
clang::CodeGen::CodeGenModule::getAtomicSetterHelperFnMap
llvm::Constant * getAtomicSetterHelperFnMap(QualType Ty)
Definition: CodeGenModule.h:671
clang::CodeGenOptions
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
Definition: CodeGenOptions.h:49
clang::CodeGen::ObjCEntrypoints::objc_autorelease
llvm::Function * objc_autorelease
id objc_autorelease(id);
Definition: CodeGenModule.h:145
clang::CodeGen::CodeGenModule::EmitVTableTypeMetadata
void EmitVTableTypeMetadata(const CXXRecordDecl *RD, llvm::GlobalVariable *VTable, const VTableLayout &VTLayout)
Emit type metadata for the given vtable using the given layout.
Definition: CGVTables.cpp:1249
clang::CodeGen::ObjCEntrypoints::objc_retainAutorelease
llvm::Function * objc_retainAutorelease
id objc_retainAutorelease(id);
Definition: CodeGenModule.h:180
clang::TemplateParamObjectDecl
A template parameter object.
Definition: DeclTemplate.h:3283
clang::CodeGen::CodeGenModule::HandleCXXStaticMemberVarInstantiation
void HandleCXXStaticMemberVarInstantiation(VarDecl *VD)
Tell the consumer that this variable has been instantiated.
Definition: CodeGenModule.cpp:4829
clang::CodeGen::CodeGenModule::getTarget
const TargetInfo & getTarget() const
Definition: CodeGenModule.h:714
clang::CodeGen::CodeGenModule::ByrefHelpersCache
llvm::FoldingSet< BlockByrefHelpers > ByrefHelpersCache
Definition: CodeGenModule.h:939
clang::CodeGen::ObjCEntrypoints::objc_alloc_init
llvm::FunctionCallee objc_alloc_init
void objc_alloc_init(id);
Definition: CodeGenModule.h:132
clang::Visibility
Visibility
Describes the different kinds of visibility that a declaration may have.
Definition: Visibility.h:33
clang::CodeGen::CodeGenModule::getModuleDebugInfo
CGDebugInfo * getModuleDebugInfo()
Definition: CodeGenModule.h:694
clang::CodeGen::CodeGenModule::getBlockDescriptorType
llvm::Type * getBlockDescriptorType()
Fetches the type of a generic block descriptor.
Definition: CGBlocks.cpp:1109
clang::CodeGen::ObjCEntrypoints::objc_retain
llvm::Function * objc_retain
id objc_retain(id);
Definition: CodeGenModule.h:173
clang::CodeGen::CodeGenModule::EmitGlobalAnnotations
void EmitGlobalAnnotations()
Emit all the global annotations.
Definition: CodeGenModule.cpp:2489
clang::CodeGen::CodeGenModule::CreateCrossDsoCfiTypeId
llvm::ConstantInt * CreateCrossDsoCfiTypeId(llvm::Metadata *MD)
Generate a cross-DSO type identifier for MD.
Definition: CodeGenModule.cpp:1505
clang::CodeGen::CodeGenModule::GetTargetTypeStoreSize
CharUnits GetTargetTypeStoreSize(llvm::Type *Ty) const
Return the store size, in character units, of the given LLVM type.
Definition: CodeGenModule.cpp:4166
clang::CodeGen::ObjCEntrypoints::objc_initWeak
llvm::Function * objc_initWeak
id objc_initWeak(id*, id);
Definition: CodeGenModule.h:161
clang::CodeGen::CodeGenModule::GetConstantArrayFromStringLiteral
llvm::Constant * GetConstantArrayFromStringLiteral(const StringLiteral *E)
Return a constant array for the given string.
Definition: CodeGenModule.cpp:5306
clang::LangAS
LangAS
Defines the address space values used by the address space qualifier of QualType.
Definition: AddressSpaces.h:25
clang::CodeGen::CodeGenModule::IsPlatformVersionAtLeastFn
llvm::FunctionCallee IsPlatformVersionAtLeastFn
Definition: CodeGenModule.h:636
clang::CodeGen::CodeGenModule::getDataLayout
const llvm::DataLayout & getDataLayout() const
Definition: CodeGenModule.h:711
clang::CompoundLiteralExpr
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:3403
clang::CodeGen::ObjCEntrypoints::objc_autoreleasePoolPopInvoke
llvm::FunctionCallee objc_autoreleasePoolPopInvoke
void objc_autoreleasePoolPop(void*); Note this method is used when we are using exception handling
Definition: CodeGenModule.h:139
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:255
clang::CodeGen::LValue
LValue - This represents an lvalue references.
Definition: CGValue.h:167
clang::CodeGen::CodeGenModule::GetAddrOfTemplateParamObject
ConstantAddress GetAddrOfTemplateParamObject(const TemplateParamObjectDecl *TPO)
Get the address of a template parameter object.
Definition: CodeGenModule.cpp:2813
clang::CodeGen::CodeGenModule::getMicrosoftVTableContext
MicrosoftVTableContext & getMicrosoftVTableContext()
Definition: CodeGenModule.h:734
clang::CodeGen::CodeGenModule::getNSConcreteGlobalBlock
llvm::Constant * getNSConcreteGlobalBlock()
Definition: CGBlocks.cpp:2909
clang::CastExpr::path_const_iterator
const typedef CXXBaseSpecifier *const * path_const_iterator
Definition: Expr.h:3541
clang::CodeGen::BlockByrefHelpers::Alignment
CharUnits Alignment
The alignment of the field.
Definition: CodeGenModule.h:262
clang::CodeGen::CodeGenModule::AddDeferredUnusedCoverageMapping
void AddDeferredUnusedCoverageMapping(Decl *D)
Stored a deferred empty coverage mapping for an unused and thus uninstrumented top level declaration.
Definition: CodeGenModule.cpp:5988
clang::CodeGen::CodeGenModule::getTerminateFn
llvm::FunctionCallee getTerminateFn()
Get the declaration of std::terminate for the platform.
Definition: CGException.cpp:63
clang::CodeGen::CodeGenModule::EmitExplicitCastExprType
void EmitExplicitCastExprType(const ExplicitCastExpr *E, CodeGenFunction *CGF=nullptr)
Emit type info if type of an expression is a variably modified type.
Definition: CGExpr.cpp:1057
clang::CodeGen::CodeGenModule::setStaticLocalDeclAddress
void setStaticLocalDeclAddress(const VarDecl *D, llvm::Constant *C)
Definition: CodeGenModule.h:648
clang::CodeGen::CodeGenModule::ErrorUnsupported
void ErrorUnsupported(const Stmt *S, const char *Type)
Print out an error that codegen doesn't support the specified stmt yet.
Definition: CodeGenModule.cpp:959
clang::CodeGen::CodeGenModule::GetAddrOfConstantString
ConstantAddress GetAddrOfConstantString(const StringLiteral *Literal)
Return a pointer to a constant NSString object for the given string.
clang::CodeGen::CodeGenModule::CreateMetadataIdentifierForVirtualMemPtrType
llvm::Metadata * CreateMetadataIdentifierForVirtualMemPtrType(QualType T)
Create a metadata identifier that is intended to be used to check virtual calls via a member function...
Definition: CodeGenModule.cpp:6278
clang::CodeGen::CodeGenFunction
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
Definition: CodeGenFunction.h:235
clang::CodeGen::CodeGenModule::getBuiltinLibFunction
llvm::Constant * getBuiltinLibFunction(const FunctionDecl *FD, unsigned BuiltinID)
Given a builtin id for a function like "__builtin_fabsf", return a Function* for "fabsf".
Definition: CGBuiltin.cpp:91
clang::CodeGen::CodeGenModule::getObjCFastEnumerationStateType
QualType getObjCFastEnumerationStateType()
Retrieve the record type that describes the state of an Objective-C fast enumeration loop (for....
Definition: CodeGenModule.cpp:5272
clang::ValueDecl
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:676
SanitizerMetadata.h
clang::CodeGen::CodeGenModule::CreateRuntimeVariable
llvm::Constant * CreateRuntimeVariable(llvm::Type *Ty, StringRef Name)
Create a new runtime global variable with the specified type and name.
Definition: CodeGenModule.cpp:4130
clang::CodeGen::CodeGenModule::getCXXABI
CGCXXABI & getCXXABI() const
Definition: CodeGenModule.h:719
clang::CodeGen::CodeGenModule::Structor::Structor
Structor()
Definition: CodeGenModule.h:290
clang::CodeGen::CodeGenModule::HasLTOVisibilityPublicStd
bool HasLTOVisibilityPublicStd(const CXXRecordDecl *RD)
Returns whether the given record has public std LTO visibility and therefore may not participate in (...
Definition: CGVTables.cpp:1176
clang::CodeGen::CodeGenModule::getMostBaseClasses
std::vector< const CXXRecordDecl * > getMostBaseClasses(const CXXRecordDecl *RD)
Return a vector of most-base classes for RD.
Definition: CodeGenModule.cpp:1742
clang::CodeGen::CodeGenModule::GetNonVirtualBaseClassOffset
llvm::Constant * GetNonVirtualBaseClassOffset(const CXXRecordDecl *ClassDecl, CastExpr::path_const_iterator PathBegin, CastExpr::path_const_iterator PathEnd)
Returns the offset from a derived class to a class.
Definition: CGClass.cpp:196
clang::CodeGen::CodeGenModule
This class organizes the cross-function state that is used while generating LLVM code.
Definition: CodeGenModule.h:284
clang::ItaniumVTableContext
Definition: VTableBuilder.h:363
clang::CodeGen::CodeGenModule::GetAddrOfRTTIDescriptor
llvm::Constant * GetAddrOfRTTIDescriptor(QualType Ty, bool ForEH=false)
Get the address of the RTTI descriptor for the given type.
Definition: CodeGenModule.cpp:6216
clang::CodeGen::CodeGenModule::setDSOLocal
void setDSOLocal(llvm::GlobalValue *GV) const
Definition: CodeGenModule.cpp:1100
clang::BlockExpr
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:5965
llvm::ArrayRef
Definition: LLVM.h:34
clang::CodeGen::CodeGenModule::getVTables
CodeGenVTables & getVTables()
Definition: CodeGenModule.h:728
clang::CodeGen::CodeGenModule::EmitOMPDeclareReduction
void EmitOMPDeclareReduction(const OMPDeclareReductionDecl *D, CodeGenFunction *CGF=nullptr)
Emit a code for declare reduction construct.
Definition: CGDecl.cpp:2605
Value
Value
Definition: UninitializedValues.cpp:102
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:89
clang::CodeGen::CodeGenModule::GetAddrOfMSGuidDecl
ConstantAddress GetAddrOfMSGuidDecl(const MSGuidDecl *GD)
Get the address of a GUID.
Definition: CodeGenModule.cpp:2760
clang::DeclaratorDecl
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:728
clang::CodeGen::CodeGenModule::getTriple
const llvm::Triple & getTriple() const
Definition: CodeGenModule.h:715
clang::CodeGen::ObjCEntrypoints::objc_loadWeak
llvm::Function * objc_loadWeak
id objc_loadWeak(id*);
Definition: CodeGenModule.h:164
CodeGenTypes.h
clang::CodeGen::CodeGenModule::CreateFunctionTypeMetadataForIcall
void CreateFunctionTypeMetadataForIcall(const FunctionDecl *FD, llvm::Function *F)
Create and attach type metadata to the given function.
Definition: CodeGenModule.cpp:2076
clang::CodeGen::CodeGenModule::setLLVMFunctionFEnvAttributes
void setLLVMFunctionFEnvAttributes(const FunctionDecl *D, llvm::Function *F)
Set the LLVM function attributes that represent floating point environment.
Definition: CodeGenModule.cpp:1918
clang::CodeGen::CodeGenModule::getStaticLocalDeclAddress
llvm::Constant * getStaticLocalDeclAddress(const VarDecl *D)
Definition: CodeGenModule.h:645
clang::MicrosoftVTableContext
Definition: VTableBuilder.h:544
clang::CodeGen::CodeGenModule::ReturnTypeUsesFP2Ret
bool ReturnTypeUsesFP2Ret(QualType ResultType)
Return true iff the given type uses 'fp2ret' when used as a return type.
Definition: CGCall.cpp:1578
clang::CodeGen::ObjCEntrypoints::objc_destroyWeak
llvm::Function * objc_destroyWeak
void objc_destroyWeak(id*);
Definition: CodeGenModule.h:158
clang::CodeGen::OrderGlobalInitsOrStermFinalizers::lex_order
unsigned int lex_order
Definition: CodeGenModule.h:108
clang::CodeGen::ForDefinition
@ ForDefinition
Definition: CodeGenModule.h:103
clang::CodeGen::CodeGenModule::getBlockObjectAssign
llvm::FunctionCallee getBlockObjectAssign()
Definition: CGBlocks.cpp:2896
clang::CodeGen::CodeGenModule::EmitVTable
void EmitVTable(CXXRecordDecl *Class)
This is a callback from Sema to tell us that a particular vtable is required to be emitted in this tr...
Definition: CGVTables.cpp:1086
clang::CodeGen::CodeGenTypes
This class organizes the cross-module state that is used while lowering AST types to LLVM types.
Definition: CodeGenTypes.h:59
clang::CodeGen::ObjCEntrypoints::objc_releaseRuntimeFunction
llvm::FunctionCallee objc_releaseRuntimeFunction
void objc_release(id); Note this is the runtime method not the intrinsic.
Definition: CodeGenModule.h:196
clang::CodeGen::ObjCEntrypoints::objc_retainRuntimeFunction
llvm::FunctionCallee objc_retainRuntimeFunction
id objc_retain(id); Note this is the runtime method not the intrinsic.
Definition: CodeGenModule.h:177
clang::CodeGen::CodeGenModule::GetDefaultLLVMTLSModel
llvm::GlobalVariable::ThreadLocalMode GetDefaultLLVMTLSModel() const
Get LLVM TLS mode from CodeGenOptions.
Definition: CodeGenModule.cpp:1153
clang::CodeGen::BlockByrefHelpers::Profile
void Profile(llvm::FoldingSetNodeID &id) const
Definition: CodeGenModule.h:269
clang::CodeGen::CodeGenModule::addDefaultFunctionDefinitionAttributes
void addDefaultFunctionDefinitionAttributes(llvm::Function &F)
Adds attributes to F according to our CodeGenOptions and LangOptions, as though we had emitted it our...
Definition: CGCall.cpp:1883
clang::CodeGen::CodeGenModule::getTBAAAccessInfo
TBAAAccessInfo getTBAAAccessInfo(QualType AccessType)
getTBAAAccessInfo - Get TBAA information that describes an access to an object of the given type.
Definition: CodeGenModule.cpp:873
clang::CodeGen::CodeGenModule::DecorateInstructionWithTBAA
void DecorateInstructionWithTBAA(llvm::Instruction *Inst, TBAAAccessInfo TBAAInfo)
DecorateInstructionWithTBAA - Decorate the instruction with a TBAA tag.
Definition: CodeGenModule.cpp:940
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:67
clang::CodeGen::CodeGenModule::EmitExternalDeclaration
void EmitExternalDeclaration(const VarDecl *D)
Definition: CodeGenModule.cpp:4162
clang::CodeGen::CodeGenModule::getNSConcreteStackBlock
llvm::Constant * getNSConcreteStackBlock()
Definition: CGBlocks.cpp:2919
clang::CodeGen::CGCalleeInfo
Abstract information about a function or function prototype.
Definition: CGCall.h:45
clang::ObjCRuntime
The basic abstraction for the target Objective-C runtime.
Definition: ObjCRuntime.h:28
clang::CodeGen::CodeGenModule::getNullPointer
llvm::Constant * getNullPointer(llvm::PointerType *T, QualType QT)
Get target specific null pointer.
Definition: CGExprConstant.cpp:1735
clang::CodeGen::CodeGenModule::IsOSVersionAtLeastFn
llvm::FunctionCallee IsOSVersionAtLeastFn
Definition: CodeGenModule.h:634
Priority
int Priority
Definition: Format.cpp:2337
clang::CodeGen::InstrProfStats::reportDiagnostics
void reportDiagnostics(DiagnosticsEngine &Diags, StringRef MainFile)
Report potential problems we've found to Diags.
Definition: CodeGenModule.cpp:419
clang::LangOptions
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:58
clang::CodeGen::CodeGenModule::GetAddrOfConstantStringFromLiteral
ConstantAddress GetAddrOfConstantStringFromLiteral(const StringLiteral *S, StringRef Name=".str")
Return a pointer to a constant array for the given string literal.
Definition: CodeGenModule.cpp:5371
clang::CodeGen::CodeGenModule::supportsCOMDAT
bool supportsCOMDAT() const
Definition: TargetInfo.cpp:11076
clang::ObjCPropertyAttribute::Kind
Kind
Definition: DeclObjCCommon.h:22
clang::CodeGen::CGFunctionInfo
CGFunctionInfo - Class to encapsulate the information about a function definition.
Definition: CGFunctionInfo.h:546
clang::CodeGen::CodeGenModule::NeedAllVtablesTypeId
bool NeedAllVtablesTypeId() const
Returns whether this module needs the "all-vtables" type identifier.
Definition: CodeGenModule.cpp:6320
clang::CodeGen::CodeGenModule::EmitAnnotateAttr
llvm::Constant * EmitAnnotateAttr(llvm::GlobalValue *GV, const AnnotateAttr *AA, SourceLocation L)
Generate the llvm::ConstantStruct which contains the annotation information for a given GlobalValue.
Definition: CodeGenModule.cpp:2567
clang::CodeGen::ObjCEntrypoints::objc_unsafeClaimAutoreleasedReturnValue
llvm::Function * objc_unsafeClaimAutoreleasedReturnValue
id objc_unsafeClaimAutoreleasedReturnValue(id);
Definition: CodeGenModule.h:205
clang::CodeGen::CodeGenModule::GetVCallVisibilityLevel
llvm::GlobalObject::VCallVisibility GetVCallVisibilityLevel(const CXXRecordDecl *RD, llvm::DenseSet< const CXXRecordDecl * > &Visited)
Returns the vcall visibility of the given type.
Definition: CGVTables.cpp:1215
clang::CodeGen::ObjCEntrypoints
Definition: CodeGenModule.h:122
clang::CodeGen::CodeGenModule::getHeaderSearchOpts
const HeaderSearchOptions & getHeaderSearchOpts() const
Definition: CodeGenModule.h:704
clang::CodeGen::CodeGenModule::getPreprocessorOpts
const PreprocessorOptions & getPreprocessorOpts() const
Definition: CodeGenModule.h:706
clang::CodeGen::NotForDefinition
@ NotForDefinition
Definition: CodeGenModule.h:102
clang::VTableLayout
Definition: VTableBuilder.h:233
clang::CodeGen::CodeGenModule::getMemberPointerConstant
llvm::Constant * getMemberPointerConstant(const UnaryOperator *e)
Definition: CGExprConstant.cpp:2184
clang::CodeGen::CodeGenModule::getModuleNameHash
const std::string & getModuleNameHash() const
Definition: CodeGenModule.h:607
clang::CodeGen::BlockByrefHelpers::profileImpl
virtual void profileImpl(llvm::FoldingSetNodeID &id) const =0
clang
Definition: CalledOnceCheck.h:17
memset
__DEVICE__ void * memset(void *__a, int __b, size_t __c)
Definition: __clang_cuda_device_functions.h:1552
clang::CodeGen::ObjCEntrypoints::objc_moveWeak
llvm::Function * objc_moveWeak
void objc_moveWeak(id *dest, id *src);
Definition: CodeGenModule.h:170
XRayLists.h
clang::CodeGen::CodeGenModule::setStaticLocalDeclGuardAddress
void setStaticLocalDeclGuardAddress(const VarDecl *D, llvm::GlobalVariable *C)
Definition: CodeGenModule.h:660
clang::CodeGen::CodeGenModule::CtorList
std::vector< Structor > CtorList
Definition: CodeGenModule.h:300
clang::CodeGen::CodeGenModule::addCompilerUsedGlobal
void addCompilerUsedGlobal(llvm::GlobalValue *GV)
Add a global to a list to be added to the llvm.compiler.used metadata.
Definition: CodeGenModule.cpp:2202
clang::CodeGen::CodeGenModule::getVTableLinkage
llvm::GlobalVariable::LinkageTypes getVTableLinkage(const CXXRecordDecl *RD)
Return the appropriate linkage for the vtable, VTT, and type information of the given class.
Definition: CGVTables.cpp:994
clang::CodeGen::ObjCEntrypoints::ObjCEntrypoints
ObjCEntrypoints()
Definition: CodeGenModule.h:123
clang::CodeGen::CodeGenModule::addReplacement
void addReplacement(StringRef Name, llvm::Constant *C)
Definition: CodeGenModule.cpp:269
clang::CodeGen::CodeGenModule::GetAddrOfConstantCString
ConstantAddress GetAddrOfConstantCString(const std::string &Str, const char *GlobalName=nullptr)
Returns a pointer to a character array containing the literal and a terminating '\0' character.
Definition: CodeGenModule.cpp:5429
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:68
clang::CodeGen::CodeGenModule::TryEmitBaseDestructorAsAlias
bool TryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D)
Try to emit a base destructor as an alias to its primary base-class destructor.
Definition: CGCXX.cpp:34
clang::CodeGen::ObjCEntrypoints::objc_alloc
llvm::FunctionCallee objc_alloc
void objc_alloc(id);
Definition: CodeGenModule.h:126
clang::CodeGen::CodeGenModule::GetLLVMVisibility
static llvm::GlobalValue::VisibilityTypes GetLLVMVisibility(Visibility V)
Definition: CodeGenModule.h:822
clang::DefaultVisibility
@ DefaultVisibility
Objects with "default" visibility are seen by the dynamic linker and act like normal objects.
Definition: Visibility.h:45
clang::CodeGen::CodeGenModule::getLLVMLifetimeEndFn
llvm::Function * getLLVMLifetimeEndFn()
Lazily declare the @llvm.lifetime.end intrinsic.
Definition: CGDecl.cpp:2400
clang::CodeGen::ObjCEntrypoints::objc_retainBlock
llvm::Function * objc_retainBlock
id objc_retainBlock(id);
Definition: CodeGenModule.h:189
clang::CodeGen::CodeGenModule::getNaturalTypeAlignment
CharUnits getNaturalTypeAlignment(QualType T, LValueBaseInfo *BaseInfo=nullptr, TBAAAccessInfo *TBAAInfo=nullptr, bool forPointeeType=false)
Definition: CodeGenModule.cpp:6375
clang::CodeGen::ObjCEntrypoints::objc_loadWeakRetained
llvm::Function * objc_loadWeakRetained
id objc_loadWeakRetained(id*);
Definition: CodeGenModule.h:167
clang::CodeGen::CodeGenModule::getUniqueBlockCount
int getUniqueBlockCount()
Fetches the global unique block count.
Definition: CodeGenModule.h:942
clang::Attr
Attr - This represents one attribute.
Definition: Attr.h:46
clang::CodeGen::CodeGenModule::getPGOStats
InstrProfStats & getPGOStats()
Definition: CodeGenModule.h:638
clang::OMPRequiresDecl
This represents '#pragma omp requires...' directive.
Definition: DeclOpenMP.h:416
clang::CodeGen::ObjCEntrypoints::objc_autoreleaseRuntimeFunction
llvm::FunctionCallee objc_autoreleaseRuntimeFunction
id objc_autorelease(id); Note this is the runtime method not the intrinsic.
Definition: CodeGenModule.h:149
clang::CodeGen::TBAAAccessInfo::getMayAliasInfo
static TBAAAccessInfo getMayAliasInfo()
Definition: CodeGenTBAA.h:63
clang::CodeGen::CodeGenModule::getDiags
DiagnosticsEngine & getDiags() const
Definition: CodeGenModule.h:710
clang::CodeGen::CodeGenModule::GetWeakRefReference
ConstantAddress GetWeakRefReference(const ValueDecl *VD)
Get a reference to the target of VD.
Definition: CodeGenModule.cpp:2840
clang::CodeGen::OrderGlobalInitsOrStermFinalizers::priority
unsigned int priority
Definition: CodeGenModule.h:107
clang::CodeGen::CodeGenModule::getNoObjCARCExceptionsMetadata
llvm::MDNode * getNoObjCARCExceptionsMetadata()
Definition: CodeGenModule.h:696
clang::CodeGen::CodeGenModule::mergeTBAAInfoForConditionalOperator
TBAAAccessInfo mergeTBAAInfoForConditionalOperator(TBAAAccessInfo InfoA, TBAAAccessInfo InfoB)
mergeTBAAInfoForConditionalOperator - Get merged TBAA information for the purposes of conditional ope...
Definition: CodeGenModule.cpp:925
clang::CodeGen::CodeGenModule::AddDetectMismatch
void AddDetectMismatch(StringRef Name, StringRef Value)
Appends a detect mismatch command to the linker options.
Definition: CodeGenModule.cpp:2253
clang::CodeGen::CodeGenModule::getLLVMLinkageVarDefinition
llvm::GlobalValue::LinkageTypes getLLVMLinkageVarDefinition(const VarDecl *VD, bool IsConstant)
Returns LLVM linkage for a declarator.
Definition: CodeGenModule.cpp:4707
clang::CodeGen::CodeGenVTables
Definition: CGVTables.h:32
GlobalDecl.h
clang::CodeGen::CodeGenModule::getCUDARuntime
CGCUDARuntime & getCUDARuntime()
Return a reference to the configured CUDA runtime.
Definition: CodeGenModule.h:622
clang::CodeGen::CodeGenModule::UpdateCompletedType
void UpdateCompletedType(const TagDecl *TD)
Definition: CodeGenModule.cpp:857
clang::CodeGen::CodeGenModule::getBlockMangledName
StringRef getBlockMangledName(GlobalDecl GD, const BlockDecl *BD)
Definition: CodeGenModule.cpp:1399
clang::CodeGen::CodeGenModule::EmitAnnotationString
llvm::Constant * EmitAnnotationString(StringRef Str)
Emit an annotation string.
Definition: CodeGenModule.cpp:2502
clang::CodeGen::CodeGenModule::getFunctionLinkage
llvm::GlobalVariable::LinkageTypes getFunctionLinkage(GlobalDecl GD)
Definition: CodeGenModule.cpp:1485
clang::CodeGen::CGCXXABI
Implements C++ ABI-specific code generation functions.
Definition: CGCXXABI.h:44
clang::interp::DeclTy
unsigned llvm::PointerUnion< const Decl *, const Expr * > DeclTy
Definition: Descriptor.h:26
clang::CharUnits
CharUnits - This is an opaque type for sizes expressed in character units.
Definition: CharUnits.h:38
Mangle.h
clang::CodeGen::CodeGenModule::GetAddrOfConstantStringFromObjCEncode
ConstantAddress GetAddrOfConstantStringFromObjCEncode(const ObjCEncodeExpr *)
Return a pointer to a constant array for the given ObjCEncodeExpr node.
Definition: CodeGenModule.cpp:5419
clang::index::SymbolKind::Function
@ Function
clang::CodeGen::CodeGenModule::setGVPropertiesAux
void setGVPropertiesAux(llvm::GlobalValue *GV, const NamedDecl *D) const
Definition: CodeGenModule.cpp:1137
clang::CodeGen::CodeGenModule::GetAddrOfThunk
llvm::Constant * GetAddrOfThunk(StringRef Name, llvm::Type *FnTy, GlobalDecl GD)
Get the address of the thunk for the given global decl.
Definition: CGVTables.cpp:34
clang::AtomicType
Definition: Type.h:6243
CGVTables.h
PreprocessorOptions.h
clang::Expr
This represents one expression.
Definition: Expr.h:109
clang::CodeGen::CodeGenVTables::getItaniumVTableContext
ItaniumVTableContext & getItaniumVTableContext()
Definition: CGVTables.h:101
clang::CodeGen::CodeGenModule::getAddrOfCXXStructor
llvm::Constant * getAddrOfCXXStructor(GlobalDecl GD, const CGFunctionInfo *FnInfo=nullptr, llvm::FunctionType *FnType=nullptr, bool DontDefer=false, ForDefinition_t IsForDefinition=NotForDefinition)
Return the address of the constructor/destructor of the given type.
Definition: CodeGenModule.h:1022
clang::CodeGen::CodeGenModule::CreateOrReplaceCXXRuntimeVariable
llvm::GlobalVariable * CreateOrReplaceCXXRuntimeVariable(StringRef Name, llvm::Type *Ty, llvm::GlobalValue::LinkageTypes Linkage, unsigned Alignment)
Will return a global variable of the given type.
Definition: CodeGenModule.cpp:4065
clang::CodeGen::CodeGenModule::setGVProperties
void setGVProperties(llvm::GlobalValue *GV, GlobalDecl GD) const
Set visibility, dllimport/dllexport and dso_local.
Definition: CodeGenModule.cpp:1125
clang::CodeGen::CodeGenModule::getLLVMLifetimeStartFn
llvm::Function * getLLVMLifetimeStartFn()
Lazily declare the @llvm.lifetime.start intrinsic.
Definition: CGDecl.cpp:2391
clang::CodeGen::CodeGenModule::getIntrinsic
llvm::Function * getIntrinsic(unsigned IID, ArrayRef< llvm::Type * > Tys=None)
Definition: CodeGenModule.cpp:5034
clang::transformer::name
RangeSelector name(std::string ID)
Given a node with a "name", (like NamedDecl, DeclRefExpr, CxxCtorInitializer, and TypeLoc) selects th...
Definition: RangeSelector.cpp:200
clang::CodeGen::CodeGenModule::getObjCEntrypoints
ObjCEntrypoints & getObjCEntrypoints() const
Definition: CodeGenModule.h:627
clang::CodeGen::CodeGenModule::AddVTableTypeMetadata
void AddVTableTypeMetadata(llvm::GlobalVariable *VTable, CharUnits Offset, const CXXRecordDecl *RD)
Create and attach type metadata for the given vtable.
Definition: CodeGenModule.cpp:6333
clang::CodeGen::CodeGenModule::DecorateInstructionWithInvariantGroup
void DecorateInstructionWithInvariantGroup(llvm::Instruction *I, const CXXRecordDecl *RD)
Adds !invariant.barrier !tag to instruction.
Definition: CodeGenModule.cpp:946
clang::CodeGen::BlockByrefHelpers::CopyHelper
llvm::Constant * CopyHelper
Definition: CodeGenModule.h:256
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1856
clang::CodeGen::BlockByrefHelpers::emitDispose
virtual void emitDispose(CodeGenFunction &CGF, Address field)=0
clang::CodeGen::CodeGenModule::setTLSMode
void setTLSMode(llvm::GlobalValue *GV, const VarDecl &D) const
Set the TLS mode for the given LLVM GlobalValue for the thread-local variable declaration D.
Definition: CodeGenModule.cpp:1167
clang::CodeGen::CodeGenModule::AddCXXDtorEntry
void AddCXXDtorEntry(llvm::FunctionCallee DtorFn, llvm::Constant *Object)
Add a destructor and object to add to the C++ global destructor function.
Definition: CodeGenModule.h:1081
clang::CodeGen::CodeGenModule::GetAddrOfGlobalTemporary
ConstantAddress GetAddrOfGlobalTemporary(const MaterializeTemporaryExpr *E, const Expr *Inner)
Returns a pointer to a global variable representing a temporary with static or thread storage duratio...
Definition: CodeGenModule.cpp:5463
clang::CodeGen::CodeGenModule::addGlobalValReplacement
void addGlobalValReplacement(llvm::GlobalValue *GV, llvm::Constant *C)
Definition: CodeGenModule.cpp:304
clang::CodeGen::CodeGenModule::getAddrOfConstantCompoundLiteralIfEmitted
llvm::GlobalVariable * getAddrOfConstantCompoundLiteralIfEmitted(const CompoundLiteralExpr *E)
If it's been emitted already, returns the GlobalVariable corresponding to a compound literal.
Definition: CGExprConstant.cpp:2165
clang::CodeGen::CodeGenModule::getSanitizerMetadata
SanitizerMetadata * getSanitizerMetadata()
Definition: CodeGenModule.h:1317
clang::CodeGen::CodeGenModule::Structor::AssociatedData
llvm::Constant * AssociatedData
Definition: CodeGenModule.h:297
clang::CodeGen::CodeGenModule::EmitAnnotationLineNo
llvm::Constant * EmitAnnotationLineNo(SourceLocation L)
Emit the annotation line number.
Definition: CodeGenModule.cpp:2526
clang::CodeGen::CodeGenModule::hasObjCRuntime
bool hasObjCRuntime()
Return true iff an Objective-C runtime has been configured.
Definition: CodeGenModule.h:605
clang::CodeGen::ObjCEntrypoints::objc_storeWeak
llvm::Function * objc_storeWeak
id objc_storeWeak(id*, id);
Definition: CodeGenModule.h:202
clang::CodeGen::CodeGenModule::Error
void Error(SourceLocation loc, StringRef error)
Emit a general error that something can't be done.
Definition: CodeGenModule.cpp:952
clang::CodeGen::CodeGenModule::getLLVMContext
llvm::LLVMContext & getLLVMContext()
Definition: CodeGenModule.h:720
clang::CharUnits::getQuantity
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Definition: CharUnits.h:179
clang::SanitizerMask
Definition: Sanitizers.h:30
clang::CodeGen::CodeGenModule::mergeTBAAInfoForMemoryTransfer
TBAAAccessInfo mergeTBAAInfoForMemoryTransfer(TBAAAccessInfo DestInfo, TBAAAccessInfo SrcInfo)
mergeTBAAInfoForMemoryTransfer - Get merged TBAA information for the purposes of memory transfer call...
Definition: CodeGenModule.cpp:933
clang::CodeGen::CodeGenModule::EmitOMPRequiresDecl
void EmitOMPRequiresDecl(const OMPRequiresDecl *D)
Emit a code for requires directive.
Definition: CGDecl.cpp:2620
clang::ExplicitCastExpr
ExplicitCastExpr - An explicit cast written in the source code.
Definition: Expr.h:3695
clang::CodeGen::CodeGenModule::SetCommonAttributes
void SetCommonAttributes(GlobalDecl GD, llvm::GlobalValue *GV)
Set attributes which are common to any form of a global definition (alias, Objective-C method,...
Definition: CodeGenModule.cpp:1927
clang::CodeGen::CodeGenModule::EmitNullConstantForBase
llvm::Constant * EmitNullConstantForBase(const CXXRecordDecl *Record)
Return a null constant appropriate for zero-initializing a base class with the given type.
Definition: CGExprConstant.cpp:2337
clang::HeaderSearchOptions
HeaderSearchOptions - Helper class for storing options related to the initialization of the HeaderSea...
Definition: HeaderSearchOptions.h:68
clang::CodeGen::CGObjCRuntime
Implements runtime-specific code generation functions.
Definition: CGObjCRuntime.h:64
clang::CodeGen::CodeGenModule::getTypeDescriptorFromMap
llvm::Constant * getTypeDescriptorFromMap(QualType Ty)
Definition: CodeGenModule.h:687
clang::CodeGen::CodeGenModule::isInNoSanitizeList
bool isInNoSanitizeList(SanitizerMask Kind, llvm::Function *Fn, SourceLocation Loc) const
Definition: CodeGenModule.cpp:2603
clang::CodeGen::CodeGenModule::getTBAAStructInfo
llvm::MDNode * getTBAAStructInfo(QualType QTy)
Definition: CodeGenModule.cpp:899
clang::CodeGen::CodeGenModule::getTBAATypeInfo
llvm::MDNode * getTBAATypeInfo(QualType QTy)
getTBAATypeInfo - Get metadata used to describe accesses to objects of the given type.
Definition: CodeGenModule.cpp:867
clang::CodeGen::CodeGenModule::getExpressionLocationsEnabled
bool getExpressionLocationsEnabled() const
Return true if we should emit location information for expressions.
Definition: CodeGenModule.cpp:5268