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