clang  8.0.0svn
CodeGenModule.h
Go to the documentation of this file.
1 //===--- CodeGenModule.h - Per-Module state for LLVM CodeGen ----*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This is the internal per-translation-unit state used for llvm translation.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H
15 #define LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H
16 
17 #include "CGVTables.h"
18 #include "CodeGenTypeCache.h"
19 #include "CodeGenTypes.h"
20 #include "SanitizerMetadata.h"
21 #include "clang/AST/Attr.h"
22 #include "clang/AST/DeclCXX.h"
23 #include "clang/AST/DeclObjC.h"
24 #include "clang/AST/DeclOpenMP.h"
25 #include "clang/AST/GlobalDecl.h"
26 #include "clang/AST/Mangle.h"
27 #include "clang/Basic/ABI.h"
29 #include "clang/Basic/Module.h"
31 #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 ObjCMethodDecl;
58 class ObjCImplementationDecl;
59 class ObjCCategoryImplDecl;
60 class ObjCProtocolDecl;
61 class ObjCEncodeExpr;
62 class BlockExpr;
63 class CharUnits;
64 class Decl;
65 class Expr;
66 class Stmt;
67 class InitListExpr;
68 class StringLiteral;
69 class NamedDecl;
70 class ValueDecl;
71 class VarDecl;
72 class LangOptions;
73 class CodeGenOptions;
74 class HeaderSearchOptions;
75 class PreprocessorOptions;
76 class DiagnosticsEngine;
77 class AnnotateAttr;
78 class CXXDestructorDecl;
79 class Module;
80 class CoverageSourceInfo;
81 
82 namespace CodeGen {
83 
84 class CallArgList;
85 class CodeGenFunction;
86 class CodeGenTBAA;
87 class CGCXXABI;
88 class CGDebugInfo;
89 class CGObjCRuntime;
90 class CGOpenCLRuntime;
91 class CGOpenMPRuntime;
92 class CGCUDARuntime;
93 class BlockFieldFlags;
94 class FunctionArgList;
95 class CoverageMappingModuleGen;
96 class TargetCodeGenInfo;
97 
98 enum ForDefinition_t : bool {
101 };
102 
104  unsigned int priority;
105  unsigned int lex_order;
106  OrderGlobalInits(unsigned int p, unsigned int l)
107  : priority(p), lex_order(l) {}
108 
109  bool operator==(const OrderGlobalInits &RHS) const {
110  return priority == RHS.priority && lex_order == RHS.lex_order;
111  }
112 
113  bool operator<(const OrderGlobalInits &RHS) const {
114  return std::tie(priority, lex_order) <
115  std::tie(RHS.priority, RHS.lex_order);
116  }
117 };
118 
120  ObjCEntrypoints() { memset(this, 0, sizeof(*this)); }
121 
122  /// void objc_autoreleasePoolPop(void*);
123  llvm::Constant *objc_autoreleasePoolPop;
124 
125  /// void *objc_autoreleasePoolPush(void);
126  llvm::Constant *objc_autoreleasePoolPush;
127 
128  /// id objc_autorelease(id);
129  llvm::Constant *objc_autorelease;
130 
131  /// id objc_autoreleaseReturnValue(id);
133 
134  /// void objc_copyWeak(id *dest, id *src);
135  llvm::Constant *objc_copyWeak;
136 
137  /// void objc_destroyWeak(id*);
138  llvm::Constant *objc_destroyWeak;
139 
140  /// id objc_initWeak(id*, id);
141  llvm::Constant *objc_initWeak;
142 
143  /// id objc_loadWeak(id*);
144  llvm::Constant *objc_loadWeak;
145 
146  /// id objc_loadWeakRetained(id*);
147  llvm::Constant *objc_loadWeakRetained;
148 
149  /// void objc_moveWeak(id *dest, id *src);
150  llvm::Constant *objc_moveWeak;
151 
152  /// id objc_retain(id);
153  llvm::Constant *objc_retain;
154 
155  /// id objc_retainAutorelease(id);
156  llvm::Constant *objc_retainAutorelease;
157 
158  /// id objc_retainAutoreleaseReturnValue(id);
160 
161  /// id objc_retainAutoreleasedReturnValue(id);
163 
164  /// id objc_retainBlock(id);
165  llvm::Constant *objc_retainBlock;
166 
167  /// void objc_release(id);
168  llvm::Constant *objc_release;
169 
170  /// void objc_storeStrong(id*, id);
171  llvm::Constant *objc_storeStrong;
172 
173  /// id objc_storeWeak(id*, id);
174  llvm::Constant *objc_storeWeak;
175 
176  /// id objc_unsafeClaimAutoreleasedReturnValue(id);
178 
179  /// A void(void) inline asm to use to mark that the return value of
180  /// a call will be immediately retain.
182 
183  /// void clang.arc.use(...);
184  llvm::Constant *clang_arc_use;
185 };
186 
187 /// This class records statistics on instrumentation based profiling.
189  uint32_t VisitedInMainFile;
190  uint32_t MissingInMainFile;
191  uint32_t Visited;
192  uint32_t Missing;
193  uint32_t Mismatched;
194 
195 public:
197  : VisitedInMainFile(0), MissingInMainFile(0), Visited(0), Missing(0),
198  Mismatched(0) {}
199  /// Record that we've visited a function and whether or not that function was
200  /// in the main source file.
201  void addVisited(bool MainFile) {
202  if (MainFile)
203  ++VisitedInMainFile;
204  ++Visited;
205  }
206  /// Record that a function we've visited has no profile data.
207  void addMissing(bool MainFile) {
208  if (MainFile)
209  ++MissingInMainFile;
210  ++Missing;
211  }
212  /// Record that a function we've visited has mismatched profile data.
213  void addMismatched(bool MainFile) { ++Mismatched; }
214  /// Whether or not the stats we've gathered indicate any potential problems.
215  bool hasDiagnostics() { return Missing || Mismatched; }
216  /// Report potential problems we've found to \c Diags.
217  void reportDiagnostics(DiagnosticsEngine &Diags, StringRef MainFile);
218 };
219 
220 /// A pair of helper functions for a __block variable.
221 class BlockByrefHelpers : public llvm::FoldingSetNode {
222  // MSVC requires this type to be complete in order to process this
223  // header.
224 public:
225  llvm::Constant *CopyHelper;
226  llvm::Constant *DisposeHelper;
227 
228  /// The alignment of the field. This is important because
229  /// different offsets to the field within the byref struct need to
230  /// have different helper functions.
232 
233  BlockByrefHelpers(CharUnits alignment) : Alignment(alignment) {}
234  BlockByrefHelpers(const BlockByrefHelpers &) = default;
235  virtual ~BlockByrefHelpers();
236 
237  void Profile(llvm::FoldingSetNodeID &id) const {
238  id.AddInteger(Alignment.getQuantity());
239  profileImpl(id);
240  }
241  virtual void profileImpl(llvm::FoldingSetNodeID &id) const = 0;
242 
243  virtual bool needsCopy() const { return true; }
244  virtual void emitCopy(CodeGenFunction &CGF, Address dest, Address src) = 0;
245 
246  virtual bool needsDispose() const { return true; }
247  virtual void emitDispose(CodeGenFunction &CGF, Address field) = 0;
248 };
249 
250 /// This class organizes the cross-function state that is used while generating
251 /// LLVM code.
253  CodeGenModule(const CodeGenModule &) = delete;
254  void operator=(const CodeGenModule &) = delete;
255 
256 public:
257  struct Structor {
258  Structor() : Priority(0), Initializer(nullptr), AssociatedData(nullptr) {}
259  Structor(int Priority, llvm::Constant *Initializer,
260  llvm::Constant *AssociatedData)
261  : Priority(Priority), Initializer(Initializer),
262  AssociatedData(AssociatedData) {}
263  int Priority;
264  llvm::Constant *Initializer;
265  llvm::Constant *AssociatedData;
266  };
267 
268  typedef std::vector<Structor> CtorList;
269 
270 private:
271  ASTContext &Context;
272  const LangOptions &LangOpts;
273  const HeaderSearchOptions &HeaderSearchOpts; // Only used for debug info.
274  const PreprocessorOptions &PreprocessorOpts; // Only used for debug info.
275  const CodeGenOptions &CodeGenOpts;
276  llvm::Module &TheModule;
277  DiagnosticsEngine &Diags;
278  const TargetInfo &Target;
279  std::unique_ptr<CGCXXABI> ABI;
280  llvm::LLVMContext &VMContext;
281 
282  std::unique_ptr<CodeGenTBAA> TBAA;
283 
284  mutable std::unique_ptr<TargetCodeGenInfo> TheTargetCodeGenInfo;
285 
286  // This should not be moved earlier, since its initialization depends on some
287  // of the previous reference members being already initialized and also checks
288  // if TheTargetCodeGenInfo is NULL
289  CodeGenTypes Types;
290 
291  /// Holds information about C++ vtables.
292  CodeGenVTables VTables;
293 
294  std::unique_ptr<CGObjCRuntime> ObjCRuntime;
295  std::unique_ptr<CGOpenCLRuntime> OpenCLRuntime;
296  std::unique_ptr<CGOpenMPRuntime> OpenMPRuntime;
297  std::unique_ptr<CGCUDARuntime> CUDARuntime;
298  std::unique_ptr<CGDebugInfo> DebugInfo;
299  std::unique_ptr<ObjCEntrypoints> ObjCData;
300  llvm::MDNode *NoObjCARCExceptionsMetadata = nullptr;
301  std::unique_ptr<llvm::IndexedInstrProfReader> PGOReader;
302  InstrProfStats PGOStats;
303  std::unique_ptr<llvm::SanitizerStatReport> SanStats;
304 
305  // A set of references that have only been seen via a weakref so far. This is
306  // used to remove the weak of the reference if we ever see a direct reference
307  // or a definition.
308  llvm::SmallPtrSet<llvm::GlobalValue*, 10> WeakRefReferences;
309 
310  /// This contains all the decls which have definitions but/ which are deferred
311  /// for emission and therefore should only be output if they are actually
312  /// used. If a decl is in this, then it is known to have not been referenced
313  /// yet.
314  std::map<StringRef, GlobalDecl> DeferredDecls;
315 
316  /// This is a list of deferred decls which we have seen that *are* actually
317  /// referenced. These get code generated when the module is done.
318  std::vector<GlobalDecl> DeferredDeclsToEmit;
319  void addDeferredDeclToEmit(GlobalDecl GD) {
320  DeferredDeclsToEmit.emplace_back(GD);
321  }
322 
323  /// List of alias we have emitted. Used to make sure that what they point to
324  /// is defined once we get to the end of the of the translation unit.
325  std::vector<GlobalDecl> Aliases;
326 
327  /// List of multiversion functions that have to be emitted. Used to make sure
328  /// we properly emit the iFunc.
329  std::vector<GlobalDecl> MultiVersionFuncs;
330 
331  typedef llvm::StringMap<llvm::TrackingVH<llvm::Constant> > ReplacementsTy;
332  ReplacementsTy Replacements;
333 
334  /// List of global values to be replaced with something else. Used when we
335  /// want to replace a GlobalValue but can't identify it by its mangled name
336  /// anymore (because the name is already taken).
338  GlobalValReplacements;
339 
340  /// Set of global decls for which we already diagnosed mangled name conflict.
341  /// Required to not issue a warning (on a mangling conflict) multiple times
342  /// for the same decl.
343  llvm::DenseSet<GlobalDecl> DiagnosedConflictingDefinitions;
344 
345  /// A queue of (optional) vtables to consider emitting.
346  std::vector<const CXXRecordDecl*> DeferredVTables;
347 
348  /// A queue of (optional) vtables that may be emitted opportunistically.
349  std::vector<const CXXRecordDecl *> OpportunisticVTables;
350 
351  /// List of global values which are required to be present in the object file;
352  /// bitcast to i8*. This is used for forcing visibility of symbols which may
353  /// otherwise be optimized out.
354  std::vector<llvm::WeakTrackingVH> LLVMUsed;
355  std::vector<llvm::WeakTrackingVH> LLVMCompilerUsed;
356 
357  /// Store the list of global constructors and their respective priorities to
358  /// be emitted when the translation unit is complete.
359  CtorList GlobalCtors;
360 
361  /// Store the list of global destructors and their respective priorities to be
362  /// emitted when the translation unit is complete.
363  CtorList GlobalDtors;
364 
365  /// An ordered map of canonical GlobalDecls to their mangled names.
366  llvm::MapVector<GlobalDecl, StringRef> MangledDeclNames;
367  llvm::StringMap<GlobalDecl, llvm::BumpPtrAllocator> Manglings;
368 
369  // An ordered map of canonical GlobalDecls paired with the cpu-index for
370  // cpu-specific name manglings.
371  llvm::MapVector<std::pair<GlobalDecl, unsigned>, StringRef>
372  CPUSpecificMangledDeclNames;
373  llvm::StringMap<std::pair<GlobalDecl, unsigned>, llvm::BumpPtrAllocator>
374  CPUSpecificManglings;
375 
376  /// Global annotations.
377  std::vector<llvm::Constant*> Annotations;
378 
379  /// Map used to get unique annotation strings.
380  llvm::StringMap<llvm::Constant*> AnnotationStrings;
381 
382  llvm::StringMap<llvm::GlobalVariable *> CFConstantStringMap;
383 
384  llvm::DenseMap<llvm::Constant *, llvm::GlobalVariable *> ConstantStringMap;
385  llvm::DenseMap<const Decl*, llvm::Constant *> StaticLocalDeclMap;
386  llvm::DenseMap<const Decl*, llvm::GlobalVariable*> StaticLocalDeclGuardMap;
387  llvm::DenseMap<const Expr*, llvm::Constant *> MaterializedGlobalTemporaryMap;
388 
389  llvm::DenseMap<QualType, llvm::Constant *> AtomicSetterHelperFnMap;
390  llvm::DenseMap<QualType, llvm::Constant *> AtomicGetterHelperFnMap;
391 
392  /// Map used to get unique type descriptor constants for sanitizers.
393  llvm::DenseMap<QualType, llvm::Constant *> TypeDescriptorMap;
394 
395  /// Map used to track internal linkage functions declared within
396  /// extern "C" regions.
397  typedef llvm::MapVector<IdentifierInfo *,
398  llvm::GlobalValue *> StaticExternCMap;
399  StaticExternCMap StaticExternCValues;
400 
401  /// thread_local variables defined or used in this TU.
402  std::vector<const VarDecl *> CXXThreadLocals;
403 
404  /// thread_local variables with initializers that need to run
405  /// before any thread_local variable in this TU is odr-used.
406  std::vector<llvm::Function *> CXXThreadLocalInits;
407  std::vector<const VarDecl *> CXXThreadLocalInitVars;
408 
409  /// Global variables with initializers that need to run before main.
410  std::vector<llvm::Function *> CXXGlobalInits;
411 
412  /// When a C++ decl with an initializer is deferred, null is
413  /// appended to CXXGlobalInits, and the index of that null is placed
414  /// here so that the initializer will be performed in the correct
415  /// order. Once the decl is emitted, the index is replaced with ~0U to ensure
416  /// that we don't re-emit the initializer.
417  llvm::DenseMap<const Decl*, unsigned> DelayedCXXInitPosition;
418 
419  typedef std::pair<OrderGlobalInits, llvm::Function*> GlobalInitData;
420 
421  struct GlobalInitPriorityCmp {
422  bool operator()(const GlobalInitData &LHS,
423  const GlobalInitData &RHS) const {
424  return LHS.first.priority < RHS.first.priority;
425  }
426  };
427 
428  /// Global variables with initializers whose order of initialization is set by
429  /// init_priority attribute.
430  SmallVector<GlobalInitData, 8> PrioritizedCXXGlobalInits;
431 
432  /// Global destructor functions and arguments that need to run on termination.
433  std::vector<std::pair<llvm::WeakTrackingVH, llvm::Constant *>> CXXGlobalDtors;
434 
435  /// The complete set of modules that has been imported.
436  llvm::SetVector<clang::Module *> ImportedModules;
437 
438  /// The set of modules for which the module initializers
439  /// have been emitted.
440  llvm::SmallPtrSet<clang::Module *, 16> EmittedModuleInitializers;
441 
442  /// A vector of metadata strings.
443  SmallVector<llvm::MDNode *, 16> LinkerOptionsMetadata;
444 
445  /// @name Cache for Objective-C runtime types
446  /// @{
447 
448  /// Cached reference to the class for constant strings. This value has type
449  /// int * but is actually an Obj-C class pointer.
450  llvm::WeakTrackingVH CFConstantStringClassRef;
451 
452  /// The type used to describe the state of a fast enumeration in
453  /// Objective-C's for..in loop.
454  QualType ObjCFastEnumerationStateType;
455 
456  /// @}
457 
458  /// Lazily create the Objective-C runtime
459  void createObjCRuntime();
460 
461  void createOpenCLRuntime();
462  void createOpenMPRuntime();
463  void createCUDARuntime();
464 
465  bool isTriviallyRecursive(const FunctionDecl *F);
466  bool shouldEmitFunction(GlobalDecl GD);
467  bool shouldOpportunisticallyEmitVTables();
468  /// Map used to be sure we don't emit the same CompoundLiteral twice.
469  llvm::DenseMap<const CompoundLiteralExpr *, llvm::GlobalVariable *>
470  EmittedCompoundLiterals;
471 
472  /// Map of the global blocks we've emitted, so that we don't have to re-emit
473  /// them if the constexpr evaluator gets aggressive.
474  llvm::DenseMap<const BlockExpr *, llvm::Constant *> EmittedGlobalBlocks;
475 
476  /// @name Cache for Blocks Runtime Globals
477  /// @{
478 
479  llvm::Constant *NSConcreteGlobalBlock = nullptr;
480  llvm::Constant *NSConcreteStackBlock = nullptr;
481 
482  llvm::Constant *BlockObjectAssign = nullptr;
483  llvm::Constant *BlockObjectDispose = nullptr;
484 
485  llvm::Type *BlockDescriptorType = nullptr;
486  llvm::Type *GenericBlockLiteralType = nullptr;
487 
488  struct {
490  } Block;
491 
492  /// void @llvm.lifetime.start(i64 %size, i8* nocapture <ptr>)
493  llvm::Constant *LifetimeStartFn = nullptr;
494 
495  /// void @llvm.lifetime.end(i64 %size, i8* nocapture <ptr>)
496  llvm::Constant *LifetimeEndFn = nullptr;
497 
498  GlobalDecl initializedGlobalDecl;
499 
500  std::unique_ptr<SanitizerMetadata> SanitizerMD;
501 
502  /// @}
503 
504  llvm::MapVector<const Decl *, bool> DeferredEmptyCoverageMappingDecls;
505 
506  std::unique_ptr<CoverageMappingModuleGen> CoverageMapping;
507 
508  /// Mapping from canonical types to their metadata identifiers. We need to
509  /// maintain this mapping because identifiers may be formed from distinct
510  /// MDNodes.
511  typedef llvm::DenseMap<QualType, llvm::Metadata *> MetadataTypeMap;
512  MetadataTypeMap MetadataIdMap;
513  MetadataTypeMap VirtualMetadataIdMap;
514  MetadataTypeMap GeneralizedMetadataIdMap;
515 
516 public:
517  CodeGenModule(ASTContext &C, const HeaderSearchOptions &headersearchopts,
518  const PreprocessorOptions &ppopts,
519  const CodeGenOptions &CodeGenOpts, llvm::Module &M,
520  DiagnosticsEngine &Diags,
521  CoverageSourceInfo *CoverageInfo = nullptr);
522 
523  ~CodeGenModule();
524 
525  void clear();
526 
527  /// Finalize LLVM code generation.
528  void Release();
529 
530  /// Return true if we should emit location information for expressions.
531  bool getExpressionLocationsEnabled() const;
532 
533  /// Return a reference to the configured Objective-C runtime.
535  if (!ObjCRuntime) createObjCRuntime();
536  return *ObjCRuntime;
537  }
538 
539  /// Return true iff an Objective-C runtime has been configured.
540  bool hasObjCRuntime() { return !!ObjCRuntime; }
541 
542  /// Return a reference to the configured OpenCL runtime.
544  assert(OpenCLRuntime != nullptr);
545  return *OpenCLRuntime;
546  }
547 
548  /// Return a reference to the configured OpenMP runtime.
550  assert(OpenMPRuntime != nullptr);
551  return *OpenMPRuntime;
552  }
553 
554  /// Return a reference to the configured CUDA runtime.
556  assert(CUDARuntime != nullptr);
557  return *CUDARuntime;
558  }
559 
561  assert(ObjCData != nullptr);
562  return *ObjCData;
563  }
564 
565  // Version checking function, used to implement ObjC's @available:
566  // i32 @__isOSVersionAtLeast(i32, i32, i32)
567  llvm::Constant *IsOSVersionAtLeastFn = nullptr;
568 
569  InstrProfStats &getPGOStats() { return PGOStats; }
570  llvm::IndexedInstrProfReader *getPGOReader() const { return PGOReader.get(); }
571 
573  return CoverageMapping.get();
574  }
575 
576  llvm::Constant *getStaticLocalDeclAddress(const VarDecl *D) {
577  return StaticLocalDeclMap[D];
578  }
580  llvm::Constant *C) {
581  StaticLocalDeclMap[D] = C;
582  }
583 
584  llvm::Constant *
585  getOrCreateStaticVarDecl(const VarDecl &D,
586  llvm::GlobalValue::LinkageTypes Linkage);
587 
588  llvm::GlobalVariable *getStaticLocalDeclGuardAddress(const VarDecl *D) {
589  return StaticLocalDeclGuardMap[D];
590  }
592  llvm::GlobalVariable *C) {
593  StaticLocalDeclGuardMap[D] = C;
594  }
595 
596  bool lookupRepresentativeDecl(StringRef MangledName,
597  GlobalDecl &Result) const;
598 
599  llvm::Constant *getAtomicSetterHelperFnMap(QualType Ty) {
600  return AtomicSetterHelperFnMap[Ty];
601  }
603  llvm::Constant *Fn) {
604  AtomicSetterHelperFnMap[Ty] = Fn;
605  }
606 
607  llvm::Constant *getAtomicGetterHelperFnMap(QualType Ty) {
608  return AtomicGetterHelperFnMap[Ty];
609  }
611  llvm::Constant *Fn) {
612  AtomicGetterHelperFnMap[Ty] = Fn;
613  }
614 
615  llvm::Constant *getTypeDescriptorFromMap(QualType Ty) {
616  return TypeDescriptorMap[Ty];
617  }
618  void setTypeDescriptorInMap(QualType Ty, llvm::Constant *C) {
619  TypeDescriptorMap[Ty] = C;
620  }
621 
622  CGDebugInfo *getModuleDebugInfo() { return DebugInfo.get(); }
623 
625  if (!NoObjCARCExceptionsMetadata)
626  NoObjCARCExceptionsMetadata = llvm::MDNode::get(getLLVMContext(), None);
627  return NoObjCARCExceptionsMetadata;
628  }
629 
630  ASTContext &getContext() const { return Context; }
631  const LangOptions &getLangOpts() const { return LangOpts; }
633  const { return HeaderSearchOpts; }
635  const { return PreprocessorOpts; }
636  const CodeGenOptions &getCodeGenOpts() const { return CodeGenOpts; }
637  llvm::Module &getModule() const { return TheModule; }
638  DiagnosticsEngine &getDiags() const { return Diags; }
639  const llvm::DataLayout &getDataLayout() const {
640  return TheModule.getDataLayout();
641  }
642  const TargetInfo &getTarget() const { return Target; }
643  const llvm::Triple &getTriple() const { return Target.getTriple(); }
644  bool supportsCOMDAT() const;
645  void maybeSetTrivialComdat(const Decl &D, llvm::GlobalObject &GO);
646 
647  CGCXXABI &getCXXABI() const { return *ABI; }
648  llvm::LLVMContext &getLLVMContext() { return VMContext; }
649 
650  bool shouldUseTBAA() const { return TBAA != nullptr; }
651 
652  const TargetCodeGenInfo &getTargetCodeGenInfo();
653 
654  CodeGenTypes &getTypes() { return Types; }
655 
656  CodeGenVTables &getVTables() { return VTables; }
657 
659  return VTables.getItaniumVTableContext();
660  }
661 
663  return VTables.getMicrosoftVTableContext();
664  }
665 
666  CtorList &getGlobalCtors() { return GlobalCtors; }
667  CtorList &getGlobalDtors() { return GlobalDtors; }
668 
669  /// getTBAATypeInfo - Get metadata used to describe accesses to objects of
670  /// the given type.
671  llvm::MDNode *getTBAATypeInfo(QualType QTy);
672 
673  /// getTBAAAccessInfo - Get TBAA information that describes an access to
674  /// an object of the given type.
675  TBAAAccessInfo getTBAAAccessInfo(QualType AccessType);
676 
677  /// getTBAAVTablePtrAccessInfo - Get the TBAA information that describes an
678  /// access to a virtual table pointer.
679  TBAAAccessInfo getTBAAVTablePtrAccessInfo(llvm::Type *VTablePtrType);
680 
681  llvm::MDNode *getTBAAStructInfo(QualType QTy);
682 
683  /// getTBAABaseTypeInfo - Get metadata that describes the given base access
684  /// type. Return null if the type is not suitable for use in TBAA access tags.
685  llvm::MDNode *getTBAABaseTypeInfo(QualType QTy);
686 
687  /// getTBAAAccessTagInfo - Get TBAA tag for a given memory access.
688  llvm::MDNode *getTBAAAccessTagInfo(TBAAAccessInfo Info);
689 
690  /// mergeTBAAInfoForCast - Get merged TBAA information for the purposes of
691  /// type casts.
692  TBAAAccessInfo mergeTBAAInfoForCast(TBAAAccessInfo SourceInfo,
694 
695  /// mergeTBAAInfoForConditionalOperator - Get merged TBAA information for the
696  /// purposes of conditional operator.
697  TBAAAccessInfo mergeTBAAInfoForConditionalOperator(TBAAAccessInfo InfoA,
698  TBAAAccessInfo InfoB);
699 
700  /// mergeTBAAInfoForMemoryTransfer - Get merged TBAA information for the
701  /// purposes of memory transfer calls.
702  TBAAAccessInfo mergeTBAAInfoForMemoryTransfer(TBAAAccessInfo DestInfo,
703  TBAAAccessInfo SrcInfo);
704 
705  /// getTBAAInfoForSubobject - Get TBAA information for an access with a given
706  /// base lvalue.
708  if (Base.getTBAAInfo().isMayAlias())
709  return TBAAAccessInfo::getMayAliasInfo();
710  return getTBAAAccessInfo(AccessType);
711  }
712 
713  bool isTypeConstant(QualType QTy, bool ExcludeCtorDtor);
714 
715  bool isPaddedAtomicType(QualType type);
716  bool isPaddedAtomicType(const AtomicType *type);
717 
718  /// DecorateInstructionWithTBAA - Decorate the instruction with a TBAA tag.
719  void DecorateInstructionWithTBAA(llvm::Instruction *Inst,
720  TBAAAccessInfo TBAAInfo);
721 
722  /// Adds !invariant.barrier !tag to instruction
723  void DecorateInstructionWithInvariantGroup(llvm::Instruction *I,
724  const CXXRecordDecl *RD);
725 
726  /// Emit the given number of characters as a value of type size_t.
727  llvm::ConstantInt *getSize(CharUnits numChars);
728 
729  /// Set the visibility for the given LLVM GlobalValue.
730  void setGlobalVisibility(llvm::GlobalValue *GV, const NamedDecl *D) const;
731 
732  void setGlobalVisibilityAndLocal(llvm::GlobalValue *GV,
733  const NamedDecl *D) const;
734 
735  void setDSOLocal(llvm::GlobalValue *GV) const;
736 
737  void setDLLImportDLLExport(llvm::GlobalValue *GV, GlobalDecl D) const;
738  void setDLLImportDLLExport(llvm::GlobalValue *GV, const NamedDecl *D) const;
739  /// Set visibility, dllimport/dllexport and dso_local.
740  /// This must be called after dllimport/dllexport is set.
741  void setGVProperties(llvm::GlobalValue *GV, GlobalDecl GD) const;
742  void setGVProperties(llvm::GlobalValue *GV, const NamedDecl *D) const;
743 
744  /// Set the TLS mode for the given LLVM GlobalValue for the thread-local
745  /// variable declaration D.
746  void setTLSMode(llvm::GlobalValue *GV, const VarDecl &D) const;
747 
748  static llvm::GlobalValue::VisibilityTypes GetLLVMVisibility(Visibility V) {
749  switch (V) {
753  }
754  llvm_unreachable("unknown visibility!");
755  }
756 
757  llvm::Constant *GetAddrOfGlobal(GlobalDecl GD,
758  ForDefinition_t IsForDefinition
759  = NotForDefinition);
760 
761  /// Will return a global variable of the given type. If a variable with a
762  /// different type already exists then a new variable with the right type
763  /// will be created and all uses of the old variable will be replaced with a
764  /// bitcast to the new variable.
765  llvm::GlobalVariable *
766  CreateOrReplaceCXXRuntimeVariable(StringRef Name, llvm::Type *Ty,
767  llvm::GlobalValue::LinkageTypes Linkage,
768  unsigned Alignment);
769 
770  llvm::Function *
771  CreateGlobalInitOrDestructFunction(llvm::FunctionType *ty, const Twine &name,
772  const CGFunctionInfo &FI,
774  bool TLS = false);
775 
776  /// Return the AST address space of the underlying global variable for D, as
777  /// determined by its declaration. Normally this is the same as the address
778  /// space of D's type, but in CUDA, address spaces are associated with
779  /// declarations, not types. If D is nullptr, return the default address
780  /// space for global variable.
781  ///
782  /// For languages without explicit address spaces, if D has default address
783  /// space, target-specific global or constant address space may be returned.
784  LangAS GetGlobalVarAddressSpace(const VarDecl *D);
785 
786  /// Return the llvm::Constant for the address of the given global variable.
787  /// If Ty is non-null and if the global doesn't exist, then it will be created
788  /// with the specified type instead of whatever the normal requested type
789  /// would be. If IsForDefinition is true, it is guaranteed that an actual
790  /// global with type Ty will be returned, not conversion of a variable with
791  /// the same mangled name but some other type.
792  llvm::Constant *GetAddrOfGlobalVar(const VarDecl *D,
793  llvm::Type *Ty = nullptr,
794  ForDefinition_t IsForDefinition
795  = NotForDefinition);
796 
797  /// Return the AST address space of string literal, which is used to emit
798  /// the string literal as global variable in LLVM IR.
799  /// Note: This is not necessarily the address space of the string literal
800  /// in AST. For address space agnostic language, e.g. C++, string literal
801  /// in AST is always in default address space.
802  LangAS getStringLiteralAddressSpace() const;
803 
804  /// Return the address of the given function. If Ty is non-null, then this
805  /// function will use the specified type if it has to create it.
806  llvm::Constant *GetAddrOfFunction(GlobalDecl GD, llvm::Type *Ty = nullptr,
807  bool ForVTable = false,
808  bool DontDefer = false,
809  ForDefinition_t IsForDefinition
810  = NotForDefinition);
811 
812  /// Get the address of the RTTI descriptor for the given type.
813  llvm::Constant *GetAddrOfRTTIDescriptor(QualType Ty, bool ForEH = false);
814 
815  /// Get the address of a uuid descriptor .
816  ConstantAddress GetAddrOfUuidDescriptor(const CXXUuidofExpr* E);
817 
818  /// Get the address of the thunk for the given global decl.
819  llvm::Constant *GetAddrOfThunk(StringRef Name, llvm::Type *FnTy,
820  GlobalDecl GD);
821 
822  /// Get a reference to the target of VD.
823  ConstantAddress GetWeakRefReference(const ValueDecl *VD);
824 
825  /// Returns the assumed alignment of an opaque pointer to the given class.
826  CharUnits getClassPointerAlignment(const CXXRecordDecl *CD);
827 
828  /// Returns the assumed alignment of a virtual base of a class.
829  CharUnits getVBaseAlignment(CharUnits DerivedAlign,
830  const CXXRecordDecl *Derived,
831  const CXXRecordDecl *VBase);
832 
833  /// Given a class pointer with an actual known alignment, and the
834  /// expected alignment of an object at a dynamic offset w.r.t that
835  /// pointer, return the alignment to assume at the offset.
836  CharUnits getDynamicOffsetAlignment(CharUnits ActualAlign,
837  const CXXRecordDecl *Class,
838  CharUnits ExpectedTargetAlign);
839 
840  CharUnits
841  computeNonVirtualBaseClassOffset(const CXXRecordDecl *DerivedClass,
844 
845  /// Returns the offset from a derived class to a class. Returns null if the
846  /// offset is 0.
847  llvm::Constant *
848  GetNonVirtualBaseClassOffset(const CXXRecordDecl *ClassDecl,
851 
852  llvm::FoldingSet<BlockByrefHelpers> ByrefHelpersCache;
853 
854  /// Fetches the global unique block count.
855  int getUniqueBlockCount() { return ++Block.GlobalUniqueCount; }
856 
857  /// Fetches the type of a generic block descriptor.
858  llvm::Type *getBlockDescriptorType();
859 
860  /// The type of a generic block literal.
861  llvm::Type *getGenericBlockLiteralType();
862 
863  /// Gets the address of a block which requires no captures.
864  llvm::Constant *GetAddrOfGlobalBlock(const BlockExpr *BE, StringRef Name);
865 
866  /// Returns the address of a block which requires no caputres, or null if
867  /// we've yet to emit the block for BE.
868  llvm::Constant *getAddrOfGlobalBlockIfEmitted(const BlockExpr *BE) {
869  return EmittedGlobalBlocks.lookup(BE);
870  }
871 
872  /// Notes that BE's global block is available via Addr. Asserts that BE
873  /// isn't already emitted.
874  void setAddrOfGlobalBlock(const BlockExpr *BE, llvm::Constant *Addr);
875 
876  /// Return a pointer to a constant CFString object for the given string.
877  ConstantAddress GetAddrOfConstantCFString(const StringLiteral *Literal);
878 
879  /// Return a pointer to a constant NSString object for the given string. Or a
880  /// user defined String object as defined via
881  /// -fconstant-string-class=class_name option.
882  ConstantAddress GetAddrOfConstantString(const StringLiteral *Literal);
883 
884  /// Return a constant array for the given string.
885  llvm::Constant *GetConstantArrayFromStringLiteral(const StringLiteral *E);
886 
887  /// Return a pointer to a constant array for the given string literal.
889  GetAddrOfConstantStringFromLiteral(const StringLiteral *S,
890  StringRef Name = ".str");
891 
892  /// Return a pointer to a constant array for the given ObjCEncodeExpr node.
894  GetAddrOfConstantStringFromObjCEncode(const ObjCEncodeExpr *);
895 
896  /// Returns a pointer to a character array containing the literal and a
897  /// terminating '\0' character. The result has pointer to array type.
898  ///
899  /// \param GlobalName If provided, the name to use for the global (if one is
900  /// created).
902  GetAddrOfConstantCString(const std::string &Str,
903  const char *GlobalName = nullptr);
904 
905  /// Returns a pointer to a constant global variable for the given file-scope
906  /// compound literal expression.
907  ConstantAddress GetAddrOfConstantCompoundLiteral(const CompoundLiteralExpr*E);
908 
909  /// If it's been emitted already, returns the GlobalVariable corresponding to
910  /// a compound literal. Otherwise, returns null.
911  llvm::GlobalVariable *
912  getAddrOfConstantCompoundLiteralIfEmitted(const CompoundLiteralExpr *E);
913 
914  /// Notes that CLE's GlobalVariable is GV. Asserts that CLE isn't already
915  /// emitted.
916  void setAddrOfConstantCompoundLiteral(const CompoundLiteralExpr *CLE,
917  llvm::GlobalVariable *GV);
918 
919  /// Returns a pointer to a global variable representing a temporary
920  /// with static or thread storage duration.
921  ConstantAddress GetAddrOfGlobalTemporary(const MaterializeTemporaryExpr *E,
922  const Expr *Inner);
923 
924  /// Retrieve the record type that describes the state of an
925  /// Objective-C fast enumeration loop (for..in).
926  QualType getObjCFastEnumerationStateType();
927 
928  // Produce code for this constructor/destructor. This method doesn't try
929  // to apply any ABI rules about which other constructors/destructors
930  // are needed or if they are alias to each other.
931  llvm::Function *codegenCXXStructor(const CXXMethodDecl *MD,
933 
934  /// Return the address of the constructor/destructor of the given type.
935  llvm::Constant *
936  getAddrOfCXXStructor(const CXXMethodDecl *MD, StructorType Type,
937  const CGFunctionInfo *FnInfo = nullptr,
938  llvm::FunctionType *FnType = nullptr,
939  bool DontDefer = false,
940  ForDefinition_t IsForDefinition = NotForDefinition);
941 
942  /// Given a builtin id for a function like "__builtin_fabsf", return a
943  /// Function* for "fabsf".
944  llvm::Constant *getBuiltinLibFunction(const FunctionDecl *FD,
945  unsigned BuiltinID);
946 
947  llvm::Function *getIntrinsic(unsigned IID, ArrayRef<llvm::Type*> Tys = None);
948 
949  /// Emit code for a single top level declaration.
950  void EmitTopLevelDecl(Decl *D);
951 
952  /// Stored a deferred empty coverage mapping for an unused
953  /// and thus uninstrumented top level declaration.
954  void AddDeferredUnusedCoverageMapping(Decl *D);
955 
956  /// Remove the deferred empty coverage mapping as this
957  /// declaration is actually instrumented.
958  void ClearUnusedCoverageMapping(const Decl *D);
959 
960  /// Emit all the deferred coverage mappings
961  /// for the uninstrumented functions.
962  void EmitDeferredUnusedCoverageMappings();
963 
964  /// Tell the consumer that this variable has been instantiated.
965  void HandleCXXStaticMemberVarInstantiation(VarDecl *VD);
966 
967  /// If the declaration has internal linkage but is inside an
968  /// extern "C" linkage specification, prepare to emit an alias for it
969  /// to the expected name.
970  template<typename SomeDecl>
971  void MaybeHandleStaticInExternC(const SomeDecl *D, llvm::GlobalValue *GV);
972 
973  /// Add a global to a list to be added to the llvm.used metadata.
974  void addUsedGlobal(llvm::GlobalValue *GV);
975 
976  /// Add a global to a list to be added to the llvm.compiler.used metadata.
977  void addCompilerUsedGlobal(llvm::GlobalValue *GV);
978 
979  /// Add a destructor and object to add to the C++ global destructor function.
980  void AddCXXDtorEntry(llvm::Constant *DtorFn, llvm::Constant *Object) {
981  CXXGlobalDtors.emplace_back(DtorFn, Object);
982  }
983 
984  /// Create a new runtime function with the specified type and name.
985  llvm::Constant *
986  CreateRuntimeFunction(llvm::FunctionType *Ty, StringRef Name,
987  llvm::AttributeList ExtraAttrs = llvm::AttributeList(),
988  bool Local = false);
989 
990  /// Create a new compiler builtin function with the specified type and name.
991  llvm::Constant *
992  CreateBuiltinFunction(llvm::FunctionType *Ty, StringRef Name,
993  llvm::AttributeList ExtraAttrs = llvm::AttributeList());
994  /// Create a new runtime global variable with the specified type and name.
995  llvm::Constant *CreateRuntimeVariable(llvm::Type *Ty,
996  StringRef Name);
997 
998  ///@name Custom Blocks Runtime Interfaces
999  ///@{
1000 
1001  llvm::Constant *getNSConcreteGlobalBlock();
1002  llvm::Constant *getNSConcreteStackBlock();
1003  llvm::Constant *getBlockObjectAssign();
1004  llvm::Constant *getBlockObjectDispose();
1005 
1006  ///@}
1007 
1008  llvm::Constant *getLLVMLifetimeStartFn();
1009  llvm::Constant *getLLVMLifetimeEndFn();
1010 
1011  // Make sure that this type is translated.
1012  void UpdateCompletedType(const TagDecl *TD);
1013 
1014  llvm::Constant *getMemberPointerConstant(const UnaryOperator *e);
1015 
1016  /// Emit type info if type of an expression is a variably modified
1017  /// type. Also emit proper debug info for cast types.
1018  void EmitExplicitCastExprType(const ExplicitCastExpr *E,
1019  CodeGenFunction *CGF = nullptr);
1020 
1021  /// Return the result of value-initializing the given type, i.e. a null
1022  /// expression of the given type. This is usually, but not always, an LLVM
1023  /// null constant.
1024  llvm::Constant *EmitNullConstant(QualType T);
1025 
1026  /// Return a null constant appropriate for zero-initializing a base class with
1027  /// the given type. This is usually, but not always, an LLVM null constant.
1028  llvm::Constant *EmitNullConstantForBase(const CXXRecordDecl *Record);
1029 
1030  /// Emit a general error that something can't be done.
1031  void Error(SourceLocation loc, StringRef error);
1032 
1033  /// Print out an error that codegen doesn't support the specified stmt yet.
1034  void ErrorUnsupported(const Stmt *S, const char *Type);
1035 
1036  /// Print out an error that codegen doesn't support the specified decl yet.
1037  void ErrorUnsupported(const Decl *D, const char *Type);
1038 
1039  /// Set the attributes on the LLVM function for the given decl and function
1040  /// info. This applies attributes necessary for handling the ABI as well as
1041  /// user specified attributes like section.
1042  void SetInternalFunctionAttributes(GlobalDecl GD, llvm::Function *F,
1043  const CGFunctionInfo &FI);
1044 
1045  /// Set the LLVM function attributes (sext, zext, etc).
1046  void SetLLVMFunctionAttributes(const Decl *D,
1047  const CGFunctionInfo &Info,
1048  llvm::Function *F);
1049 
1050  /// Set the LLVM function attributes which only apply to a function
1051  /// definition.
1052  void SetLLVMFunctionAttributesForDefinition(const Decl *D, llvm::Function *F);
1053 
1054  /// Return true iff the given type uses 'sret' when used as a return type.
1055  bool ReturnTypeUsesSRet(const CGFunctionInfo &FI);
1056 
1057  /// Return true iff the given type uses an argument slot when 'sret' is used
1058  /// as a return type.
1059  bool ReturnSlotInterferesWithArgs(const CGFunctionInfo &FI);
1060 
1061  /// Return true iff the given type uses 'fpret' when used as a return type.
1062  bool ReturnTypeUsesFPRet(QualType ResultType);
1063 
1064  /// Return true iff the given type uses 'fp2ret' when used as a return type.
1065  bool ReturnTypeUsesFP2Ret(QualType ResultType);
1066 
1067  /// Get the LLVM attributes and calling convention to use for a particular
1068  /// function type.
1069  ///
1070  /// \param Name - The function name.
1071  /// \param Info - The function type information.
1072  /// \param CalleeInfo - The callee information these attributes are being
1073  /// constructed for. If valid, the attributes applied to this decl may
1074  /// contribute to the function attributes and calling convention.
1075  /// \param Attrs [out] - On return, the attribute list to use.
1076  /// \param CallingConv [out] - On return, the LLVM calling convention to use.
1077  void ConstructAttributeList(StringRef Name, const CGFunctionInfo &Info,
1078  CGCalleeInfo CalleeInfo,
1079  llvm::AttributeList &Attrs, unsigned &CallingConv,
1080  bool AttrOnCallSite);
1081 
1082  /// Adds attributes to F according to our CodeGenOptions and LangOptions, as
1083  /// though we had emitted it ourselves. We remove any attributes on F that
1084  /// conflict with the attributes we add here.
1085  ///
1086  /// This is useful for adding attrs to bitcode modules that you want to link
1087  /// with but don't control, such as CUDA's libdevice. When linking with such
1088  /// a bitcode library, you might want to set e.g. its functions'
1089  /// "unsafe-fp-math" attribute to match the attr of the functions you're
1090  /// codegen'ing. Otherwise, LLVM will interpret the bitcode module's lack of
1091  /// unsafe-fp-math attrs as tantamount to unsafe-fp-math=false, and then LLVM
1092  /// will propagate unsafe-fp-math=false up to every transitive caller of a
1093  /// function in the bitcode library!
1094  ///
1095  /// With the exception of fast-math attrs, this will only make the attributes
1096  /// on the function more conservative. But it's unsafe to call this on a
1097  /// function which relies on particular fast-math attributes for correctness.
1098  /// It's up to you to ensure that this is safe.
1099  void AddDefaultFnAttrs(llvm::Function &F);
1100 
1101  /// Parses the target attributes passed in, and returns only the ones that are
1102  /// valid feature names.
1103  TargetAttr::ParsedTargetAttr filterFunctionTargetAttrs(const TargetAttr *TD);
1104 
1105  // Fills in the supplied string map with the set of target features for the
1106  // passed in function.
1107  void getFunctionFeatureMap(llvm::StringMap<bool> &FeatureMap,
1108  const FunctionDecl *FD);
1109 
1110  StringRef getMangledName(GlobalDecl GD);
1111  StringRef getBlockMangledName(GlobalDecl GD, const BlockDecl *BD);
1112 
1113  void EmitTentativeDefinition(const VarDecl *D);
1114 
1115  void EmitVTable(CXXRecordDecl *Class);
1116 
1117  void RefreshTypeCacheForClass(const CXXRecordDecl *Class);
1118 
1119  /// Appends Opts to the "llvm.linker.options" metadata value.
1120  void AppendLinkerOptions(StringRef Opts);
1121 
1122  /// Appends a detect mismatch command to the linker options.
1123  void AddDetectMismatch(StringRef Name, StringRef Value);
1124 
1125  /// Appends a dependent lib to the "llvm.linker.options" metadata
1126  /// value.
1127  void AddDependentLib(StringRef Lib);
1128 
1129  void AddELFLibDirective(StringRef Lib);
1130 
1131  llvm::GlobalVariable::LinkageTypes getFunctionLinkage(GlobalDecl GD);
1132 
1133  void setFunctionLinkage(GlobalDecl GD, llvm::Function *F) {
1134  F->setLinkage(getFunctionLinkage(GD));
1135  }
1136 
1137  /// Return the appropriate linkage for the vtable, VTT, and type information
1138  /// of the given class.
1139  llvm::GlobalVariable::LinkageTypes getVTableLinkage(const CXXRecordDecl *RD);
1140 
1141  /// Return the store size, in character units, of the given LLVM type.
1142  CharUnits GetTargetTypeStoreSize(llvm::Type *Ty) const;
1143 
1144  /// Returns LLVM linkage for a declarator.
1145  llvm::GlobalValue::LinkageTypes
1146  getLLVMLinkageForDeclarator(const DeclaratorDecl *D, GVALinkage Linkage,
1147  bool IsConstantVariable);
1148 
1149  /// Returns LLVM linkage for a declarator.
1150  llvm::GlobalValue::LinkageTypes
1151  getLLVMLinkageVarDefinition(const VarDecl *VD, bool IsConstant);
1152 
1153  /// Emit all the global annotations.
1154  void EmitGlobalAnnotations();
1155 
1156  /// Emit an annotation string.
1157  llvm::Constant *EmitAnnotationString(StringRef Str);
1158 
1159  /// Emit the annotation's translation unit.
1160  llvm::Constant *EmitAnnotationUnit(SourceLocation Loc);
1161 
1162  /// Emit the annotation line number.
1163  llvm::Constant *EmitAnnotationLineNo(SourceLocation L);
1164 
1165  /// Generate the llvm::ConstantStruct which contains the annotation
1166  /// information for a given GlobalValue. The annotation struct is
1167  /// {i8 *, i8 *, i8 *, i32}. The first field is a constant expression, the
1168  /// GlobalValue being annotated. The second field is the constant string
1169  /// created from the AnnotateAttr's annotation. The third field is a constant
1170  /// string containing the name of the translation unit. The fourth field is
1171  /// the line number in the file of the annotated value declaration.
1172  llvm::Constant *EmitAnnotateAttr(llvm::GlobalValue *GV,
1173  const AnnotateAttr *AA,
1174  SourceLocation L);
1175 
1176  /// Add global annotations that are set on D, for the global GV. Those
1177  /// annotations are emitted during finalization of the LLVM code.
1178  void AddGlobalAnnotations(const ValueDecl *D, llvm::GlobalValue *GV);
1179 
1180  bool isInSanitizerBlacklist(SanitizerMask Kind, llvm::Function *Fn,
1181  SourceLocation Loc) const;
1182 
1183  bool isInSanitizerBlacklist(llvm::GlobalVariable *GV, SourceLocation Loc,
1184  QualType Ty,
1185  StringRef Category = StringRef()) const;
1186 
1187  /// Imbue XRay attributes to a function, applying the always/never attribute
1188  /// lists in the process. Returns true if we did imbue attributes this way,
1189  /// false otherwise.
1190  bool imbueXRayAttrs(llvm::Function *Fn, SourceLocation Loc,
1191  StringRef Category = StringRef()) const;
1192 
1194  return SanitizerMD.get();
1195  }
1196 
1198  DeferredVTables.push_back(RD);
1199  }
1200 
1201  /// Emit code for a single global function or var decl. Forward declarations
1202  /// are emitted lazily.
1203  void EmitGlobal(GlobalDecl D);
1204 
1205  bool TryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D);
1206 
1207  llvm::GlobalValue *GetGlobalValue(StringRef Ref);
1208 
1209  /// Set attributes which are common to any form of a global definition (alias,
1210  /// Objective-C method, function, global variable).
1211  ///
1212  /// NOTE: This should only be called for definitions.
1213  void SetCommonAttributes(GlobalDecl GD, llvm::GlobalValue *GV);
1214 
1215  void addReplacement(StringRef Name, llvm::Constant *C);
1216 
1217  void addGlobalValReplacement(llvm::GlobalValue *GV, llvm::Constant *C);
1218 
1219  /// Emit a code for threadprivate directive.
1220  /// \param D Threadprivate declaration.
1221  void EmitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D);
1222 
1223  /// Emit a code for declare reduction construct.
1224  void EmitOMPDeclareReduction(const OMPDeclareReductionDecl *D,
1225  CodeGenFunction *CGF = nullptr);
1226 
1227  /// Returns whether the given record has hidden LTO visibility and therefore
1228  /// may participate in (single-module) CFI and whole-program vtable
1229  /// optimization.
1230  bool HasHiddenLTOVisibility(const CXXRecordDecl *RD);
1231 
1232  /// Emit type metadata for the given vtable using the given layout.
1233  void EmitVTableTypeMetadata(llvm::GlobalVariable *VTable,
1234  const VTableLayout &VTLayout);
1235 
1236  /// Generate a cross-DSO type identifier for MD.
1237  llvm::ConstantInt *CreateCrossDsoCfiTypeId(llvm::Metadata *MD);
1238 
1239  /// Create a metadata identifier for the given type. This may either be an
1240  /// MDString (for external identifiers) or a distinct unnamed MDNode (for
1241  /// internal identifiers).
1242  llvm::Metadata *CreateMetadataIdentifierForType(QualType T);
1243 
1244  /// Create a metadata identifier that is intended to be used to check virtual
1245  /// calls via a member function pointer.
1246  llvm::Metadata *CreateMetadataIdentifierForVirtualMemPtrType(QualType T);
1247 
1248  /// Create a metadata identifier for the generalization of the given type.
1249  /// This may either be an MDString (for external identifiers) or a distinct
1250  /// unnamed MDNode (for internal identifiers).
1251  llvm::Metadata *CreateMetadataIdentifierGeneralized(QualType T);
1252 
1253  /// Create and attach type metadata to the given function.
1254  void CreateFunctionTypeMetadataForIcall(const FunctionDecl *FD,
1255  llvm::Function *F);
1256 
1257  /// Returns whether this module needs the "all-vtables" type identifier.
1258  bool NeedAllVtablesTypeId() const;
1259 
1260  /// Create and attach type metadata for the given vtable.
1261  void AddVTableTypeMetadata(llvm::GlobalVariable *VTable, CharUnits Offset,
1262  const CXXRecordDecl *RD);
1263 
1264  /// Return a vector of most-base classes for RD. This is used to implement
1265  /// control flow integrity checks for member function pointers.
1266  ///
1267  /// A most-base class of a class C is defined as a recursive base class of C,
1268  /// including C itself, that does not have any bases.
1269  std::vector<const CXXRecordDecl *>
1270  getMostBaseClasses(const CXXRecordDecl *RD);
1271 
1272  /// Get the declaration of std::terminate for the platform.
1273  llvm::Constant *getTerminateFn();
1274 
1275  llvm::SanitizerStatReport &getSanStats();
1276 
1277  llvm::Value *
1278  createOpenCLIntToSamplerConversion(const Expr *E, CodeGenFunction &CGF);
1279 
1280  /// Get target specific null pointer.
1281  /// \param T is the LLVM type of the null pointer.
1282  /// \param QT is the clang QualType of the null pointer.
1283  llvm::Constant *getNullPointer(llvm::PointerType *T, QualType QT);
1284 
1285 private:
1286  llvm::Constant *GetOrCreateLLVMFunction(
1287  StringRef MangledName, llvm::Type *Ty, GlobalDecl D, bool ForVTable,
1288  bool DontDefer = false, bool IsThunk = false,
1289  llvm::AttributeList ExtraAttrs = llvm::AttributeList(),
1290  ForDefinition_t IsForDefinition = NotForDefinition);
1291 
1292  llvm::Constant *GetOrCreateMultiVersionIFunc(GlobalDecl GD,
1293  llvm::Type *DeclTy,
1294  const FunctionDecl *FD);
1295  void UpdateMultiVersionNames(GlobalDecl GD, const FunctionDecl *FD);
1296 
1297  llvm::Constant *GetOrCreateLLVMGlobal(StringRef MangledName,
1298  llvm::PointerType *PTy,
1299  const VarDecl *D,
1300  ForDefinition_t IsForDefinition
1301  = NotForDefinition);
1302 
1303  bool GetCPUAndFeaturesAttributes(const Decl *D,
1304  llvm::AttrBuilder &AttrBuilder);
1305  void setNonAliasAttributes(GlobalDecl GD, llvm::GlobalObject *GO);
1306 
1307  /// Set function attributes for a function declaration.
1308  void SetFunctionAttributes(GlobalDecl GD, llvm::Function *F,
1309  bool IsIncompleteFunction, bool IsThunk);
1310 
1311  void EmitGlobalDefinition(GlobalDecl D, llvm::GlobalValue *GV = nullptr);
1312 
1313  void EmitGlobalFunctionDefinition(GlobalDecl GD, llvm::GlobalValue *GV);
1314  void EmitGlobalVarDefinition(const VarDecl *D, bool IsTentative = false);
1315  void EmitAliasDefinition(GlobalDecl GD);
1316  void emitIFuncDefinition(GlobalDecl GD);
1317  void emitCPUDispatchDefinition(GlobalDecl GD);
1318  void EmitObjCPropertyImplementations(const ObjCImplementationDecl *D);
1319  void EmitObjCIvarInitializations(ObjCImplementationDecl *D);
1320 
1321  // C++ related functions.
1322 
1323  void EmitDeclContext(const DeclContext *DC);
1324  void EmitLinkageSpec(const LinkageSpecDecl *D);
1325 
1326  /// Emit the function that initializes C++ thread_local variables.
1327  void EmitCXXThreadLocalInitFunc();
1328 
1329  /// Emit the function that initializes C++ globals.
1330  void EmitCXXGlobalInitFunc();
1331 
1332  /// Emit the function that destroys C++ globals.
1333  void EmitCXXGlobalDtorFunc();
1334 
1335  /// Emit the function that initializes the specified global (if PerformInit is
1336  /// true) and registers its destructor.
1337  void EmitCXXGlobalVarDeclInitFunc(const VarDecl *D,
1338  llvm::GlobalVariable *Addr,
1339  bool PerformInit);
1340 
1341  void EmitPointerToInitFunc(const VarDecl *VD, llvm::GlobalVariable *Addr,
1342  llvm::Function *InitFunc, InitSegAttr *ISA);
1343 
1344  // FIXME: Hardcoding priority here is gross.
1345  void AddGlobalCtor(llvm::Function *Ctor, int Priority = 65535,
1346  llvm::Constant *AssociatedData = nullptr);
1347  void AddGlobalDtor(llvm::Function *Dtor, int Priority = 65535);
1348 
1349  /// EmitCtorList - Generates a global array of functions and priorities using
1350  /// the given list and name. This array will have appending linkage and is
1351  /// suitable for use as a LLVM constructor or destructor array. Clears Fns.
1352  void EmitCtorList(CtorList &Fns, const char *GlobalName);
1353 
1354  /// Emit any needed decls for which code generation was deferred.
1355  void EmitDeferred();
1356 
1357  /// Try to emit external vtables as available_externally if they have emitted
1358  /// all inlined virtual functions. It runs after EmitDeferred() and therefore
1359  /// is not allowed to create new references to things that need to be emitted
1360  /// lazily.
1361  void EmitVTablesOpportunistically();
1362 
1363  /// Call replaceAllUsesWith on all pairs in Replacements.
1364  void applyReplacements();
1365 
1366  /// Call replaceAllUsesWith on all pairs in GlobalValReplacements.
1367  void applyGlobalValReplacements();
1368 
1369  void checkAliases();
1370 
1371  std::map<int, llvm::TinyPtrVector<llvm::Function *>> DtorsUsingAtExit;
1372 
1373  /// Register functions annotated with __attribute__((destructor)) using
1374  /// __cxa_atexit, if it is available, or atexit otherwise.
1375  void registerGlobalDtorsWithAtExit();
1376 
1377  void emitMultiVersionFunctions();
1378 
1379  /// Emit any vtables which we deferred and still have a use for.
1380  void EmitDeferredVTables();
1381 
1382  /// Emit a dummy function that reference a CoreFoundation symbol when
1383  /// @available is used on Darwin.
1384  void emitAtAvailableLinkGuard();
1385 
1386  /// Emit the llvm.used and llvm.compiler.used metadata.
1387  void emitLLVMUsed();
1388 
1389  /// Emit the link options introduced by imported modules.
1390  void EmitModuleLinkOptions();
1391 
1392  /// Emit aliases for internal-linkage declarations inside "C" language
1393  /// linkage specifications, giving them the "expected" name where possible.
1394  void EmitStaticExternCAliases();
1395 
1396  void EmitDeclMetadata();
1397 
1398  /// Emit the Clang version as llvm.ident metadata.
1399  void EmitVersionIdentMetadata();
1400 
1401  /// Emits target specific Metadata for global declarations.
1402  void EmitTargetMetadata();
1403 
1404  /// Emits OpenCL specific Metadata e.g. OpenCL version.
1405  void EmitOpenCLMetadata();
1406 
1407  /// Emit the llvm.gcov metadata used to tell LLVM where to emit the .gcno and
1408  /// .gcda files in a way that persists in .bc files.
1409  void EmitCoverageFile();
1410 
1411  /// Emits the initializer for a uuidof string.
1412  llvm::Constant *EmitUuidofInitializer(StringRef uuidstr);
1413 
1414  /// Determine whether the definition must be emitted; if this returns \c
1415  /// false, the definition can be emitted lazily if it's used.
1416  bool MustBeEmitted(const ValueDecl *D);
1417 
1418  /// Determine whether the definition can be emitted eagerly, or should be
1419  /// delayed until the end of the translation unit. This is relevant for
1420  /// definitions whose linkage can change, e.g. implicit function instantions
1421  /// which may later be explicitly instantiated.
1422  bool MayBeEmittedEagerly(const ValueDecl *D);
1423 
1424  /// Check whether we can use a "simpler", more core exceptions personality
1425  /// function.
1426  void SimplifyPersonality();
1427 
1428  /// Helper function for ConstructAttributeList and AddDefaultFnAttrs.
1429  /// Constructs an AttrList for a function with the given properties.
1430  void ConstructDefaultFnAttrList(StringRef Name, bool HasOptnone,
1431  bool AttrOnCallSite,
1432  llvm::AttrBuilder &FuncAttrs);
1433 
1434  llvm::Metadata *CreateMetadataIdentifierImpl(QualType T, MetadataTypeMap &Map,
1435  StringRef Suffix);
1436 };
1437 
1438 } // end namespace CodeGen
1439 } // end namespace clang
1440 
1441 #endif // LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H
const llvm::DataLayout & getDataLayout() const
TBAAAccessInfo getTBAAInfoForSubobject(LValue Base, QualType AccessType)
getTBAAInfoForSubobject - Get TBAA information for an access with a given base lvalue.
CGOpenCLRuntime & getOpenCLRuntime()
Return a reference to the configured OpenCL runtime.
Represents a function declaration or definition.
Definition: Decl.h:1717
bool operator==(const OrderGlobalInits &RHS) const
void setTypeDescriptorInMap(QualType Ty, llvm::Constant *C)
A (possibly-)qualified type.
Definition: Type.h:642
const CodeGenOptions & getCodeGenOpts() const
bool hasObjCRuntime()
Return true iff an Objective-C runtime has been configured.
llvm::LLVMContext & getLLVMContext()
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
Definition: Dominators.h:30
Stmt - This represents one statement.
Definition: Stmt.h:66
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
Definition: TargetInfo.h:949
Implements runtime-specific code generation functions.
Definition: CGObjCRuntime.h:64
Defines the clang::Module class, which describes a module in the source code.
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:87
llvm::Constant * objc_autoreleaseReturnValue
id objc_autoreleaseReturnValue(id);
BlockByrefHelpers(CharUnits alignment)
The base class of the type hierarchy.
Definition: Type.h:1415
void setFunctionLinkage(GlobalDecl GD, llvm::Function *F)
Stores additional source code information like skipped ranges which is required by the coverage mappi...
virtual void clear()
llvm::Constant * objc_loadWeakRetained
id objc_loadWeakRetained(id*);
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
constexpr XRayInstrMask Function
Definition: XRayInstr.h:39
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:4077
static llvm::GlobalValue::VisibilityTypes GetLLVMVisibility(Visibility V)
const CXXBaseSpecifier *const * path_const_iterator
Definition: Expr.h:2872
Represents a variable declaration or definition.
Definition: Decl.h:812
Objects with "hidden" visibility are not seen by the dynamic linker.
Definition: Visibility.h:37
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:2717
CGDebugInfo * getModuleDebugInfo()
LangAS
Defines the address space values used by the address space qualifier of QualType. ...
Definition: AddressSpaces.h:26
This class gathers all debug information during compilation and is responsible for emitting to llvm g...
Definition: CGDebugInfo.h:54
DiagnosticsEngine & getDiags() const
llvm::Constant * getAtomicSetterHelperFnMap(QualType Ty)
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
Definition: Linkage.h:24
llvm::Constant * objc_autorelease
id objc_autorelease(id);
llvm::GlobalVariable * getStaticLocalDeclGuardAddress(const VarDecl *D)
llvm::Constant * objc_copyWeak
void objc_copyWeak(id *dest, id *src);
llvm::Constant * getAtomicGetterHelperFnMap(QualType Ty)
One of these records is kept for each identifier that is lexed.
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
llvm::Constant * objc_loadWeak
id objc_loadWeak(id*);
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:154
llvm::Constant * objc_retainAutoreleasedReturnValue
id objc_retainAutoreleasedReturnValue(id);
int Category
Definition: Format.cpp:1605
llvm::IndexedInstrProfReader * getPGOReader() const
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:50
Objects with "default" visibility are seen by the dynamic linker and act like normal objects...
Definition: Visibility.h:46
CGCUDARuntime & getCUDARuntime()
Return a reference to the configured CUDA runtime.
llvm::Constant * objc_initWeak
id objc_initWeak(id*, id);
bool operator<(const OrderGlobalInits &RHS) const
CharUnits - This is an opaque type for sizes expressed in character units.
Definition: CharUnits.h:38
uint32_t Offset
Definition: CacheTokens.cpp:43
Structor(int Priority, llvm::Constant *Initializer, llvm::Constant *AssociatedData)
Visibility
Describes the different kinds of visibility that a declaration may have.
Definition: Visibility.h:34
void setStaticLocalDeclAddress(const VarDecl *D, llvm::Constant *C)
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:149
llvm::Constant * objc_release
void objc_release(id);
llvm::Constant * getAddrOfGlobalBlockIfEmitted(const BlockExpr *BE)
Returns the address of a block which requires no caputres, or null if we&#39;ve yet to emit the block for...
void addDeferredVTable(const CXXRecordDecl *RD)
void setAtomicGetterHelperFnMap(QualType Ty, llvm::Constant *Fn)
void addMissing(bool MainFile)
Record that a function we&#39;ve visited has no profile data.
Enums/classes describing ABI related information about constructors, destructors and thunks...
ItaniumVTableContext & getItaniumVTableContext()
Definition: CGVTables.h:79
__DEVICE__ void * memset(void *__a, int __b, size_t __c)
const PreprocessorOptions & getPreprocessorOpts() const
void Profile(llvm::FoldingSetNodeID &id) const
Represents a linkage specification.
Definition: DeclCXX.h:2822
InstrProfStats & getPGOStats()
llvm::Constant * getStaticLocalDeclAddress(const VarDecl *D)
llvm::Constant * objc_storeStrong
void objc_storeStrong(id*, id);
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:688
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Definition: CharUnits.h:179
Exposes information about the current target.
Definition: TargetInfo.h:54
CGObjCRuntime & getObjCRuntime()
Return a reference to the configured Objective-C runtime.
CharUnits Alignment
The alignment of the field.
Pepresents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:3835
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:636
This represents one expression.
Definition: Expr.h:105
Defines the clang::LangOptions interface.
llvm::Constant * objc_autoreleasePoolPop
void objc_autoreleasePoolPop(void*);
SourceLocation End
Organizes the cross-function state that is used while generating code coverage mapping data...
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:4974
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2702
void AddCXXDtorEntry(llvm::Constant *DtorFn, llvm::Constant *Object)
Add a destructor and object to add to the C++ global destructor function.
llvm::Constant * objc_retain
id objc_retain(id);
void setStaticLocalDeclGuardAddress(const VarDecl *D, llvm::GlobalVariable *C)
MicrosoftVTableContext & getMicrosoftVTableContext()
Objects with "protected" visibility are seen by the dynamic linker but always dynamically resolve to ...
Definition: Visibility.h:42
void addMismatched(bool MainFile)
Record that a function we&#39;ve visited has mismatched profile data.
TBAAAccessInfo getTBAAInfo() const
Definition: CGValue.h:308
UnaryOperator - This represents the unary-expression&#39;s (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
Definition: Expr.h:1784
const TargetInfo & getTarget() const
const LangOptions & getLangOpts() const
ASTContext & getContext() const
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition: Specifiers.h:236
GlobalDecl - represents a global declaration.
Definition: GlobalDecl.h:35
virtual bool needsCopy() const
void addVisited(bool MainFile)
Record that we&#39;ve visited a function and whether or not that function was in the main source file...
llvm::Constant * objc_retainBlock
id objc_retainBlock(id);
Kind
llvm::Constant * objc_storeWeak
id objc_storeWeak(id*, id);
Encodes a location in the source.
llvm::Constant * getTypeDescriptorFromMap(QualType Ty)
This represents &#39;#pragma omp declare reduction ...&#39; directive.
Definition: DeclOpenMP.h:102
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3041
llvm::Constant * objc_autoreleasePoolPush
void *objc_autoreleasePoolPush(void);
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:2043
ObjCEntrypoints & getObjCEntrypoints() const
This file defines OpenMP nodes for declarative directives.
llvm::InlineAsm * retainAutoreleasedReturnValueMarker
A void(void) inline asm to use to mark that the return value of a call will be immediately retain...
const HeaderSearchOptions & getHeaderSearchOpts() const
An aligned address.
Definition: Address.h:25
virtual bool needsDispose() const
ItaniumVTableContext & getItaniumVTableContext()
TargetCodeGenInfo - This class organizes various target-specific codegeneration issues, like target-specific attributes, builtins and so on.
Definition: TargetInfo.h:46
std::vector< Structor > CtorList
CGFunctionInfo - Class to encapsulate the information about a function definition.
This class organizes the cross-function state that is used while generating LLVM code.
llvm::Constant * objc_unsafeClaimAutoreleasedReturnValue
id objc_unsafeClaimAutoreleasedReturnValue(id);
CGOpenMPRuntime & getOpenMPRuntime()
Return a reference to the configured OpenMP runtime.
Dataflow Directional Tag Classes.
llvm::FoldingSet< BlockByrefHelpers > ByrefHelpersCache
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1268
int getUniqueBlockCount()
Fetches the global unique block count.
The basic abstraction for the target Objective-C runtime.
Definition: ObjCRuntime.h:28
static llvm::Constant * EmitNullConstantForBase(CodeGenModule &CGM, llvm::Type *baseType, const CXXRecordDecl *base)
Emit the null constant for a base subobject.
llvm::Constant * objc_destroyWeak
void objc_destroyWeak(id*);
llvm::Constant * clang_arc_use
void clang.arc.use(...);
CoverageMappingModuleGen * getCoverageMapping() const
llvm::Module & getModule() const
ExplicitCastExpr - An explicit cast written in the source code.
Definition: Expr.h:3000
uint64_t SanitizerMask
Definition: Sanitizers.h:26
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2544
Implements C++ ABI-specific code generation functions.
Definition: CGCXXABI.h:44
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:386
This class organizes the cross-module state that is used while lowering AST types to LLVM types...
Definition: CodeGenTypes.h:120
bool hasDiagnostics()
Whether or not the stats we&#39;ve gathered indicate any potential problems.
This class records statistics on instrumentation based profiling.
llvm::Constant * objc_retainAutorelease
id objc_retainAutorelease(id);
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
void setAtomicSetterHelperFnMap(QualType Ty, llvm::Constant *Fn)
llvm::MDNode * getNoObjCARCExceptionsMetadata()
llvm::Constant * objc_moveWeak
void objc_moveWeak(id *dest, id *src);
A pair of helper functions for a __block variable.
static llvm::Constant * EmitNullConstant(CodeGenModule &CGM, const RecordDecl *record, bool asCompleteObject)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
MicrosoftVTableContext & getMicrosoftVTableContext()
Definition: CGVTables.h:83
Represents a C++ struct/union/class.
Definition: DeclCXX.h:300
A specialization of Address that requires the address to be an LLVM Constant.
Definition: Address.h:75
OrderGlobalInits(unsigned int p, unsigned int l)
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1568
HeaderSearchOptions - Helper class for storing options related to the initialization of the HeaderSea...
CGCXXABI & getCXXABI() const
GVALinkage
A more specific kind of linkage than enum Linkage.
Definition: Linkage.h:74
This structure provides a set of types that are commonly used during IR emission. ...
CodeGenVTables & getVTables()
LValue - This represents an lvalue references.
Definition: CGValue.h:167
This represents a decl that may have a name.
Definition: Decl.h:248
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Definition: ExprCXX.h:877
SanitizerMetadata * getSanitizerMetadata()
llvm::Constant * objc_retainAutoreleaseReturnValue
id objc_retainAutoreleaseReturnValue(id);
This represents &#39;#pragma omp threadprivate ...&#39; directive.
Definition: DeclOpenMP.h:39
Abstract information about a function or function prototype.
Definition: CGCall.h:45
const llvm::Triple & getTriple() const