clang  16.0.0git
ASTContext.h
Go to the documentation of this file.
1 //===- ASTContext.h - Context to hold long-lived AST nodes ------*- 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 /// \file
10 /// Defines the clang::ASTContext interface.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_AST_ASTCONTEXT_H
15 #define LLVM_CLANG_AST_ASTCONTEXT_H
16 
18 #include "clang/AST/ASTFwd.h"
22 #include "clang/AST/Decl.h"
23 #include "clang/AST/DeclBase.h"
29 #include "clang/AST/TemplateName.h"
30 #include "clang/AST/Type.h"
32 #include "clang/Basic/AttrKinds.h"
34 #include "clang/Basic/LLVM.h"
36 #include "clang/Basic/Linkage.h"
42 #include "clang/Basic/Specifiers.h"
44 #include "clang/Basic/XRayLists.h"
45 #include "llvm/ADT/APSInt.h"
46 #include "llvm/ADT/ArrayRef.h"
47 #include "llvm/ADT/DenseMap.h"
48 #include "llvm/ADT/DenseSet.h"
49 #include "llvm/ADT/FoldingSet.h"
50 #include "llvm/ADT/IntrusiveRefCntPtr.h"
51 #include "llvm/ADT/MapVector.h"
52 #include "llvm/ADT/None.h"
53 #include "llvm/ADT/Optional.h"
54 #include "llvm/ADT/PointerIntPair.h"
55 #include "llvm/ADT/PointerUnion.h"
56 #include "llvm/ADT/SmallVector.h"
57 #include "llvm/ADT/StringMap.h"
58 #include "llvm/ADT/StringRef.h"
59 #include "llvm/ADT/TinyPtrVector.h"
60 #include "llvm/ADT/Triple.h"
61 #include "llvm/ADT/iterator_range.h"
62 #include "llvm/Support/AlignOf.h"
63 #include "llvm/Support/Allocator.h"
64 #include "llvm/Support/Casting.h"
65 #include "llvm/Support/Compiler.h"
66 #include "llvm/Support/TypeSize.h"
67 #include <cassert>
68 #include <cstddef>
69 #include <cstdint>
70 #include <iterator>
71 #include <memory>
72 #include <string>
73 #include <type_traits>
74 #include <utility>
75 #include <vector>
76 
77 namespace llvm {
78 
79 class APFixedPoint;
80 class FixedPointSemantics;
81 struct fltSemantics;
82 template <typename T, unsigned N> class SmallPtrSet;
83 
84 } // namespace llvm
85 
86 namespace clang {
87 
88 class APValue;
89 class ASTMutationListener;
90 class ASTRecordLayout;
91 class AtomicExpr;
92 class BlockExpr;
93 class BuiltinTemplateDecl;
94 class CharUnits;
95 class ConceptDecl;
96 class CXXABI;
97 class CXXConstructorDecl;
98 class CXXMethodDecl;
99 class CXXRecordDecl;
100 class DiagnosticsEngine;
101 class ParentMapContext;
102 class DynTypedNodeList;
103 class Expr;
104 enum class FloatModeKind;
105 class GlobalDecl;
106 class MangleContext;
107 class MangleNumberingContext;
108 class MemberSpecializationInfo;
109 class Module;
110 struct MSGuidDeclParts;
111 class ObjCCategoryDecl;
112 class ObjCCategoryImplDecl;
113 class ObjCContainerDecl;
114 class ObjCImplDecl;
115 class ObjCImplementationDecl;
116 class ObjCInterfaceDecl;
117 class ObjCIvarDecl;
118 class ObjCMethodDecl;
119 class ObjCPropertyDecl;
120 class ObjCPropertyImplDecl;
121 class ObjCProtocolDecl;
122 class ObjCTypeParamDecl;
123 class OMPTraitInfo;
124 struct ParsedTargetAttr;
125 class Preprocessor;
126 class StoredDeclsMap;
127 class TargetAttr;
128 class TargetInfo;
129 class TemplateDecl;
130 class TemplateParameterList;
131 class TemplateTemplateParmDecl;
132 class TemplateTypeParmDecl;
133 class TypeConstraint;
134 class UnresolvedSetIterator;
135 class UsingShadowDecl;
136 class VarTemplateDecl;
137 class VTableContextBase;
138 struct BlockVarCopyInit;
139 
140 namespace Builtin {
141 
142 class Context;
143 
144 } // namespace Builtin
145 
146 enum BuiltinTemplateKind : int;
147 enum OpenCLTypeKind : uint8_t;
148 
149 namespace comments {
150 
151 class FullComment;
152 
153 } // namespace comments
154 
155 namespace interp {
156 
157 class Context;
158 
159 } // namespace interp
160 
161 namespace serialization {
162 template <class> class AbstractTypeReader;
163 } // namespace serialization
164 
166  /// The alignment was not explicit in code.
167  None,
168 
169  /// The alignment comes from an alignment attribute on a typedef.
171 
172  /// The alignment comes from an alignment attribute on a record type.
174 
175  /// The alignment comes from an alignment attribute on a enum type.
177 };
178 
179 struct TypeInfo {
181  unsigned Align = 0;
183 
190  }
191 };
192 
197 
204  }
205 };
206 
207 /// Holds long-lived AST nodes (such as types and decls) that can be
208 /// referred to throughout the semantic analysis of a file.
209 class ASTContext : public RefCountedBase<ASTContext> {
210  friend class NestedNameSpecifier;
211 
212  mutable SmallVector<Type *, 0> Types;
213  mutable llvm::FoldingSet<ExtQuals> ExtQualNodes;
214  mutable llvm::FoldingSet<ComplexType> ComplexTypes;
215  mutable llvm::FoldingSet<PointerType> PointerTypes{GeneralTypesLog2InitSize};
216  mutable llvm::FoldingSet<AdjustedType> AdjustedTypes;
217  mutable llvm::FoldingSet<BlockPointerType> BlockPointerTypes;
218  mutable llvm::FoldingSet<LValueReferenceType> LValueReferenceTypes;
219  mutable llvm::FoldingSet<RValueReferenceType> RValueReferenceTypes;
220  mutable llvm::FoldingSet<MemberPointerType> MemberPointerTypes;
221  mutable llvm::ContextualFoldingSet<ConstantArrayType, ASTContext &>
222  ConstantArrayTypes;
223  mutable llvm::FoldingSet<IncompleteArrayType> IncompleteArrayTypes;
224  mutable std::vector<VariableArrayType*> VariableArrayTypes;
225  mutable llvm::FoldingSet<DependentSizedArrayType> DependentSizedArrayTypes;
226  mutable llvm::FoldingSet<DependentSizedExtVectorType>
227  DependentSizedExtVectorTypes;
228  mutable llvm::FoldingSet<DependentAddressSpaceType>
229  DependentAddressSpaceTypes;
230  mutable llvm::FoldingSet<VectorType> VectorTypes;
231  mutable llvm::FoldingSet<DependentVectorType> DependentVectorTypes;
232  mutable llvm::FoldingSet<ConstantMatrixType> MatrixTypes;
233  mutable llvm::FoldingSet<DependentSizedMatrixType> DependentSizedMatrixTypes;
234  mutable llvm::FoldingSet<FunctionNoProtoType> FunctionNoProtoTypes;
235  mutable llvm::ContextualFoldingSet<FunctionProtoType, ASTContext&>
236  FunctionProtoTypes;
237  mutable llvm::FoldingSet<DependentTypeOfExprType> DependentTypeOfExprTypes;
238  mutable llvm::FoldingSet<DependentDecltypeType> DependentDecltypeTypes;
239  mutable llvm::FoldingSet<TemplateTypeParmType> TemplateTypeParmTypes;
240  mutable llvm::FoldingSet<ObjCTypeParamType> ObjCTypeParamTypes;
241  mutable llvm::FoldingSet<SubstTemplateTypeParmType>
242  SubstTemplateTypeParmTypes;
243  mutable llvm::FoldingSet<SubstTemplateTypeParmPackType>
244  SubstTemplateTypeParmPackTypes;
245  mutable llvm::ContextualFoldingSet<TemplateSpecializationType, ASTContext&>
246  TemplateSpecializationTypes;
247  mutable llvm::FoldingSet<ParenType> ParenTypes{GeneralTypesLog2InitSize};
248  mutable llvm::FoldingSet<UsingType> UsingTypes;
249  mutable llvm::FoldingSet<TypedefType> TypedefTypes;
250  mutable llvm::FoldingSet<ElaboratedType> ElaboratedTypes{
251  GeneralTypesLog2InitSize};
252  mutable llvm::FoldingSet<DependentNameType> DependentNameTypes;
253  mutable llvm::ContextualFoldingSet<DependentTemplateSpecializationType,
254  ASTContext&>
255  DependentTemplateSpecializationTypes;
256  llvm::FoldingSet<PackExpansionType> PackExpansionTypes;
257  mutable llvm::FoldingSet<ObjCObjectTypeImpl> ObjCObjectTypes;
258  mutable llvm::FoldingSet<ObjCObjectPointerType> ObjCObjectPointerTypes;
259  mutable llvm::FoldingSet<DependentUnaryTransformType>
260  DependentUnaryTransformTypes;
261  mutable llvm::ContextualFoldingSet<AutoType, ASTContext&> AutoTypes;
262  mutable llvm::FoldingSet<DeducedTemplateSpecializationType>
263  DeducedTemplateSpecializationTypes;
264  mutable llvm::FoldingSet<AtomicType> AtomicTypes;
265  mutable llvm::FoldingSet<AttributedType> AttributedTypes;
266  mutable llvm::FoldingSet<PipeType> PipeTypes;
267  mutable llvm::FoldingSet<BitIntType> BitIntTypes;
268  mutable llvm::FoldingSet<DependentBitIntType> DependentBitIntTypes;
269  llvm::FoldingSet<BTFTagAttributedType> BTFTagAttributedTypes;
270 
271  mutable llvm::FoldingSet<QualifiedTemplateName> QualifiedTemplateNames;
272  mutable llvm::FoldingSet<DependentTemplateName> DependentTemplateNames;
273  mutable llvm::FoldingSet<SubstTemplateTemplateParmStorage>
274  SubstTemplateTemplateParms;
275  mutable llvm::ContextualFoldingSet<SubstTemplateTemplateParmPackStorage,
276  ASTContext&>
277  SubstTemplateTemplateParmPacks;
278 
279  /// The set of nested name specifiers.
280  ///
281  /// This set is managed by the NestedNameSpecifier class.
282  mutable llvm::FoldingSet<NestedNameSpecifier> NestedNameSpecifiers;
283  mutable NestedNameSpecifier *GlobalNestedNameSpecifier = nullptr;
284 
285  /// A cache mapping from RecordDecls to ASTRecordLayouts.
286  ///
287  /// This is lazily created. This is intentionally not serialized.
288  mutable llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>
289  ASTRecordLayouts;
290  mutable llvm::DenseMap<const ObjCContainerDecl*, const ASTRecordLayout*>
291  ObjCLayouts;
292 
293  /// A cache from types to size and alignment information.
294  using TypeInfoMap = llvm::DenseMap<const Type *, struct TypeInfo>;
295  mutable TypeInfoMap MemoizedTypeInfo;
296 
297  /// A cache from types to unadjusted alignment information. Only ARM and
298  /// AArch64 targets need this information, keeping it separate prevents
299  /// imposing overhead on TypeInfo size.
300  using UnadjustedAlignMap = llvm::DenseMap<const Type *, unsigned>;
301  mutable UnadjustedAlignMap MemoizedUnadjustedAlign;
302 
303  /// A cache mapping from CXXRecordDecls to key functions.
304  llvm::DenseMap<const CXXRecordDecl*, LazyDeclPtr> KeyFunctions;
305 
306  /// Mapping from ObjCContainers to their ObjCImplementations.
307  llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*> ObjCImpls;
308 
309  /// Mapping from ObjCMethod to its duplicate declaration in the same
310  /// interface.
311  llvm::DenseMap<const ObjCMethodDecl*,const ObjCMethodDecl*> ObjCMethodRedecls;
312 
313  /// Mapping from __block VarDecls to BlockVarCopyInit.
314  llvm::DenseMap<const VarDecl *, BlockVarCopyInit> BlockVarCopyInits;
315 
316  /// Mapping from GUIDs to the corresponding MSGuidDecl.
317  mutable llvm::FoldingSet<MSGuidDecl> MSGuidDecls;
318 
319  /// Mapping from APValues to the corresponding UnnamedGlobalConstantDecl.
320  mutable llvm::FoldingSet<UnnamedGlobalConstantDecl>
321  UnnamedGlobalConstantDecls;
322 
323  /// Mapping from APValues to the corresponding TemplateParamObjects.
324  mutable llvm::FoldingSet<TemplateParamObjectDecl> TemplateParamObjectDecls;
325 
326  /// A cache mapping a string value to a StringLiteral object with the same
327  /// value.
328  ///
329  /// This is lazily created. This is intentionally not serialized.
330  mutable llvm::StringMap<StringLiteral *> StringLiteralCache;
331 
332  /// MD5 hash of CUID. It is calculated when first used and cached by this
333  /// data member.
334  mutable std::string CUIDHash;
335 
336  /// Representation of a "canonical" template template parameter that
337  /// is used in canonical template names.
338  class CanonicalTemplateTemplateParm : public llvm::FoldingSetNode {
339  TemplateTemplateParmDecl *Parm;
340 
341  public:
342  CanonicalTemplateTemplateParm(TemplateTemplateParmDecl *Parm)
343  : Parm(Parm) {}
344 
345  TemplateTemplateParmDecl *getParam() const { return Parm; }
346 
347  void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &C) {
348  Profile(ID, C, Parm);
349  }
350 
351  static void Profile(llvm::FoldingSetNodeID &ID,
352  const ASTContext &C,
353  TemplateTemplateParmDecl *Parm);
354  };
355  mutable llvm::ContextualFoldingSet<CanonicalTemplateTemplateParm,
356  const ASTContext&>
357  CanonTemplateTemplateParms;
358 
359  TemplateTemplateParmDecl *
360  getCanonicalTemplateTemplateParmDecl(TemplateTemplateParmDecl *TTP) const;
361 
362  /// The typedef for the __int128_t type.
363  mutable TypedefDecl *Int128Decl = nullptr;
364 
365  /// The typedef for the __uint128_t type.
366  mutable TypedefDecl *UInt128Decl = nullptr;
367 
368  /// The typedef for the target specific predefined
369  /// __builtin_va_list type.
370  mutable TypedefDecl *BuiltinVaListDecl = nullptr;
371 
372  /// The typedef for the predefined \c __builtin_ms_va_list type.
373  mutable TypedefDecl *BuiltinMSVaListDecl = nullptr;
374 
375  /// The typedef for the predefined \c id type.
376  mutable TypedefDecl *ObjCIdDecl = nullptr;
377 
378  /// The typedef for the predefined \c SEL type.
379  mutable TypedefDecl *ObjCSelDecl = nullptr;
380 
381  /// The typedef for the predefined \c Class type.
382  mutable TypedefDecl *ObjCClassDecl = nullptr;
383 
384  /// The typedef for the predefined \c Protocol class in Objective-C.
385  mutable ObjCInterfaceDecl *ObjCProtocolClassDecl = nullptr;
386 
387  /// The typedef for the predefined 'BOOL' type.
388  mutable TypedefDecl *BOOLDecl = nullptr;
389 
390  // Typedefs which may be provided defining the structure of Objective-C
391  // pseudo-builtins
392  QualType ObjCIdRedefinitionType;
393  QualType ObjCClassRedefinitionType;
394  QualType ObjCSelRedefinitionType;
395 
396  /// The identifier 'bool'.
397  mutable IdentifierInfo *BoolName = nullptr;
398 
399  /// The identifier 'NSObject'.
400  mutable IdentifierInfo *NSObjectName = nullptr;
401 
402  /// The identifier 'NSCopying'.
403  IdentifierInfo *NSCopyingName = nullptr;
404 
405  /// The identifier '__make_integer_seq'.
406  mutable IdentifierInfo *MakeIntegerSeqName = nullptr;
407 
408  /// The identifier '__type_pack_element'.
409  mutable IdentifierInfo *TypePackElementName = nullptr;
410 
411  QualType ObjCConstantStringType;
412  mutable RecordDecl *CFConstantStringTagDecl = nullptr;
413  mutable TypedefDecl *CFConstantStringTypeDecl = nullptr;
414 
415  mutable QualType ObjCSuperType;
416 
417  QualType ObjCNSStringType;
418 
419  /// The typedef declaration for the Objective-C "instancetype" type.
420  TypedefDecl *ObjCInstanceTypeDecl = nullptr;
421 
422  /// The type for the C FILE type.
423  TypeDecl *FILEDecl = nullptr;
424 
425  /// The type for the C jmp_buf type.
426  TypeDecl *jmp_bufDecl = nullptr;
427 
428  /// The type for the C sigjmp_buf type.
429  TypeDecl *sigjmp_bufDecl = nullptr;
430 
431  /// The type for the C ucontext_t type.
432  TypeDecl *ucontext_tDecl = nullptr;
433 
434  /// Type for the Block descriptor for Blocks CodeGen.
435  ///
436  /// Since this is only used for generation of debug info, it is not
437  /// serialized.
438  mutable RecordDecl *BlockDescriptorType = nullptr;
439 
440  /// Type for the Block descriptor for Blocks CodeGen.
441  ///
442  /// Since this is only used for generation of debug info, it is not
443  /// serialized.
444  mutable RecordDecl *BlockDescriptorExtendedType = nullptr;
445 
446  /// Declaration for the CUDA cudaConfigureCall function.
447  FunctionDecl *cudaConfigureCallDecl = nullptr;
448 
449  /// Keeps track of all declaration attributes.
450  ///
451  /// Since so few decls have attrs, we keep them in a hash map instead of
452  /// wasting space in the Decl class.
453  llvm::DenseMap<const Decl*, AttrVec*> DeclAttrs;
454 
455  /// A mapping from non-redeclarable declarations in modules that were
456  /// merged with other declarations to the canonical declaration that they were
457  /// merged into.
458  llvm::DenseMap<Decl*, Decl*> MergedDecls;
459 
460  /// A mapping from a defining declaration to a list of modules (other
461  /// than the owning module of the declaration) that contain merged
462  /// definitions of that entity.
463  llvm::DenseMap<NamedDecl*, llvm::TinyPtrVector<Module*>> MergedDefModules;
464 
465  /// Initializers for a module, in order. Each Decl will be either
466  /// something that has a semantic effect on startup (such as a variable with
467  /// a non-constant initializer), or an ImportDecl (which recursively triggers
468  /// initialization of another module).
469  struct PerModuleInitializers {
470  llvm::SmallVector<Decl*, 4> Initializers;
471  llvm::SmallVector<uint32_t, 4> LazyInitializers;
472 
473  void resolve(ASTContext &Ctx);
474  };
475  llvm::DenseMap<Module*, PerModuleInitializers*> ModuleInitializers;
476 
477  /// For module code-gen cases, this is the top-level module we are building.
478  Module *TopLevelModule = nullptr;
479 
480  static constexpr unsigned ConstantArrayTypesLog2InitSize = 8;
481  static constexpr unsigned GeneralTypesLog2InitSize = 9;
482  static constexpr unsigned FunctionProtoTypesLog2InitSize = 12;
483 
484  ASTContext &this_() { return *this; }
485 
486 public:
487  /// A type synonym for the TemplateOrInstantiation mapping.
489  llvm::PointerUnion<VarTemplateDecl *, MemberSpecializationInfo *>;
490 
491 private:
492  friend class ASTDeclReader;
493  friend class ASTReader;
494  friend class ASTWriter;
495  template <class> friend class serialization::AbstractTypeReader;
496  friend class CXXRecordDecl;
497  friend class IncrementalParser;
498 
499  /// A mapping to contain the template or declaration that
500  /// a variable declaration describes or was instantiated from,
501  /// respectively.
502  ///
503  /// For non-templates, this value will be NULL. For variable
504  /// declarations that describe a variable template, this will be a
505  /// pointer to a VarTemplateDecl. For static data members
506  /// of class template specializations, this will be the
507  /// MemberSpecializationInfo referring to the member variable that was
508  /// instantiated or specialized. Thus, the mapping will keep track of
509  /// the static data member templates from which static data members of
510  /// class template specializations were instantiated.
511  ///
512  /// Given the following example:
513  ///
514  /// \code
515  /// template<typename T>
516  /// struct X {
517  /// static T value;
518  /// };
519  ///
520  /// template<typename T>
521  /// T X<T>::value = T(17);
522  ///
523  /// int *x = &X<int>::value;
524  /// \endcode
525  ///
526  /// This mapping will contain an entry that maps from the VarDecl for
527  /// X<int>::value to the corresponding VarDecl for X<T>::value (within the
528  /// class template X) and will be marked TSK_ImplicitInstantiation.
529  llvm::DenseMap<const VarDecl *, TemplateOrSpecializationInfo>
530  TemplateOrInstantiation;
531 
532  /// Keeps track of the declaration from which a using declaration was
533  /// created during instantiation.
534  ///
535  /// The source and target declarations are always a UsingDecl, an
536  /// UnresolvedUsingValueDecl, or an UnresolvedUsingTypenameDecl.
537  ///
538  /// For example:
539  /// \code
540  /// template<typename T>
541  /// struct A {
542  /// void f();
543  /// };
544  ///
545  /// template<typename T>
546  /// struct B : A<T> {
547  /// using A<T>::f;
548  /// };
549  ///
550  /// template struct B<int>;
551  /// \endcode
552  ///
553  /// This mapping will contain an entry that maps from the UsingDecl in
554  /// B<int> to the UnresolvedUsingDecl in B<T>.
555  llvm::DenseMap<NamedDecl *, NamedDecl *> InstantiatedFromUsingDecl;
556 
557  /// Like InstantiatedFromUsingDecl, but for using-enum-declarations. Maps
558  /// from the instantiated using-enum to the templated decl from whence it
559  /// came.
560  /// Note that using-enum-declarations cannot be dependent and
561  /// thus will never be instantiated from an "unresolved"
562  /// version thereof (as with using-declarations), so each mapping is from
563  /// a (resolved) UsingEnumDecl to a (resolved) UsingEnumDecl.
564  llvm::DenseMap<UsingEnumDecl *, UsingEnumDecl *>
565  InstantiatedFromUsingEnumDecl;
566 
567  /// Simlarly maps instantiated UsingShadowDecls to their origin.
568  llvm::DenseMap<UsingShadowDecl*, UsingShadowDecl*>
569  InstantiatedFromUsingShadowDecl;
570 
571  llvm::DenseMap<FieldDecl *, FieldDecl *> InstantiatedFromUnnamedFieldDecl;
572 
573  /// Mapping that stores the methods overridden by a given C++
574  /// member function.
575  ///
576  /// Since most C++ member functions aren't virtual and therefore
577  /// don't override anything, we store the overridden functions in
578  /// this map on the side rather than within the CXXMethodDecl structure.
579  using CXXMethodVector = llvm::TinyPtrVector<const CXXMethodDecl *>;
580  llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector> OverriddenMethods;
581 
582  /// Mapping from each declaration context to its corresponding
583  /// mangling numbering context (used for constructs like lambdas which
584  /// need to be consistently numbered for the mangler).
585  llvm::DenseMap<const DeclContext *, std::unique_ptr<MangleNumberingContext>>
586  MangleNumberingContexts;
587  llvm::DenseMap<const Decl *, std::unique_ptr<MangleNumberingContext>>
588  ExtraMangleNumberingContexts;
589 
590  /// Side-table of mangling numbers for declarations which rarely
591  /// need them (like static local vars).
592  llvm::MapVector<const NamedDecl *, unsigned> MangleNumbers;
593  llvm::MapVector<const VarDecl *, unsigned> StaticLocalNumbers;
594  /// Mapping the associated device lambda mangling number if present.
595  mutable llvm::DenseMap<const CXXRecordDecl *, unsigned>
596  DeviceLambdaManglingNumbers;
597 
598  /// Mapping that stores parameterIndex values for ParmVarDecls when
599  /// that value exceeds the bitfield size of ParmVarDeclBits.ParameterIndex.
600  using ParameterIndexTable = llvm::DenseMap<const VarDecl *, unsigned>;
601  ParameterIndexTable ParamIndices;
602 
603  ImportDecl *FirstLocalImport = nullptr;
604  ImportDecl *LastLocalImport = nullptr;
605 
606  TranslationUnitDecl *TUDecl = nullptr;
607  mutable ExternCContextDecl *ExternCContext = nullptr;
608  mutable BuiltinTemplateDecl *MakeIntegerSeqDecl = nullptr;
609  mutable BuiltinTemplateDecl *TypePackElementDecl = nullptr;
610 
611  /// The associated SourceManager object.
612  SourceManager &SourceMgr;
613 
614  /// The language options used to create the AST associated with
615  /// this ASTContext object.
616  LangOptions &LangOpts;
617 
618  /// NoSanitizeList object that is used by sanitizers to decide which
619  /// entities should not be instrumented.
620  std::unique_ptr<NoSanitizeList> NoSanitizeL;
621 
622  /// Function filtering mechanism to determine whether a given function
623  /// should be imbued with the XRay "always" or "never" attributes.
624  std::unique_ptr<XRayFunctionFilter> XRayFilter;
625 
626  /// ProfileList object that is used by the profile instrumentation
627  /// to decide which entities should be instrumented.
628  std::unique_ptr<ProfileList> ProfList;
629 
630  /// The allocator used to create AST objects.
631  ///
632  /// AST objects are never destructed; rather, all memory associated with the
633  /// AST objects will be released when the ASTContext itself is destroyed.
634  mutable llvm::BumpPtrAllocator BumpAlloc;
635 
636  /// Allocator for partial diagnostics.
638 
639  /// The current C++ ABI.
640  std::unique_ptr<CXXABI> ABI;
641  CXXABI *createCXXABI(const TargetInfo &T);
642 
643  /// The logical -> physical address space map.
644  const LangASMap *AddrSpaceMap = nullptr;
645 
646  /// Address space map mangling must be used with language specific
647  /// address spaces (e.g. OpenCL/CUDA)
648  bool AddrSpaceMapMangling;
649 
650  const TargetInfo *Target = nullptr;
651  const TargetInfo *AuxTarget = nullptr;
653  std::unique_ptr<interp::Context> InterpContext;
654  std::unique_ptr<ParentMapContext> ParentMapCtx;
655 
656  /// Keeps track of the deallocated DeclListNodes for future reuse.
657  DeclListNode *ListNodeFreeList = nullptr;
658 
659 public:
667 
668  /// Returns the clang bytecode interpreter context.
670 
672  /// Do not allow wrong-sided variables in constant expressions.
673  bool NoWrongSidedVars = false;
678  CUDAConstantEvalContextRAII(ASTContext &Ctx_, bool NoWrongSidedVars)
679  : Ctx(Ctx_), SavedCtx(Ctx_.CUDAConstantEvalCtx) {
680  Ctx_.CUDAConstantEvalCtx.NoWrongSidedVars = NoWrongSidedVars;
681  }
683  };
684 
685  /// Returns the dynamic AST node parent map context.
687 
688  // A traversal scope limits the parts of the AST visible to certain analyses.
689  // RecursiveASTVisitor only visits specified children of TranslationUnitDecl.
690  // getParents() will only observe reachable parent edges.
691  //
692  // The scope is defined by a set of "top-level" declarations which will be
693  // visible under the TranslationUnitDecl.
694  // Initially, it is the entire TU, represented by {getTranslationUnitDecl()}.
695  //
696  // After setTraversalScope({foo, bar}), the exposed AST looks like:
697  // TranslationUnitDecl
698  // - foo
699  // - ...
700  // - bar
701  // - ...
702  // All other siblings of foo and bar are pruned from the tree.
703  // (However they are still accessible via TranslationUnitDecl->decls())
704  //
705  // Changing the scope clears the parent cache, which is expensive to rebuild.
706  std::vector<Decl *> getTraversalScope() const { return TraversalScope; }
707  void setTraversalScope(const std::vector<Decl *> &);
708 
709  /// Forwards to get node parents from the ParentMapContext. New callers should
710  /// use ParentMapContext::getParents() directly.
711  template <typename NodeT> DynTypedNodeList getParents(const NodeT &Node);
712 
714  return PrintingPolicy;
715  }
716 
719  }
720 
721  SourceManager& getSourceManager() { return SourceMgr; }
722  const SourceManager& getSourceManager() const { return SourceMgr; }
723 
724  // Cleans up some of the data structures. This allows us to do cleanup
725  // normally done in the destructor earlier. Renders much of the ASTContext
726  // unusable, mostly the actual AST nodes, so should be called when we no
727  // longer need access to the AST.
728  void cleanup();
729 
730  llvm::BumpPtrAllocator &getAllocator() const {
731  return BumpAlloc;
732  }
733 
734  void *Allocate(size_t Size, unsigned Align = 8) const {
735  return BumpAlloc.Allocate(Size, Align);
736  }
737  template <typename T> T *Allocate(size_t Num = 1) const {
738  return static_cast<T *>(Allocate(Num * sizeof(T), alignof(T)));
739  }
740  void Deallocate(void *Ptr) const {}
741 
742  /// Allocates a \c DeclListNode or returns one from the \c ListNodeFreeList
743  /// pool.
745  if (DeclListNode *Alloc = ListNodeFreeList) {
746  ListNodeFreeList = Alloc->Rest.dyn_cast<DeclListNode*>();
747  Alloc->D = ND;
748  Alloc->Rest = nullptr;
749  return Alloc;
750  }
751  return new (*this) DeclListNode(ND);
752  }
753  /// Deallcates a \c DeclListNode by returning it to the \c ListNodeFreeList
754  /// pool.
756  N->Rest = ListNodeFreeList;
757  ListNodeFreeList = N;
758  }
759 
760  /// Return the total amount of physical memory allocated for representing
761  /// AST nodes and type information.
762  size_t getASTAllocatedMemory() const {
763  return BumpAlloc.getTotalMemory();
764  }
765 
766  /// Return the total memory used for various side tables.
767  size_t getSideTableAllocatedMemory() const;
768 
770  return DiagAllocator;
771  }
772 
773  const TargetInfo &getTargetInfo() const { return *Target; }
774  const TargetInfo *getAuxTargetInfo() const { return AuxTarget; }
775 
776  /// getIntTypeForBitwidth -
777  /// sets integer QualTy according to specified details:
778  /// bitwidth, signed/unsigned.
779  /// Returns empty type if there is no appropriate target types.
780  QualType getIntTypeForBitwidth(unsigned DestWidth,
781  unsigned Signed) const;
782 
783  /// getRealTypeForBitwidth -
784  /// sets floating point QualTy according to specified bitwidth.
785  /// Returns empty type if there is no appropriate target types.
786  QualType getRealTypeForBitwidth(unsigned DestWidth,
787  FloatModeKind ExplicitType) const;
788 
789  bool AtomicUsesUnsupportedLibcall(const AtomicExpr *E) const;
790 
791  const LangOptions& getLangOpts() const { return LangOpts; }
792 
793  // If this condition is false, typo correction must be performed eagerly
794  // rather than delayed in many places, as it makes use of dependent types.
795  // the condition is false for clang's C-only codepath, as it doesn't support
796  // dependent types yet.
797  bool isDependenceAllowed() const {
798  return LangOpts.CPlusPlus || LangOpts.RecoveryAST;
799  }
800 
801  const NoSanitizeList &getNoSanitizeList() const { return *NoSanitizeL; }
802 
804  return *XRayFilter;
805  }
806 
807  const ProfileList &getProfileList() const { return *ProfList; }
808 
810 
812  return FullSourceLoc(Loc,SourceMgr);
813  }
814 
815  /// Return the C++ ABI kind that should be used. The C++ ABI can be overriden
816  /// at compile time with `-fc++-abi=`. If this is not provided, we instead use
817  /// the default ABI set by the target.
819 
820  /// All comments in this translation unit.
822 
823  /// True if comments are already loaded from ExternalASTSource.
824  mutable bool CommentsLoaded = false;
825 
826  /// Mapping from declaration to directly attached comment.
827  ///
828  /// Raw comments are owned by Comments list. This mapping is populated
829  /// lazily.
830  mutable llvm::DenseMap<const Decl *, const RawComment *> DeclRawComments;
831 
832  /// Mapping from canonical declaration to the first redeclaration in chain
833  /// that has a comment attached.
834  ///
835  /// Raw comments are owned by Comments list. This mapping is populated
836  /// lazily.
837  mutable llvm::DenseMap<const Decl *, const Decl *> RedeclChainComments;
838 
839  /// Keeps track of redeclaration chains that don't have any comment attached.
840  /// Mapping from canonical declaration to redeclaration chain that has no
841  /// comments attached to any redeclaration. Specifically it's mapping to
842  /// the last redeclaration we've checked.
843  ///
844  /// Shall not contain declarations that have comments attached to any
845  /// redeclaration in their chain.
846  mutable llvm::DenseMap<const Decl *, const Decl *> CommentlessRedeclChains;
847 
848  /// Mapping from declarations to parsed comments attached to any
849  /// redeclaration.
850  mutable llvm::DenseMap<const Decl *, comments::FullComment *> ParsedComments;
851 
852  /// Attaches \p Comment to \p OriginalD and to its redeclaration chain
853  /// and removes the redeclaration chain from the set of commentless chains.
854  ///
855  /// Don't do anything if a comment has already been attached to \p OriginalD
856  /// or its redeclaration chain.
857  void cacheRawCommentForDecl(const Decl &OriginalD,
858  const RawComment &Comment) const;
859 
860  /// \returns searches \p CommentsInFile for doc comment for \p D.
861  ///
862  /// \p RepresentativeLocForDecl is used as a location for searching doc
863  /// comments. \p CommentsInFile is a mapping offset -> comment of files in the
864  /// same file where \p RepresentativeLocForDecl is.
866  const Decl *D, const SourceLocation RepresentativeLocForDecl,
867  const std::map<unsigned, RawComment *> &CommentsInFile) const;
868 
869  /// Return the documentation comment attached to a given declaration,
870  /// without looking into cache.
872 
873 public:
874  void addComment(const RawComment &RC);
875 
876  /// Return the documentation comment attached to a given declaration.
877  /// Returns nullptr if no comment is attached.
878  ///
879  /// \param OriginalDecl if not nullptr, is set to declaration AST node that
880  /// had the comment, if the comment we found comes from a redeclaration.
881  const RawComment *
883  const Decl **OriginalDecl = nullptr) const;
884 
885  /// Searches existing comments for doc comments that should be attached to \p
886  /// Decls. If any doc comment is found, it is parsed.
887  ///
888  /// Requirement: All \p Decls are in the same file.
889  ///
890  /// If the last comment in the file is already attached we assume
891  /// there are not comments left to be attached to \p Decls.
893  const Preprocessor *PP);
894 
895  /// Return parsed documentation comment attached to a given declaration.
896  /// Returns nullptr if no comment is attached.
897  ///
898  /// \param PP the Preprocessor used with this TU. Could be nullptr if
899  /// preprocessor is not available.
901  const Preprocessor *PP) const;
902 
903  /// Return parsed documentation comment attached to a given declaration.
904  /// Returns nullptr if no comment is attached. Does not look at any
905  /// redeclarations of the declaration.
907 
909  const Decl *D) const;
910 
911 private:
912  mutable comments::CommandTraits CommentCommandTraits;
913 
914  /// Iterator that visits import declarations.
915  class import_iterator {
916  ImportDecl *Import = nullptr;
917 
918  public:
919  using value_type = ImportDecl *;
920  using reference = ImportDecl *;
921  using pointer = ImportDecl *;
922  using difference_type = int;
923  using iterator_category = std::forward_iterator_tag;
924 
925  import_iterator() = default;
926  explicit import_iterator(ImportDecl *Import) : Import(Import) {}
927 
928  reference operator*() const { return Import; }
929  pointer operator->() const { return Import; }
930 
931  import_iterator &operator++() {
932  Import = ASTContext::getNextLocalImport(Import);
933  return *this;
934  }
935 
936  import_iterator operator++(int) {
937  import_iterator Other(*this);
938  ++(*this);
939  return Other;
940  }
941 
942  friend bool operator==(import_iterator X, import_iterator Y) {
943  return X.Import == Y.Import;
944  }
945 
946  friend bool operator!=(import_iterator X, import_iterator Y) {
947  return X.Import != Y.Import;
948  }
949  };
950 
951 public:
953  return CommentCommandTraits;
954  }
955 
956  /// Retrieve the attributes for the given declaration.
957  AttrVec& getDeclAttrs(const Decl *D);
958 
959  /// Erase the attributes corresponding to the given declaration.
960  void eraseDeclAttrs(const Decl *D);
961 
962  /// If this variable is an instantiated static data member of a
963  /// class template specialization, returns the templated static data member
964  /// from which it was instantiated.
965  // FIXME: Remove ?
967  const VarDecl *Var);
968 
969  /// Note that the static data member \p Inst is an instantiation of
970  /// the static data member template \p Tmpl of a class template.
973  SourceLocation PointOfInstantiation = SourceLocation());
974 
977 
980 
981  /// If the given using decl \p Inst is an instantiation of
982  /// another (possibly unresolved) using decl, return it.
984 
985  /// Remember that the using decl \p Inst is an instantiation
986  /// of the using decl \p Pattern of a class template.
987  void setInstantiatedFromUsingDecl(NamedDecl *Inst, NamedDecl *Pattern);
988 
989  /// If the given using-enum decl \p Inst is an instantiation of
990  /// another using-enum decl, return it.
992 
993  /// Remember that the using enum decl \p Inst is an instantiation
994  /// of the using enum decl \p Pattern of a class template.
996  UsingEnumDecl *Pattern);
997 
1000  UsingShadowDecl *Pattern);
1001 
1003 
1005 
1006  // Access to the set of methods overridden by the given C++ method.
1007  using overridden_cxx_method_iterator = CXXMethodVector::const_iterator;
1009  overridden_methods_begin(const CXXMethodDecl *Method) const;
1010 
1012  overridden_methods_end(const CXXMethodDecl *Method) const;
1013 
1014  unsigned overridden_methods_size(const CXXMethodDecl *Method) const;
1015 
1016  using overridden_method_range =
1017  llvm::iterator_range<overridden_cxx_method_iterator>;
1018 
1020 
1021  /// Note that the given C++ \p Method overrides the given \p
1022  /// Overridden method.
1023  void addOverriddenMethod(const CXXMethodDecl *Method,
1024  const CXXMethodDecl *Overridden);
1025 
1026  /// Return C++ or ObjC overridden methods for the given \p Method.
1027  ///
1028  /// An ObjC method is considered to override any method in the class's
1029  /// base classes, its protocols, or its categories' protocols, that has
1030  /// the same selector and is of the same kind (class or instance).
1031  /// A method in an implementation is not considered as overriding the same
1032  /// method in the interface or its categories.
1033  void getOverriddenMethods(
1034  const NamedDecl *Method,
1035  SmallVectorImpl<const NamedDecl *> &Overridden) const;
1036 
1037  /// Notify the AST context that a new import declaration has been
1038  /// parsed or implicitly created within this translation unit.
1039  void addedLocalImportDecl(ImportDecl *Import);
1040 
1042  return Import->getNextLocalImport();
1043  }
1044 
1045  using import_range = llvm::iterator_range<import_iterator>;
1046 
1048  return import_range(import_iterator(FirstLocalImport), import_iterator());
1049  }
1050 
1052  Decl *Result = MergedDecls.lookup(D);
1053  return Result ? Result : D;
1054  }
1055  void setPrimaryMergedDecl(Decl *D, Decl *Primary) {
1056  MergedDecls[D] = Primary;
1057  }
1058 
1059  /// Note that the definition \p ND has been merged into module \p M,
1060  /// and should be visible whenever \p M is visible.
1062  bool NotifyListeners = true);
1063 
1064  /// Clean up the merged definition list. Call this if you might have
1065  /// added duplicates into the list.
1067 
1068  /// Get the additional modules in which the definition \p Def has
1069  /// been merged.
1071 
1072  /// Add a declaration to the list of declarations that are initialized
1073  /// for a module. This will typically be a global variable (with internal
1074  /// linkage) that runs module initializers, such as the iostream initializer,
1075  /// or an ImportDecl nominating another module that has initializers.
1076  void addModuleInitializer(Module *M, Decl *Init);
1077 
1079 
1080  /// Get the initializations to perform when importing a module, if any.
1082 
1083  /// Set the (C++20) module we are building.
1084  void setModuleForCodeGen(Module *M) { TopLevelModule = M; }
1085 
1086  /// Get module under construction, nullptr if this is not a C++20 module.
1087  Module *getModuleForCodeGen() const { return TopLevelModule; }
1088 
1090  return TUDecl->getMostRecentDecl();
1091  }
1093  assert(!TUDecl || TUKind == TU_Incremental);
1095  if (TraversalScope.empty() || TraversalScope.back() == TUDecl)
1096  TraversalScope = {NewTUDecl};
1097  if (TUDecl)
1098  NewTUDecl->setPreviousDecl(TUDecl);
1099  TUDecl = NewTUDecl;
1100  }
1101 
1105 
1106  // Builtin Types.
1110  CanQualType WCharTy; // [C++ 3.9.1p5].
1111  CanQualType WideCharTy; // Same as WCharTy in C++, integer type in C99.
1112  CanQualType WIntTy; // [C99 7.24.1], integer type unchanged by default promotions.
1113  CanQualType Char8Ty; // [C++20 proposal]
1114  CanQualType Char16Ty; // [C++0x 3.9.1p5], integer type in C99.
1115  CanQualType Char32Ty; // [C++0x 3.9.1p5], integer type in C99.
1121  LongAccumTy; // ISO/IEC JTC1 SC22 WG14 N1169 Extension
1131  CanQualType HalfTy; // [OpenCL 6.1.1.1], ARM NEON
1133  CanQualType Float16Ty; // C11 extension ISO/IEC TS 18661-3
1140 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
1141  CanQualType SingletonId;
1142 #include "clang/Basic/OpenCLImageTypes.def"
1147 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
1148  CanQualType Id##Ty;
1149 #include "clang/Basic/OpenCLExtensionTypes.def"
1150 #define SVE_TYPE(Name, Id, SingletonId) \
1151  CanQualType SingletonId;
1152 #include "clang/Basic/AArch64SVEACLETypes.def"
1153 #define PPC_VECTOR_TYPE(Name, Id, Size) \
1154  CanQualType Id##Ty;
1155 #include "clang/Basic/PPCTypes.def"
1156 #define RVV_TYPE(Name, Id, SingletonId) \
1157  CanQualType SingletonId;
1158 #include "clang/Basic/RISCVVTypes.def"
1159 
1160  // Types for deductions in C++0x [stmt.ranged]'s desugaring. Built on demand.
1161  mutable QualType AutoDeductTy; // Deduction against 'auto'.
1162  mutable QualType AutoRRefDeductTy; // Deduction against 'auto &&'.
1163 
1164  // Decl used to help define __builtin_va_list for some targets.
1165  // The decl is built when constructing 'BuiltinVaListDecl'.
1166  mutable Decl *VaListTagDecl = nullptr;
1167 
1168  // Implicitly-declared type 'struct _GUID'.
1169  mutable TagDecl *MSGuidTagDecl = nullptr;
1170 
1171  /// Keep track of CUDA/HIP device-side variables ODR-used by host code.
1173 
1174  /// Keep track of CUDA/HIP external kernels or device variables ODR-used by
1175  /// host code.
1177 
1179  SelectorTable &sels, Builtin::Context &builtins,
1181  ASTContext(const ASTContext &) = delete;
1182  ASTContext &operator=(const ASTContext &) = delete;
1183  ~ASTContext();
1184 
1185  /// Attach an external AST source to the AST context.
1186  ///
1187  /// The external AST source provides the ability to load parts of
1188  /// the abstract syntax tree as needed from some external storage,
1189  /// e.g., a precompiled header.
1191 
1192  /// Retrieve a pointer to the external AST source associated
1193  /// with this AST context, if any.
1195  return ExternalSource.get();
1196  }
1197 
1198  /// Attach an AST mutation listener to the AST context.
1199  ///
1200  /// The AST mutation listener provides the ability to track modifications to
1201  /// the abstract syntax tree entities committed after they were initially
1202  /// created.
1204  this->Listener = Listener;
1205  }
1206 
1207  /// Retrieve a pointer to the AST mutation listener associated
1208  /// with this AST context, if any.
1210 
1211  void PrintStats() const;
1212  const SmallVectorImpl<Type *>& getTypes() const { return Types; }
1213 
1215  const IdentifierInfo *II) const;
1216 
1217  /// Create a new implicit TU-level CXXRecordDecl or RecordDecl
1218  /// declaration.
1219  RecordDecl *buildImplicitRecord(StringRef Name,
1220  RecordDecl::TagKind TK = TTK_Struct) const;
1221 
1222  /// Create a new implicit TU-level typedef declaration.
1223  TypedefDecl *buildImplicitTypedef(QualType T, StringRef Name) const;
1224 
1225  /// Retrieve the declaration for the 128-bit signed integer type.
1226  TypedefDecl *getInt128Decl() const;
1227 
1228  /// Retrieve the declaration for the 128-bit unsigned integer type.
1229  TypedefDecl *getUInt128Decl() const;
1230 
1231  //===--------------------------------------------------------------------===//
1232  // Type Constructors
1233  //===--------------------------------------------------------------------===//
1234 
1235 private:
1236  /// Return a type with extended qualifiers.
1237  QualType getExtQualType(const Type *Base, Qualifiers Quals) const;
1238 
1239  QualType getTypeDeclTypeSlow(const TypeDecl *Decl) const;
1240 
1241  QualType getPipeType(QualType T, bool ReadOnly) const;
1242 
1243 public:
1244  /// Return the uniqued reference to the type for an address space
1245  /// qualified type with the specified type and address space.
1246  ///
1247  /// The resulting type has a union of the qualifiers from T and the address
1248  /// space. If T already has an address space specifier, it is silently
1249  /// replaced.
1250  QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const;
1251 
1252  /// Remove any existing address space on the type and returns the type
1253  /// with qualifiers intact (or that's the idea anyway)
1254  ///
1255  /// The return type should be T with all prior qualifiers minus the address
1256  /// space.
1258 
1259  /// Apply Objective-C protocol qualifiers to the given type.
1260  /// \param allowOnPointerType specifies if we can apply protocol
1261  /// qualifiers on ObjCObjectPointerType. It can be set to true when
1262  /// constructing the canonical type of a Objective-C type parameter.
1264  ArrayRef<ObjCProtocolDecl *> protocols, bool &hasError,
1265  bool allowOnPointerType = false) const;
1266 
1267  /// Return the uniqued reference to the type for an Objective-C
1268  /// gc-qualified type.
1269  ///
1270  /// The resulting type has a union of the qualifiers from T and the gc
1271  /// attribute.
1273 
1274  /// Remove the existing address space on the type if it is a pointer size
1275  /// address space and return the type with qualifiers intact.
1277 
1278  /// Return the uniqued reference to the type for a \c restrict
1279  /// qualified type.
1280  ///
1281  /// The resulting type has a union of the qualifiers from \p T and
1282  /// \c restrict.
1285  }
1286 
1287  /// Return the uniqued reference to the type for a \c volatile
1288  /// qualified type.
1289  ///
1290  /// The resulting type has a union of the qualifiers from \p T and
1291  /// \c volatile.
1294  }
1295 
1296  /// Return the uniqued reference to the type for a \c const
1297  /// qualified type.
1298  ///
1299  /// The resulting type has a union of the qualifiers from \p T and \c const.
1300  ///
1301  /// It can be reasonably expected that this will always be equivalent to
1302  /// calling T.withConst().
1303  QualType getConstType(QualType T) const { return T.withConst(); }
1304 
1305  /// Change the ExtInfo on a function type.
1306  const FunctionType *adjustFunctionType(const FunctionType *Fn,
1307  FunctionType::ExtInfo EInfo);
1308 
1309  /// Adjust the given function result type.
1311 
1312  /// Change the result type of a function type once it is deduced.
1314 
1315  /// Get a function type and produce the equivalent function type with the
1316  /// specified exception specification. Type sugar that can be present on a
1317  /// declaration of a function with an exception specification is permitted
1318  /// and preserved. Other type sugar (for instance, typedefs) is not.
1320  QualType Orig, const FunctionProtoType::ExceptionSpecInfo &ESI) const;
1321 
1322  /// Determine whether two function types are the same, ignoring
1323  /// exception specifications in cases where they're part of the type.
1325 
1326  /// Change the exception specification on a function once it is
1327  /// delay-parsed, instantiated, or computed.
1330  bool AsWritten = false);
1331 
1332  /// Get a function type and produce the equivalent function type where
1333  /// pointer size address spaces in the return type and parameter tyeps are
1334  /// replaced with the default address space.
1336 
1337  /// Determine whether two function types are the same, ignoring pointer sizes
1338  /// in the return type and parameter types.
1340 
1341  /// Return the uniqued reference to the type for a complex
1342  /// number with the specified element type.
1343  QualType getComplexType(QualType T) const;
1346  }
1347 
1348  /// Return the uniqued reference to the type for a pointer to
1349  /// the specified type.
1350  QualType getPointerType(QualType T) const;
1353  }
1354 
1355  /// Return the uniqued reference to a type adjusted from the original
1356  /// type to a new type.
1357  QualType getAdjustedType(QualType Orig, QualType New) const;
1360  getAdjustedType((QualType)Orig, (QualType)New));
1361  }
1362 
1363  /// Return the uniqued reference to the decayed version of the given
1364  /// type. Can only be called on array and function types which decay to
1365  /// pointer types.
1366  QualType getDecayedType(QualType T) const;
1369  }
1370  /// Return the uniqued reference to a specified decay from the original
1371  /// type to the decayed type.
1372  QualType getDecayedType(QualType Orig, QualType Decayed) const;
1373 
1374  /// Return the uniqued reference to the atomic type for the specified
1375  /// type.
1376  QualType getAtomicType(QualType T) const;
1377 
1378  /// Return the uniqued reference to the type for a block of the
1379  /// specified type.
1381 
1382  /// Gets the struct used to keep track of the descriptor for pointer to
1383  /// blocks.
1385 
1386  /// Return a read_only pipe type for the specified type.
1388 
1389  /// Return a write_only pipe type for the specified type.
1391 
1392  /// Return a bit-precise integer type with the specified signedness and bit
1393  /// count.
1394  QualType getBitIntType(bool Unsigned, unsigned NumBits) const;
1395 
1396  /// Return a dependent bit-precise integer type with the specified signedness
1397  /// and bit count.
1398  QualType getDependentBitIntType(bool Unsigned, Expr *BitsExpr) const;
1399 
1400  /// Gets the struct used to keep track of the extended descriptor for
1401  /// pointer to blocks.
1403 
1404  /// Map an AST Type to an OpenCLTypeKind enum value.
1405  OpenCLTypeKind getOpenCLTypeKind(const Type *T) const;
1406 
1407  /// Get address space for OpenCL type.
1408  LangAS getOpenCLTypeAddrSpace(const Type *T) const;
1409 
1410  /// Returns default address space based on OpenCL version and enabled features
1412  return LangOpts.OpenCLGenericAddressSpace ? LangAS::opencl_generic
1414  }
1415 
1417  cudaConfigureCallDecl = FD;
1418  }
1419 
1421  return cudaConfigureCallDecl;
1422  }
1423 
1424  /// Returns true iff we need copy/dispose helpers for the given type.
1425  bool BlockRequiresCopying(QualType Ty, const VarDecl *D);
1426 
1427  /// Returns true, if given type has a known lifetime. HasByrefExtendedLayout
1428  /// is set to false in this case. If HasByrefExtendedLayout returns true,
1429  /// byref variable has extended lifetime.
1430  bool getByrefLifetime(QualType Ty,
1431  Qualifiers::ObjCLifetime &Lifetime,
1432  bool &HasByrefExtendedLayout) const;
1433 
1434  /// Return the uniqued reference to the type for an lvalue reference
1435  /// to the specified type.
1436  QualType getLValueReferenceType(QualType T, bool SpelledAsLValue = true)
1437  const;
1438 
1439  /// Return the uniqued reference to the type for an rvalue reference
1440  /// to the specified type.
1442 
1443  /// Return the uniqued reference to the type for a member pointer to
1444  /// the specified type in the specified class.
1445  ///
1446  /// The class \p Cls is a \c Type because it could be a dependent name.
1447  QualType getMemberPointerType(QualType T, const Type *Cls) const;
1448 
1449  /// Return a non-unique reference to the type for a variable array of
1450  /// the specified element type.
1451  QualType getVariableArrayType(QualType EltTy, Expr *NumElts,
1453  unsigned IndexTypeQuals,
1454  SourceRange Brackets) const;
1455 
1456  /// Return a non-unique reference to the type for a dependently-sized
1457  /// array of the specified element type.
1458  ///
1459  /// FIXME: We will need these to be uniqued, or at least comparable, at some
1460  /// point.
1463  unsigned IndexTypeQuals,
1464  SourceRange Brackets) const;
1465 
1466  /// Return a unique reference to the type for an incomplete array of
1467  /// the specified element type.
1470  unsigned IndexTypeQuals) const;
1471 
1472  /// Return the unique reference to the type for a constant array of
1473  /// the specified element type.
1474  QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize,
1475  const Expr *SizeExpr,
1477  unsigned IndexTypeQuals) const;
1478 
1479  /// Return a type for a constant array for a string literal of the
1480  /// specified element type and length.
1481  QualType getStringLiteralArrayType(QualType EltTy, unsigned Length) const;
1482 
1483  /// Returns a vla type where known sizes are replaced with [*].
1485 
1486  // Convenience struct to return information about a builtin vector type.
1489  llvm::ElementCount EC;
1490  unsigned NumVectors;
1492  unsigned NumVectors)
1494  };
1495 
1496  /// Returns the element type, element count and number of vectors
1497  /// (in case of tuple) for a builtin vector type.
1498  BuiltinVectorTypeInfo
1499  getBuiltinVectorTypeInfo(const BuiltinType *VecTy) const;
1500 
1501  /// Return the unique reference to a scalable vector type of the specified
1502  /// element type and scalable number of elements.
1503  ///
1504  /// \pre \p EltTy must be a built-in type.
1505  QualType getScalableVectorType(QualType EltTy, unsigned NumElts) const;
1506 
1507  /// Return the unique reference to a vector type of the specified
1508  /// element type and size.
1509  ///
1510  /// \pre \p VectorType must be a built-in type.
1511  QualType getVectorType(QualType VectorType, unsigned NumElts,
1512  VectorType::VectorKind VecKind) const;
1513  /// Return the unique reference to the type for a dependently sized vector of
1514  /// the specified element type.
1516  SourceLocation AttrLoc,
1517  VectorType::VectorKind VecKind) const;
1518 
1519  /// Return the unique reference to an extended vector type
1520  /// of the specified element type and size.
1521  ///
1522  /// \pre \p VectorType must be a built-in type.
1523  QualType getExtVectorType(QualType VectorType, unsigned NumElts) const;
1524 
1525  /// \pre Return a non-unique reference to the type for a dependently-sized
1526  /// vector of the specified element type.
1527  ///
1528  /// FIXME: We will need these to be uniqued, or at least comparable, at some
1529  /// point.
1531  Expr *SizeExpr,
1532  SourceLocation AttrLoc) const;
1533 
1534  /// Return the unique reference to the matrix type of the specified element
1535  /// type and size
1536  ///
1537  /// \pre \p ElementType must be a valid matrix element type (see
1538  /// MatrixType::isValidElementType).
1539  QualType getConstantMatrixType(QualType ElementType, unsigned NumRows,
1540  unsigned NumColumns) const;
1541 
1542  /// Return the unique reference to the matrix type of the specified element
1543  /// type and size
1544  QualType getDependentSizedMatrixType(QualType ElementType, Expr *RowExpr,
1545  Expr *ColumnExpr,
1546  SourceLocation AttrLoc) const;
1547 
1549  Expr *AddrSpaceExpr,
1550  SourceLocation AttrLoc) const;
1551 
1552  /// Return a K&R style C function type like 'int()'.
1554  const FunctionType::ExtInfo &Info) const;
1555 
1557  return getFunctionNoProtoType(ResultTy, FunctionType::ExtInfo());
1558  }
1559 
1560  /// Return a normal function type with a typed argument list.
1562  const FunctionProtoType::ExtProtoInfo &EPI) const {
1563  return getFunctionTypeInternal(ResultTy, Args, EPI, false);
1564  }
1565 
1567 
1568 private:
1569  /// Return a normal function type with a typed argument list.
1570  QualType getFunctionTypeInternal(QualType ResultTy, ArrayRef<QualType> Args,
1572  bool OnlyWantCanonical) const;
1573  QualType
1574  getAutoTypeInternal(QualType DeducedType, AutoTypeKeyword Keyword,
1575  bool IsDependent, bool IsPack = false,
1576  ConceptDecl *TypeConstraintConcept = nullptr,
1577  ArrayRef<TemplateArgument> TypeConstraintArgs = {},
1578  bool IsCanon = false) const;
1579 
1580 public:
1581  /// Return the unique reference to the type for the specified type
1582  /// declaration.
1584  const TypeDecl *PrevDecl = nullptr) const {
1585  assert(Decl && "Passed null for Decl param");
1586  if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0);
1587 
1588  if (PrevDecl) {
1589  assert(PrevDecl->TypeForDecl && "previous decl has no TypeForDecl");
1590  Decl->TypeForDecl = PrevDecl->TypeForDecl;
1591  return QualType(PrevDecl->TypeForDecl, 0);
1592  }
1593 
1594  return getTypeDeclTypeSlow(Decl);
1595  }
1596 
1597  QualType getUsingType(const UsingShadowDecl *Found,
1598  QualType Underlying) const;
1599 
1600  /// Return the unique reference to the type for the specified
1601  /// typedef-name decl.
1603  QualType Underlying = QualType()) const;
1604 
1605  QualType getRecordType(const RecordDecl *Decl) const;
1606 
1607  QualType getEnumType(const EnumDecl *Decl) const;
1608 
1609  QualType
1611 
1613 
1614  QualType getAttributedType(attr::Kind attrKind, QualType modifiedType,
1615  QualType equivalentType) const;
1616 
1617  QualType getBTFTagAttributedType(const BTFTypeTagAttr *BTFAttr,
1618  QualType Wrapped);
1619 
1621  QualType Replacement,
1622  Optional<unsigned> PackIndex) const;
1623  QualType
1625  const TemplateArgument &ArgPack);
1626 
1627  QualType
1628  getTemplateTypeParmType(unsigned Depth, unsigned Index,
1629  bool ParameterPack,
1630  TemplateTypeParmDecl *ParmDecl = nullptr) const;
1631 
1634  QualType Canon = QualType()) const;
1635 
1636  QualType
1638  ArrayRef<TemplateArgument> Args) const;
1639 
1642  QualType Canon = QualType()) const;
1643 
1644  TypeSourceInfo *
1646  const TemplateArgumentListInfo &Args,
1647  QualType Canon = QualType()) const;
1648 
1649  QualType getParenType(QualType NamedType) const;
1650 
1652  const IdentifierInfo *MacroII) const;
1653 
1655  NestedNameSpecifier *NNS, QualType NamedType,
1656  TagDecl *OwnedTagDecl = nullptr) const;
1658  NestedNameSpecifier *NNS,
1659  const IdentifierInfo *Name,
1660  QualType Canon = QualType()) const;
1661 
1663  NestedNameSpecifier *NNS,
1664  const IdentifierInfo *Name,
1665  const TemplateArgumentListInfo &Args) const;
1668  const IdentifierInfo *Name, ArrayRef<TemplateArgument> Args) const;
1669 
1671 
1672  /// Get a template argument list with one argument per template parameter
1673  /// in a template parameter list, such as for the injected class name of
1674  /// a class template.
1677 
1678  /// Form a pack expansion type with the given pattern.
1679  /// \param NumExpansions The number of expansions for the pack, if known.
1680  /// \param ExpectPackInType If \c false, we should not expect \p Pattern to
1681  /// contain an unexpanded pack. This only makes sense if the pack
1682  /// expansion is used in a context where the arity is inferred from
1683  /// elsewhere, such as if the pattern contains a placeholder type or
1684  /// if this is the canonical type of another pack expansion type.
1686  Optional<unsigned> NumExpansions,
1687  bool ExpectPackInType = true);
1688 
1690  ObjCInterfaceDecl *PrevDecl = nullptr) const;
1691 
1692  /// Legacy interface: cannot provide type arguments or __kindof.
1694  ObjCProtocolDecl * const *Protocols,
1695  unsigned NumProtocols) const;
1696 
1698  ArrayRef<QualType> typeArgs,
1699  ArrayRef<ObjCProtocolDecl *> protocols,
1700  bool isKindOf) const;
1701 
1703  ArrayRef<ObjCProtocolDecl *> protocols) const;
1705  ObjCTypeParamDecl *New) const;
1706 
1708 
1709  /// QIdProtocolsAdoptObjCObjectProtocols - Checks that protocols in
1710  /// QT's qualified-id protocol list adopt all protocols in IDecl's list
1711  /// of protocols.
1713  ObjCInterfaceDecl *IDecl);
1714 
1715  /// Return a ObjCObjectPointerType type for the given ObjCObjectType.
1717 
1718  /// C2x feature and GCC extension.
1721 
1722  QualType getReferenceQualifiedType(const Expr *e) const;
1723 
1724  /// C++11 decltype.
1725  QualType getDecltypeType(Expr *e, QualType UnderlyingType) const;
1726 
1727  /// Unary type transforms
1728  QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType,
1729  UnaryTransformType::UTTKind UKind) const;
1730 
1731  /// C++11 deduced auto type.
1733  bool IsDependent, bool IsPack = false,
1734  ConceptDecl *TypeConstraintConcept = nullptr,
1735  ArrayRef<TemplateArgument> TypeConstraintArgs ={}) const;
1736 
1737  /// C++11 deduction pattern for 'auto' type.
1738  QualType getAutoDeductType() const;
1739 
1740  /// C++11 deduction pattern for 'auto &&' type.
1741  QualType getAutoRRefDeductType() const;
1742 
1743  /// C++17 deduced class template specialization type.
1744  QualType getDeducedTemplateSpecializationType(TemplateName Template,
1745  QualType DeducedType,
1746  bool IsDependent) const;
1747 
1748  /// Return the unique reference to the type for the specified TagDecl
1749  /// (struct/union/class/enum) decl.
1750  QualType getTagDeclType(const TagDecl *Decl) const;
1751 
1752  /// Return the unique type for "size_t" (C99 7.17), defined in
1753  /// <stddef.h>.
1754  ///
1755  /// The sizeof operator requires this (C99 6.5.3.4p4).
1756  CanQualType getSizeType() const;
1757 
1758  /// Return the unique signed counterpart of
1759  /// the integer type corresponding to size_t.
1761 
1762  /// Return the unique type for "intmax_t" (C99 7.18.1.5), defined in
1763  /// <stdint.h>.
1764  CanQualType getIntMaxType() const;
1765 
1766  /// Return the unique type for "uintmax_t" (C99 7.18.1.5), defined in
1767  /// <stdint.h>.
1768  CanQualType getUIntMaxType() const;
1769 
1770  /// Return the unique wchar_t type available in C++ (and available as
1771  /// __wchar_t as a Microsoft extension).
1772  QualType getWCharType() const { return WCharTy; }
1773 
1774  /// Return the type of wide characters. In C++, this returns the
1775  /// unique wchar_t type. In C99, this returns a type compatible with the type
1776  /// defined in <stddef.h> as defined by the target.
1778 
1779  /// Return the type of "signed wchar_t".
1780  ///
1781  /// Used when in C++, as a GCC extension.
1782  QualType getSignedWCharType() const;
1783 
1784  /// Return the type of "unsigned wchar_t".
1785  ///
1786  /// Used when in C++, as a GCC extension.
1788 
1789  /// In C99, this returns a type compatible with the type
1790  /// defined in <stddef.h> as defined by the target.
1791  QualType getWIntType() const { return WIntTy; }
1792 
1793  /// Return a type compatible with "intptr_t" (C99 7.18.1.4),
1794  /// as defined by the target.
1795  QualType getIntPtrType() const;
1796 
1797  /// Return a type compatible with "uintptr_t" (C99 7.18.1.4),
1798  /// as defined by the target.
1799  QualType getUIntPtrType() const;
1800 
1801  /// Return the unique type for "ptrdiff_t" (C99 7.17) defined in
1802  /// <stddef.h>. Pointer - pointer requires this (C99 6.5.6p9).
1803  QualType getPointerDiffType() const;
1804 
1805  /// Return the unique unsigned counterpart of "ptrdiff_t"
1806  /// integer type. The standard (C11 7.21.6.1p7) refers to this type
1807  /// in the definition of %tu format specifier.
1809 
1810  /// Return the unique type for "pid_t" defined in
1811  /// <sys/types.h>. We need this to compute the correct type for vfork().
1812  QualType getProcessIDType() const;
1813 
1814  /// Return the C structure type used to represent constant CFStrings.
1816 
1817  /// Returns the C struct type for objc_super
1818  QualType getObjCSuperType() const;
1819  void setObjCSuperType(QualType ST) { ObjCSuperType = ST; }
1820 
1821  /// Get the structure type used to representation CFStrings, or NULL
1822  /// if it hasn't yet been built.
1824  if (CFConstantStringTypeDecl)
1825  return getTypedefType(CFConstantStringTypeDecl);
1826  return QualType();
1827  }
1831 
1832  // This setter/getter represents the ObjC type for an NSConstantString.
1835  return ObjCConstantStringType;
1836  }
1837 
1839  return ObjCNSStringType;
1840  }
1841 
1843  ObjCNSStringType = T;
1844  }
1845 
1846  /// Retrieve the type that \c id has been defined to, which may be
1847  /// different from the built-in \c id if \c id has been typedef'd.
1849  if (ObjCIdRedefinitionType.isNull())
1850  return getObjCIdType();
1851  return ObjCIdRedefinitionType;
1852  }
1853 
1854  /// Set the user-written type that redefines \c id.
1856  ObjCIdRedefinitionType = RedefType;
1857  }
1858 
1859  /// Retrieve the type that \c Class has been defined to, which may be
1860  /// different from the built-in \c Class if \c Class has been typedef'd.
1862  if (ObjCClassRedefinitionType.isNull())
1863  return getObjCClassType();
1864  return ObjCClassRedefinitionType;
1865  }
1866 
1867  /// Set the user-written type that redefines 'SEL'.
1869  ObjCClassRedefinitionType = RedefType;
1870  }
1871 
1872  /// Retrieve the type that 'SEL' has been defined to, which may be
1873  /// different from the built-in 'SEL' if 'SEL' has been typedef'd.
1875  if (ObjCSelRedefinitionType.isNull())
1876  return getObjCSelType();
1877  return ObjCSelRedefinitionType;
1878  }
1879 
1880  /// Set the user-written type that redefines 'SEL'.
1882  ObjCSelRedefinitionType = RedefType;
1883  }
1884 
1885  /// Retrieve the identifier 'NSObject'.
1887  if (!NSObjectName) {
1888  NSObjectName = &Idents.get("NSObject");
1889  }
1890 
1891  return NSObjectName;
1892  }
1893 
1894  /// Retrieve the identifier 'NSCopying'.
1896  if (!NSCopyingName) {
1897  NSCopyingName = &Idents.get("NSCopying");
1898  }
1899 
1900  return NSCopyingName;
1901  }
1902 
1904 
1905  CanQualType getNSIntegerType() const;
1906 
1907  /// Retrieve the identifier 'bool'.
1909  if (!BoolName)
1910  BoolName = &Idents.get("bool");
1911  return BoolName;
1912  }
1913 
1915  if (!MakeIntegerSeqName)
1916  MakeIntegerSeqName = &Idents.get("__make_integer_seq");
1917  return MakeIntegerSeqName;
1918  }
1919 
1921  if (!TypePackElementName)
1922  TypePackElementName = &Idents.get("__type_pack_element");
1923  return TypePackElementName;
1924  }
1925 
1926  /// Retrieve the Objective-C "instancetype" type, if already known;
1927  /// otherwise, returns a NULL type;
1930  }
1931 
1932  /// Retrieve the typedef declaration corresponding to the Objective-C
1933  /// "instancetype" type.
1935 
1936  /// Set the type for the C FILE type.
1937  void setFILEDecl(TypeDecl *FILEDecl) { this->FILEDecl = FILEDecl; }
1938 
1939  /// Retrieve the C FILE type.
1941  if (FILEDecl)
1942  return getTypeDeclType(FILEDecl);
1943  return QualType();
1944  }
1945 
1946  /// Set the type for the C jmp_buf type.
1947  void setjmp_bufDecl(TypeDecl *jmp_bufDecl) {
1948  this->jmp_bufDecl = jmp_bufDecl;
1949  }
1950 
1951  /// Retrieve the C jmp_buf type.
1953  if (jmp_bufDecl)
1954  return getTypeDeclType(jmp_bufDecl);
1955  return QualType();
1956  }
1957 
1958  /// Set the type for the C sigjmp_buf type.
1959  void setsigjmp_bufDecl(TypeDecl *sigjmp_bufDecl) {
1960  this->sigjmp_bufDecl = sigjmp_bufDecl;
1961  }
1962 
1963  /// Retrieve the C sigjmp_buf type.
1965  if (sigjmp_bufDecl)
1966  return getTypeDeclType(sigjmp_bufDecl);
1967  return QualType();
1968  }
1969 
1970  /// Set the type for the C ucontext_t type.
1971  void setucontext_tDecl(TypeDecl *ucontext_tDecl) {
1972  this->ucontext_tDecl = ucontext_tDecl;
1973  }
1974 
1975  /// Retrieve the C ucontext_t type.
1977  if (ucontext_tDecl)
1978  return getTypeDeclType(ucontext_tDecl);
1979  return QualType();
1980  }
1981 
1982  /// The result type of logical operations, '<', '>', '!=', etc.
1984  return getLangOpts().CPlusPlus ? BoolTy : IntTy;
1985  }
1986 
1987  /// Emit the Objective-CC type encoding for the given type \p T into
1988  /// \p S.
1989  ///
1990  /// If \p Field is specified then record field names are also encoded.
1992  const FieldDecl *Field=nullptr,
1993  QualType *NotEncodedT=nullptr) const;
1994 
1995  /// Emit the Objective-C property type encoding for the given
1996  /// type \p T into \p S.
1998 
1999  void getLegacyIntegralTypeEncoding(QualType &t) const;
2000 
2001  /// Put the string version of the type qualifiers \p QT into \p S.
2003  std::string &S) const;
2004 
2005  /// Emit the encoded type for the function \p Decl into \p S.
2006  ///
2007  /// This is in the same format as Objective-C method encodings.
2008  ///
2009  /// \returns true if an error occurred (e.g., because one of the parameter
2010  /// types is incomplete), false otherwise.
2012 
2013  /// Emit the encoded type for the method declaration \p Decl into
2014  /// \p S.
2016  bool Extended = false) const;
2017 
2018  /// Return the encoded type for this block declaration.
2020 
2021  /// getObjCEncodingForPropertyDecl - Return the encoded type for
2022  /// this method declaration. If non-NULL, Container must be either
2023  /// an ObjCCategoryImplDecl or ObjCImplementationDecl; it should
2024  /// only be NULL when getting encodings for protocol properties.
2026  const Decl *Container) const;
2027 
2029  ObjCProtocolDecl *rProto) const;
2030 
2032  const ObjCPropertyDecl *PD,
2033  const Decl *Container) const;
2034 
2035  /// Return the size of type \p T for Objective-C encoding purpose,
2036  /// in characters.
2038 
2039  /// Retrieve the typedef corresponding to the predefined \c id type
2040  /// in Objective-C.
2041  TypedefDecl *getObjCIdDecl() const;
2042 
2043  /// Represents the Objective-CC \c id type.
2044  ///
2045  /// This is set up lazily, by Sema. \c id is always a (typedef for a)
2046  /// pointer type, a pointer to a struct.
2048  return getTypeDeclType(getObjCIdDecl());
2049  }
2050 
2051  /// Retrieve the typedef corresponding to the predefined 'SEL' type
2052  /// in Objective-C.
2053  TypedefDecl *getObjCSelDecl() const;
2054 
2055  /// Retrieve the type that corresponds to the predefined Objective-C
2056  /// 'SEL' type.
2058  return getTypeDeclType(getObjCSelDecl());
2059  }
2060 
2061  /// Retrieve the typedef declaration corresponding to the predefined
2062  /// Objective-C 'Class' type.
2063  TypedefDecl *getObjCClassDecl() const;
2064 
2065  /// Represents the Objective-C \c Class type.
2066  ///
2067  /// This is set up lazily, by Sema. \c Class is always a (typedef for a)
2068  /// pointer type, a pointer to a struct.
2071  }
2072 
2073  /// Retrieve the Objective-C class declaration corresponding to
2074  /// the predefined \c Protocol class.
2076 
2077  /// Retrieve declaration of 'BOOL' typedef
2079  return BOOLDecl;
2080  }
2081 
2082  /// Save declaration of 'BOOL' typedef
2084  BOOLDecl = TD;
2085  }
2086 
2087  /// type of 'BOOL' type.
2089  return getTypeDeclType(getBOOLDecl());
2090  }
2091 
2092  /// Retrieve the type of the Objective-C \c Protocol class.
2095  }
2096 
2097  /// Retrieve the C type declaration corresponding to the predefined
2098  /// \c __builtin_va_list type.
2100 
2101  /// Retrieve the type of the \c __builtin_va_list type.
2104  }
2105 
2106  /// Retrieve the C type declaration corresponding to the predefined
2107  /// \c __va_list_tag type used to help define the \c __builtin_va_list type
2108  /// for some targets.
2109  Decl *getVaListTagDecl() const;
2110 
2111  /// Retrieve the C type declaration corresponding to the predefined
2112  /// \c __builtin_ms_va_list type.
2114 
2115  /// Retrieve the type of the \c __builtin_ms_va_list type.
2118  }
2119 
2120  /// Retrieve the implicitly-predeclared 'struct _GUID' declaration.
2122 
2123  /// Retrieve the implicitly-predeclared 'struct _GUID' type.
2125  assert(MSGuidTagDecl && "asked for GUID type but MS extensions disabled");
2126  return getTagDeclType(MSGuidTagDecl);
2127  }
2128 
2129  /// Return whether a declaration to a builtin is allowed to be
2130  /// overloaded/redeclared.
2131  bool canBuiltinBeRedeclared(const FunctionDecl *) const;
2132 
2133  /// Return a type with additional \c const, \c volatile, or
2134  /// \c restrict qualifiers.
2135  QualType getCVRQualifiedType(QualType T, unsigned CVR) const {
2136  return getQualifiedType(T, Qualifiers::fromCVRMask(CVR));
2137  }
2138 
2139  /// Un-split a SplitQualType.
2141  return getQualifiedType(split.Ty, split.Quals);
2142  }
2143 
2144  /// Return a type with additional qualifiers.
2146  if (!Qs.hasNonFastQualifiers())
2147  return T.withFastQualifiers(Qs.getFastQualifiers());
2148  QualifierCollector Qc(Qs);
2149  const Type *Ptr = Qc.strip(T);
2150  return getExtQualType(Ptr, Qc);
2151  }
2152 
2153  /// Return a type with additional qualifiers.
2155  if (!Qs.hasNonFastQualifiers())
2156  return QualType(T, Qs.getFastQualifiers());
2157  return getExtQualType(T, Qs);
2158  }
2159 
2160  /// Return a type with the given lifetime qualifier.
2161  ///
2162  /// \pre Neither type.ObjCLifetime() nor \p lifetime may be \c OCL_None.
2164  Qualifiers::ObjCLifetime lifetime) {
2165  assert(type.getObjCLifetime() == Qualifiers::OCL_None);
2166  assert(lifetime != Qualifiers::OCL_None);
2167 
2168  Qualifiers qs;
2169  qs.addObjCLifetime(lifetime);
2170  return getQualifiedType(type, qs);
2171  }
2172 
2173  /// getUnqualifiedObjCPointerType - Returns version of
2174  /// Objective-C pointer type with lifetime qualifier removed.
2176  if (!type.getTypePtr()->isObjCObjectPointerType() ||
2177  !type.getQualifiers().hasObjCLifetime())
2178  return type;
2179  Qualifiers Qs = type.getQualifiers();
2180  Qs.removeObjCLifetime();
2181  return getQualifiedType(type.getUnqualifiedType(), Qs);
2182  }
2183 
2184  unsigned char getFixedPointScale(QualType Ty) const;
2185  unsigned char getFixedPointIBits(QualType Ty) const;
2186  llvm::FixedPointSemantics getFixedPointSemantics(QualType Ty) const;
2187  llvm::APFixedPoint getFixedPointMax(QualType Ty) const;
2188  llvm::APFixedPoint getFixedPointMin(QualType Ty) const;
2189 
2191  SourceLocation NameLoc) const;
2192 
2194  UnresolvedSetIterator End) const;
2196 
2198  bool TemplateKeyword,
2199  TemplateName Template) const;
2200 
2202  const IdentifierInfo *Name) const;
2204  OverloadedOperatorKind Operator) const;
2206  TemplateName replacement) const;
2208  const TemplateArgument &ArgPack) const;
2209 
2211  /// No error
2213 
2214  /// Missing a type
2216 
2217  /// Missing a type from <stdio.h>
2219 
2220  /// Missing a type from <setjmp.h>
2222 
2223  /// Missing a type from <ucontext.h>
2225  };
2226 
2227  QualType DecodeTypeStr(const char *&Str, const ASTContext &Context,
2229  bool &RequireICE, bool AllowTypeModifiers) const;
2230 
2231  /// Return the type for the specified builtin.
2232  ///
2233  /// If \p IntegerConstantArgs is non-null, it is filled in with a bitmask of
2234  /// arguments to the builtin that are required to be integer constant
2235  /// expressions.
2236  QualType GetBuiltinType(unsigned ID, GetBuiltinTypeError &Error,
2237  unsigned *IntegerConstantArgs = nullptr) const;
2238 
2239  /// Types and expressions required to build C++2a three-way comparisons
2240  /// using operator<=>, including the values return by builtin <=> operators.
2242 
2243 private:
2244  CanQualType getFromTargetType(unsigned Type) const;
2245  TypeInfo getTypeInfoImpl(const Type *T) const;
2246 
2247  //===--------------------------------------------------------------------===//
2248  // Type Predicates.
2249  //===--------------------------------------------------------------------===//
2250 
2251 public:
2252  /// Return one of the GCNone, Weak or Strong Objective-C garbage
2253  /// collection attributes.
2255 
2256  /// Return true if the given vector types are of the same unqualified
2257  /// type or if they are equivalent to the same GCC vector type.
2258  ///
2259  /// \note This ignores whether they are target-specific (AltiVec or Neon)
2260  /// types.
2261  bool areCompatibleVectorTypes(QualType FirstVec, QualType SecondVec);
2262 
2263  /// Return true if the given types are an SVE builtin and a VectorType that
2264  /// is a fixed-length representation of the SVE builtin for a specific
2265  /// vector-length.
2266  bool areCompatibleSveTypes(QualType FirstType, QualType SecondType);
2267 
2268  /// Return true if the given vector types are lax-compatible SVE vector types,
2269  /// false otherwise.
2270  bool areLaxCompatibleSveTypes(QualType FirstType, QualType SecondType);
2271 
2272  /// Return true if the type has been explicitly qualified with ObjC ownership.
2273  /// A type may be implicitly qualified with ownership under ObjC ARC, and in
2274  /// some cases the compiler treats these differently.
2275  bool hasDirectOwnershipQualifier(QualType Ty) const;
2276 
2277  /// Return true if this is an \c NSObject object with its \c NSObject
2278  /// attribute set.
2279  static bool isObjCNSObjectType(QualType Ty) {
2280  return Ty->isObjCNSObjectType();
2281  }
2282 
2283  //===--------------------------------------------------------------------===//
2284  // Type Sizing and Analysis
2285  //===--------------------------------------------------------------------===//
2286 
2287  /// Return the APFloat 'semantics' for the specified scalar floating
2288  /// point type.
2289  const llvm::fltSemantics &getFloatTypeSemantics(QualType T) const;
2290 
2291  /// Get the size and alignment of the specified complete type in bits.
2292  TypeInfo getTypeInfo(const Type *T) const;
2294 
2295  /// Get default simd alignment of the specified complete type in bits.
2296  unsigned getOpenMPDefaultSimdAlign(QualType T) const;
2297 
2298  /// Return the size of the specified (complete) type \p T, in bits.
2300  uint64_t getTypeSize(const Type *T) const { return getTypeInfo(T).Width; }
2301 
2302  /// Return the size of the character type, in bits.
2304  return getTypeSize(CharTy);
2305  }
2306 
2307  /// Convert a size in bits to a size in characters.
2308  CharUnits toCharUnitsFromBits(int64_t BitSize) const;
2309 
2310  /// Convert a size in characters to a size in bits.
2311  int64_t toBits(CharUnits CharSize) const;
2312 
2313  /// Return the size of the specified (complete) type \p T, in
2314  /// characters.
2316  CharUnits getTypeSizeInChars(const Type *T) const;
2317 
2319  if (Ty->isIncompleteType() || Ty->isDependentType())
2320  return None;
2321  return getTypeSizeInChars(Ty);
2322  }
2323 
2325  return getTypeSizeInCharsIfKnown(QualType(Ty, 0));
2326  }
2327 
2328  /// Return the ABI-specified alignment of a (complete) type \p T, in
2329  /// bits.
2330  unsigned getTypeAlign(QualType T) const { return getTypeInfo(T).Align; }
2331  unsigned getTypeAlign(const Type *T) const { return getTypeInfo(T).Align; }
2332 
2333  /// Return the ABI-specified natural alignment of a (complete) type \p T,
2334  /// before alignment adjustments, in bits.
2335  ///
2336  /// This alignment is curently used only by ARM and AArch64 when passing
2337  /// arguments of a composite type.
2338  unsigned getTypeUnadjustedAlign(QualType T) const {
2339  return getTypeUnadjustedAlign(T.getTypePtr());
2340  }
2341  unsigned getTypeUnadjustedAlign(const Type *T) const;
2342 
2343  /// Return the alignment of a type, in bits, or 0 if
2344  /// the type is incomplete and we cannot determine the alignment (for
2345  /// example, from alignment attributes). The returned alignment is the
2346  /// Preferred alignment if NeedsPreferredAlignment is true, otherwise is the
2347  /// ABI alignment.
2348  unsigned getTypeAlignIfKnown(QualType T,
2349  bool NeedsPreferredAlignment = false) const;
2350 
2351  /// Return the ABI-specified alignment of a (complete) type \p T, in
2352  /// characters.
2354  CharUnits getTypeAlignInChars(const Type *T) const;
2355 
2356  /// Return the PreferredAlignment of a (complete) type \p T, in
2357  /// characters.
2360  }
2361 
2362  /// getTypeUnadjustedAlignInChars - Return the ABI-specified alignment of a type,
2363  /// in characters, before alignment adjustments. This method does not work on
2364  /// incomplete types.
2367 
2368  // getTypeInfoDataSizeInChars - Return the size of a type, in chars. If the
2369  // type is a record, its data size is returned.
2371 
2372  TypeInfoChars getTypeInfoInChars(const Type *T) const;
2374 
2375  /// Determine if the alignment the type has was required using an
2376  /// alignment attribute.
2377  bool isAlignmentRequired(const Type *T) const;
2378  bool isAlignmentRequired(QualType T) const;
2379 
2380  /// Return the "preferred" alignment of the specified type \p T for
2381  /// the current target, in bits.
2382  ///
2383  /// This can be different than the ABI alignment in cases where it is
2384  /// beneficial for performance or backwards compatibility preserving to
2385  /// overalign a data type. (Note: despite the name, the preferred alignment
2386  /// is ABI-impacting, and not an optimization.)
2387  unsigned getPreferredTypeAlign(QualType T) const {
2388  return getPreferredTypeAlign(T.getTypePtr());
2389  }
2390  unsigned getPreferredTypeAlign(const Type *T) const;
2391 
2392  /// Return the default alignment for __attribute__((aligned)) on
2393  /// this target, to be used if no alignment value is specified.
2395 
2396  /// Return the alignment in bits that should be given to a
2397  /// global variable with type \p T.
2398  unsigned getAlignOfGlobalVar(QualType T) const;
2399 
2400  /// Return the alignment in characters that should be given to a
2401  /// global variable with type \p T.
2403 
2404  /// Return a conservative estimate of the alignment of the specified
2405  /// decl \p D.
2406  ///
2407  /// \pre \p D must not be a bitfield type, as bitfields do not have a valid
2408  /// alignment.
2409  ///
2410  /// If \p ForAlignof, references are treated like their underlying type
2411  /// and large arrays don't get any special treatment. If not \p ForAlignof
2412  /// it computes the value expected by CodeGen: references are treated like
2413  /// pointers and large arrays get extra alignment.
2414  CharUnits getDeclAlign(const Decl *D, bool ForAlignof = false) const;
2415 
2416  /// Return the alignment (in bytes) of the thrown exception object. This is
2417  /// only meaningful for targets that allocate C++ exceptions in a system
2418  /// runtime, such as those using the Itanium C++ ABI.
2420 
2421  /// Get or compute information about the layout of the specified
2422  /// record (struct/union/class) \p D, which indicates its size and field
2423  /// position information.
2424  const ASTRecordLayout &getASTRecordLayout(const RecordDecl *D) const;
2425 
2426  /// Get or compute information about the layout of the specified
2427  /// Objective-C interface.
2429  const;
2430 
2431  void DumpRecordLayout(const RecordDecl *RD, raw_ostream &OS,
2432  bool Simple = false) const;
2433 
2434  /// Get or compute information about the layout of the specified
2435  /// Objective-C implementation.
2436  ///
2437  /// This may differ from the interface if synthesized ivars are present.
2438  const ASTRecordLayout &
2440 
2441  /// Get our current best idea for the key function of the
2442  /// given record decl, or nullptr if there isn't one.
2443  ///
2444  /// The key function is, according to the Itanium C++ ABI section 5.2.3:
2445  /// ...the first non-pure virtual function that is not inline at the
2446  /// point of class definition.
2447  ///
2448  /// Other ABIs use the same idea. However, the ARM C++ ABI ignores
2449  /// virtual functions that are defined 'inline', which means that
2450  /// the result of this computation can change.
2452 
2453  /// Observe that the given method cannot be a key function.
2454  /// Checks the key-function cache for the method's class and clears it
2455  /// if matches the given declaration.
2456  ///
2457  /// This is used in ABIs where out-of-line definitions marked
2458  /// inline are not considered to be key functions.
2459  ///
2460  /// \param method should be the declaration from the class definition
2461  void setNonKeyFunction(const CXXMethodDecl *method);
2462 
2463  /// Loading virtual member pointers using the virtual inheritance model
2464  /// always results in an adjustment using the vbtable even if the index is
2465  /// zero.
2466  ///
2467  /// This is usually OK because the first slot in the vbtable points
2468  /// backwards to the top of the MDC. However, the MDC might be reusing a
2469  /// vbptr from an nv-base. In this case, the first slot in the vbtable
2470  /// points to the start of the nv-base which introduced the vbptr and *not*
2471  /// the MDC. Modify the NonVirtualBaseAdjustment to account for this.
2473 
2474  /// Get the offset of a FieldDecl or IndirectFieldDecl, in bits.
2475  uint64_t getFieldOffset(const ValueDecl *FD) const;
2476 
2477  /// Get the offset of an ObjCIvarDecl in bits.
2479  const ObjCImplementationDecl *ID,
2480  const ObjCIvarDecl *Ivar) const;
2481 
2482  /// Find the 'this' offset for the member path in a pointer-to-member
2483  /// APValue.
2485 
2486  bool isNearlyEmpty(const CXXRecordDecl *RD) const;
2487 
2489 
2490  /// If \p T is null pointer, assume the target in ASTContext.
2491  MangleContext *createMangleContext(const TargetInfo *T = nullptr);
2492 
2493  /// Creates a device mangle context to correctly mangle lambdas in a mixed
2494  /// architecture compile by setting the lambda mangling number source to the
2495  /// DeviceLambdaManglingNumber. Currently this asserts that the TargetInfo
2496  /// (from the AuxTargetInfo) is a an itanium target.
2498 
2499  void DeepCollectObjCIvars(const ObjCInterfaceDecl *OI, bool leafClass,
2501 
2502  unsigned CountNonClassIvars(const ObjCInterfaceDecl *OI) const;
2503  void CollectInheritedProtocols(const Decl *CDecl,
2505 
2506  /// Return true if the specified type has unique object representations
2507  /// according to (C++17 [meta.unary.prop]p9)
2509 
2510  //===--------------------------------------------------------------------===//
2511  // Type Operators
2512  //===--------------------------------------------------------------------===//
2513 
2514  /// Return the canonical (structural) type corresponding to the
2515  /// specified potentially non-canonical type \p T.
2516  ///
2517  /// The non-canonical version of a type may have many "decorated" versions of
2518  /// types. Decorators can include typedefs, 'typeof' operators, etc. The
2519  /// returned type is guaranteed to be free of any of these, allowing two
2520  /// canonical types to be compared for exact equality with a simple pointer
2521  /// comparison.
2524  }
2525 
2526  const Type *getCanonicalType(const Type *T) const {
2527  return T->getCanonicalTypeInternal().getTypePtr();
2528  }
2529 
2530  /// Return the canonical parameter type corresponding to the specific
2531  /// potentially non-canonical one.
2532  ///
2533  /// Qualifiers are stripped off, functions are turned into function
2534  /// pointers, and arrays decay one level into pointers.
2536 
2537  /// Determine whether the given types \p T1 and \p T2 are equivalent.
2538  bool hasSameType(QualType T1, QualType T2) const {
2539  return getCanonicalType(T1) == getCanonicalType(T2);
2540  }
2541  bool hasSameType(const Type *T1, const Type *T2) const {
2542  return getCanonicalType(T1) == getCanonicalType(T2);
2543  }
2544 
2545  /// Determine whether the given expressions \p X and \p Y are equivalent.
2546  bool hasSameExpr(const Expr *X, const Expr *Y) const;
2547 
2548  /// Return this type as a completely-unqualified array type,
2549  /// capturing the qualifiers in \p Quals.
2550  ///
2551  /// This will remove the minimal amount of sugaring from the types, similar
2552  /// to the behavior of QualType::getUnqualifiedType().
2553  ///
2554  /// \param T is the qualified type, which may be an ArrayType
2555  ///
2556  /// \param Quals will receive the full set of qualifiers that were
2557  /// applied to the array.
2558  ///
2559  /// \returns if this is an array type, the completely unqualified array type
2560  /// that corresponds to it. Otherwise, returns T.getUnqualifiedType().
2562 
2563  /// Determine whether the given types are equivalent after
2564  /// cvr-qualifiers have been removed.
2566  return getCanonicalType(T1).getTypePtr() ==
2568  }
2569 
2571  bool IsParam) const {
2572  auto SubTnullability = SubT->getNullability(*this);
2573  auto SuperTnullability = SuperT->getNullability(*this);
2574  if (SubTnullability.has_value() == SuperTnullability.has_value()) {
2575  // Neither has nullability; return true
2576  if (!SubTnullability)
2577  return true;
2578  // Both have nullability qualifier.
2579  if (*SubTnullability == *SuperTnullability ||
2580  *SubTnullability == NullabilityKind::Unspecified ||
2581  *SuperTnullability == NullabilityKind::Unspecified)
2582  return true;
2583 
2584  if (IsParam) {
2585  // Ok for the superclass method parameter to be "nonnull" and the subclass
2586  // method parameter to be "nullable"
2587  return (*SuperTnullability == NullabilityKind::NonNull &&
2588  *SubTnullability == NullabilityKind::Nullable);
2589  }
2590  // For the return type, it's okay for the superclass method to specify
2591  // "nullable" and the subclass method specify "nonnull"
2592  return (*SuperTnullability == NullabilityKind::Nullable &&
2593  *SubTnullability == NullabilityKind::NonNull);
2594  }
2595  return true;
2596  }
2597 
2598  bool ObjCMethodsAreEqual(const ObjCMethodDecl *MethodDecl,
2599  const ObjCMethodDecl *MethodImp);
2600 
2601  bool UnwrapSimilarTypes(QualType &T1, QualType &T2,
2602  bool AllowPiMismatch = true);
2604  bool AllowPiMismatch = true);
2605 
2606  /// Determine if two types are similar, according to the C++ rules. That is,
2607  /// determine if they are the same other than qualifiers on the initial
2608  /// sequence of pointer / pointer-to-member / array (and in Clang, object
2609  /// pointer) types and their element types.
2610  ///
2611  /// Clang offers a number of qualifiers in addition to the C++ qualifiers;
2612  /// those qualifiers are also ignored in the 'similarity' check.
2613  bool hasSimilarType(QualType T1, QualType T2);
2614 
2615  /// Determine if two types are similar, ignoring only CVR qualifiers.
2616  bool hasCvrSimilarType(QualType T1, QualType T2);
2617 
2618  /// Retrieves the "canonical" nested name specifier for a
2619  /// given nested name specifier.
2620  ///
2621  /// The canonical nested name specifier is a nested name specifier
2622  /// that uniquely identifies a type or namespace within the type
2623  /// system. For example, given:
2624  ///
2625  /// \code
2626  /// namespace N {
2627  /// struct S {
2628  /// template<typename T> struct X { typename T* type; };
2629  /// };
2630  /// }
2631  ///
2632  /// template<typename T> struct Y {
2633  /// typename N::S::X<T>::type member;
2634  /// };
2635  /// \endcode
2636  ///
2637  /// Here, the nested-name-specifier for N::S::X<T>:: will be
2638  /// S::X<template-param-0-0>, since 'S' and 'X' are uniquely defined
2639  /// by declarations in the type system and the canonical type for
2640  /// the template type parameter 'T' is template-param-0-0.
2643 
2644  /// Retrieves the default calling convention for the current target.
2645  CallingConv getDefaultCallingConvention(bool IsVariadic,
2646  bool IsCXXMethod,
2647  bool IsBuiltin = false) const;
2648 
2649  /// Retrieves the "canonical" template name that refers to a
2650  /// given template.
2651  ///
2652  /// The canonical template name is the simplest expression that can
2653  /// be used to refer to a given template. For most templates, this
2654  /// expression is just the template declaration itself. For example,
2655  /// the template std::vector can be referred to via a variety of
2656  /// names---std::vector, \::std::vector, vector (if vector is in
2657  /// scope), etc.---but all of these names map down to the same
2658  /// TemplateDecl, which is used to form the canonical template name.
2659  ///
2660  /// Dependent template names are more interesting. Here, the
2661  /// template name could be something like T::template apply or
2662  /// std::allocator<T>::template rebind, where the nested name
2663  /// specifier itself is dependent. In this case, the canonical
2664  /// template name uses the shortest form of the dependent
2665  /// nested-name-specifier, which itself contains all canonical
2666  /// types, values, and templates.
2668 
2669  /// Determine whether the given template names refer to the same
2670  /// template.
2671  bool hasSameTemplateName(const TemplateName &X, const TemplateName &Y) const;
2672 
2673  /// Determine whether two Friend functions are different because constraints
2674  /// that refer to an enclosing template, according to [temp.friend] p9.
2676  const FunctionDecl *Y) const;
2677 
2678  /// Determine whether the two declarations refer to the same entity.
2679  bool isSameEntity(const NamedDecl *X, const NamedDecl *Y) const;
2680 
2681  /// Determine whether two template parameter lists are similar enough
2682  /// that they may be used in declarations of the same template.
2684  const TemplateParameterList *Y) const;
2685 
2686  /// Determine whether two template parameters are similar enough
2687  /// that they may be used in declarations of the same template.
2688  bool isSameTemplateParameter(const NamedDecl *X, const NamedDecl *Y) const;
2689 
2690  /// Determine whether two 'requires' expressions are similar enough that they
2691  /// may be used in re-declarations.
2692  ///
2693  /// Use of 'requires' isn't mandatory, works with constraints expressed in
2694  /// other ways too.
2695  bool isSameConstraintExpr(const Expr *XCE, const Expr *YCE) const;
2696 
2697  /// Determine whether two type contraint are similar enough that they could
2698  /// used in declarations of the same template.
2699  bool isSameTypeConstraint(const TypeConstraint *XTC,
2700  const TypeConstraint *YTC) const;
2701 
2702  /// Determine whether two default template arguments are similar enough
2703  /// that they may be used in declarations of the same template.
2705  const NamedDecl *Y) const;
2706 
2707  /// Retrieve the "canonical" template argument.
2708  ///
2709  /// The canonical template argument is the simplest template argument
2710  /// (which may be a type, value, expression, or declaration) that
2711  /// expresses the value of the argument.
2713  const;
2714 
2715  /// Type Query functions. If the type is an instance of the specified class,
2716  /// return the Type pointer for the underlying maximally pretty type. This
2717  /// is a member of ASTContext because this may need to do some amount of
2718  /// canonicalization, e.g. to move type qualifiers into the element type.
2719  const ArrayType *getAsArrayType(QualType T) const;
2721  return dyn_cast_or_null<ConstantArrayType>(getAsArrayType(T));
2722  }
2724  return dyn_cast_or_null<VariableArrayType>(getAsArrayType(T));
2725  }
2727  return dyn_cast_or_null<IncompleteArrayType>(getAsArrayType(T));
2728  }
2730  const {
2731  return dyn_cast_or_null<DependentSizedArrayType>(getAsArrayType(T));
2732  }
2733 
2734  /// Return the innermost element type of an array type.
2735  ///
2736  /// For example, will return "int" for int[m][n]
2737  QualType getBaseElementType(const ArrayType *VAT) const;
2738 
2739  /// Return the innermost element type of a type (which needn't
2740  /// actually be an array type).
2742 
2743  /// Return number of constant array elements.
2745 
2746  /// Return number of elements initialized in an ArrayInitLoopExpr.
2747  uint64_t
2749 
2750  /// Perform adjustment on the parameter type of a function.
2751  ///
2752  /// This routine adjusts the given parameter type @p T to the actual
2753  /// parameter type used by semantic analysis (C99 6.7.5.3p[7,8],
2754  /// C++ [dcl.fct]p3). The adjusted parameter type is returned.
2756 
2757  /// Retrieve the parameter type as adjusted for use in the signature
2758  /// of a function, decaying array and function types and removing top-level
2759  /// cv-qualifiers.
2761 
2763 
2764  /// Return the properly qualified result of decaying the specified
2765  /// array type to a pointer.
2766  ///
2767  /// This operation is non-trivial when handling typedefs etc. The canonical
2768  /// type of \p T must be an array type, this returns a pointer to a properly
2769  /// qualified element of the array.
2770  ///
2771  /// See C99 6.7.5.3p7 and C99 6.3.2.1p3.
2773 
2774  /// Return the type that \p PromotableType will promote to: C99
2775  /// 6.3.1.1p2, assuming that \p PromotableType is a promotable integer type.
2776  QualType getPromotedIntegerType(QualType PromotableType) const;
2777 
2778  /// Recurses in pointer/array types until it finds an Objective-C
2779  /// retainable type and returns its ownership.
2781 
2782  /// Whether this is a promotable bitfield reference according
2783  /// to C99 6.3.1.1p2, bullet 2 (and GCC extensions).
2784  ///
2785  /// \returns the type this bit-field will promote to, or NULL if no
2786  /// promotion occurs.
2788 
2789  /// Return the highest ranked integer type, see C99 6.3.1.8p1.
2790  ///
2791  /// If \p LHS > \p RHS, returns 1. If \p LHS == \p RHS, returns 0. If
2792  /// \p LHS < \p RHS, return -1.
2793  int getIntegerTypeOrder(QualType LHS, QualType RHS) const;
2794 
2795  /// Compare the rank of the two specified floating point types,
2796  /// ignoring the domain of the type (i.e. 'double' == '_Complex double').
2797  ///
2798  /// If \p LHS > \p RHS, returns 1. If \p LHS == \p RHS, returns 0. If
2799  /// \p LHS < \p RHS, return -1.
2800  int getFloatingTypeOrder(QualType LHS, QualType RHS) const;
2801 
2802  /// Compare the rank of two floating point types as above, but compare equal
2803  /// if both types have the same floating-point semantics on the target (i.e.
2804  /// long double and double on AArch64 will return 0).
2805  int getFloatingTypeSemanticOrder(QualType LHS, QualType RHS) const;
2806 
2807  unsigned getTargetAddressSpace(QualType T) const;
2808 
2809  unsigned getTargetAddressSpace(Qualifiers Q) const;
2810 
2811  unsigned getTargetAddressSpace(LangAS AS) const;
2812 
2813  LangAS getLangASForBuiltinAddressSpace(unsigned AS) const;
2814 
2815  /// Get target-dependent integer value for null pointer which is used for
2816  /// constant folding.
2818 
2820  return AddrSpaceMapMangling || isTargetAddressSpace(AS);
2821  }
2822 
2823  // Merges two exception specifications, such that the resulting
2824  // exception spec is the union of both. For example, if either
2825  // of them can throw something, the result can throw it as well.
2829  SmallVectorImpl<QualType> &ExceptionTypeStorage,
2830  bool AcceptDependent);
2831 
2832  // For two "same" types, return a type which has
2833  // the common sugar between them. If Unqualified is true,
2834  // both types need only be the same unqualified type.
2835  // The result will drop the qualifiers which do not occur
2836  // in both types.
2838  bool Unqualified = false);
2839 
2840 private:
2841  // Helper for integer ordering
2842  unsigned getIntegerRank(const Type *T) const;
2843 
2844 public:
2845  //===--------------------------------------------------------------------===//
2846  // Type Compatibility Predicates
2847  //===--------------------------------------------------------------------===//
2848 
2849  /// Compatibility predicates used to check assignment expressions.
2850  bool typesAreCompatible(QualType T1, QualType T2,
2851  bool CompareUnqualified = false); // C99 6.2.7p1
2852 
2855 
2856  bool isObjCIdType(QualType T) const {
2857  if (const auto *ET = dyn_cast<ElaboratedType>(T))
2858  T = ET->getNamedType();
2859  return T == getObjCIdType();
2860  }
2861 
2862  bool isObjCClassType(QualType T) const {
2863  if (const auto *ET = dyn_cast<ElaboratedType>(T))
2864  T = ET->getNamedType();
2865  return T == getObjCClassType();
2866  }
2867 
2868  bool isObjCSelType(QualType T) const {
2869  if (const auto *ET = dyn_cast<ElaboratedType>(T))
2870  T = ET->getNamedType();
2871  return T == getObjCSelType();
2872  }
2873 
2875  const ObjCObjectPointerType *RHS,
2876  bool ForCompare);
2877 
2879  const ObjCObjectPointerType *RHS);
2880 
2881  // Check the safety of assignment from LHS to RHS
2883  const ObjCObjectPointerType *RHSOPT);
2884  bool canAssignObjCInterfaces(const ObjCObjectType *LHS,
2885  const ObjCObjectType *RHS);
2887  const ObjCObjectPointerType *LHSOPT,
2888  const ObjCObjectPointerType *RHSOPT,
2889  bool BlockReturnType);
2892  const ObjCObjectPointerType *RHSOPT);
2893  bool canBindObjCObjectType(QualType To, QualType From);
2894 
2895  // Functions for calculating composite types
2896  QualType mergeTypes(QualType, QualType, bool OfBlockPointer=false,
2897  bool Unqualified = false, bool BlockReturnType = false);
2898  QualType mergeFunctionTypes(QualType, QualType, bool OfBlockPointer=false,
2899  bool Unqualified = false, bool AllowCXX = false);
2901  bool OfBlockPointer = false,
2902  bool Unqualified = false);
2904  bool OfBlockPointer=false,
2905  bool Unqualified = false);
2906 
2908 
2909  /// This function merges the ExtParameterInfo lists of two functions. It
2910  /// returns true if the lists are compatible. The merged list is returned in
2911  /// NewParamInfos.
2912  ///
2913  /// \param FirstFnType The type of the first function.
2914  ///
2915  /// \param SecondFnType The type of the second function.
2916  ///
2917  /// \param CanUseFirst This flag is set to true if the first function's
2918  /// ExtParameterInfo list can be used as the composite list of
2919  /// ExtParameterInfo.
2920  ///
2921  /// \param CanUseSecond This flag is set to true if the second function's
2922  /// ExtParameterInfo list can be used as the composite list of
2923  /// ExtParameterInfo.
2924  ///
2925  /// \param NewParamInfos The composite list of ExtParameterInfo. The list is
2926  /// empty if none of the flags are set.
2927  ///
2928  bool mergeExtParameterInfo(
2929  const FunctionProtoType *FirstFnType,
2930  const FunctionProtoType *SecondFnType,
2931  bool &CanUseFirst, bool &CanUseSecond,
2933 
2934  void ResetObjCLayout(const ObjCContainerDecl *CD);
2935 
2936  //===--------------------------------------------------------------------===//
2937  // Integer Predicates
2938  //===--------------------------------------------------------------------===//
2939 
2940  // The width of an integer, as defined in C99 6.2.6.2. This is the number
2941  // of bits in an integer type excluding any padding bits.
2942  unsigned getIntWidth(QualType T) const;
2943 
2944  // Per C99 6.2.5p6, for every signed integer type, there is a corresponding
2945  // unsigned integer type. This method takes a signed type, and returns the
2946  // corresponding unsigned integer type.
2947  // With the introduction of fixed point types in ISO N1169, this method also
2948  // accepts fixed point types and returns the corresponding unsigned type for
2949  // a given fixed point type.
2951 
2952  // Per C99 6.2.5p6, for every signed integer type, there is a corresponding
2953  // unsigned integer type. This method takes an unsigned type, and returns the
2954  // corresponding signed integer type.
2955  // With the introduction of fixed point types in ISO N1169, this method also
2956  // accepts fixed point types and returns the corresponding signed type for
2957  // a given fixed point type.
2959 
2960  // Per ISO N1169, this method accepts fixed point types and returns the
2961  // corresponding saturated type for a given fixed point type.
2963 
2964  // This method accepts fixed point types and returns the corresponding signed
2965  // type. Unlike getCorrespondingUnsignedType(), this only accepts unsigned
2966  // fixed point types because there are unsigned integer types like bool and
2967  // char8_t that don't have signed equivalents.
2969 
2970  //===--------------------------------------------------------------------===//
2971  // Integer Values
2972  //===--------------------------------------------------------------------===//
2973 
2974  /// Make an APSInt of the appropriate width and signedness for the
2975  /// given \p Value and integer \p Type.
2977  // If Type is a signed integer type larger than 64 bits, we need to be sure
2978  // to sign extend Res appropriately.
2980  Res = Value;
2981  unsigned Width = getIntWidth(Type);
2982  if (Width != Res.getBitWidth())
2983  return Res.extOrTrunc(Width);
2984  return Res;
2985  }
2986 
2987  bool isSentinelNullExpr(const Expr *E);
2988 
2989  /// Get the implementation of the ObjCInterfaceDecl \p D, or nullptr if
2990  /// none exists.
2992 
2993  /// Get the implementation of the ObjCCategoryDecl \p D, or nullptr if
2994  /// none exists.
2996 
2997  /// Return true if there is at least one \@implementation in the TU.
2999  return !ObjCImpls.empty();
3000  }
3001 
3002  /// Set the implementation of ObjCInterfaceDecl.
3004  ObjCImplementationDecl *ImplD);
3005 
3006  /// Set the implementation of ObjCCategoryDecl.
3008  ObjCCategoryImplDecl *ImplD);
3009 
3010  /// Get the duplicate declaration of a ObjCMethod in the same
3011  /// interface, or null if none exists.
3012  const ObjCMethodDecl *
3013  getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const;
3014 
3016  const ObjCMethodDecl *Redecl);
3017 
3018  /// Returns the Objective-C interface that \p ND belongs to if it is
3019  /// an Objective-C method/property/ivar etc. that is part of an interface,
3020  /// otherwise returns null.
3021  const ObjCInterfaceDecl *getObjContainingInterface(const NamedDecl *ND) const;
3022 
3023  /// Set the copy initialization expression of a block var decl. \p CanThrow
3024  /// indicates whether the copy expression can throw or not.
3025  void setBlockVarCopyInit(const VarDecl* VD, Expr *CopyExpr, bool CanThrow);
3026 
3027  /// Get the copy initialization expression of the VarDecl \p VD, or
3028  /// nullptr if none exists.
3029  BlockVarCopyInit getBlockVarCopyInit(const VarDecl* VD) const;
3030 
3031  /// Allocate an uninitialized TypeSourceInfo.
3032  ///
3033  /// The caller should initialize the memory held by TypeSourceInfo using
3034  /// the TypeLoc wrappers.
3035  ///
3036  /// \param T the type that will be the basis for type source info. This type
3037  /// should refer to how the declarator was written in source code, not to
3038  /// what type semantic analysis resolved the declarator to.
3039  ///
3040  /// \param Size the size of the type info to create, or 0 if the size
3041  /// should be calculated based on the type.
3042  TypeSourceInfo *CreateTypeSourceInfo(QualType T, unsigned Size = 0) const;
3043 
3044  /// Allocate a TypeSourceInfo where all locations have been
3045  /// initialized to a given location, which defaults to the empty
3046  /// location.
3047  TypeSourceInfo *
3049  SourceLocation Loc = SourceLocation()) const;
3050 
3051  /// Add a deallocation callback that will be invoked when the
3052  /// ASTContext is destroyed.
3053  ///
3054  /// \param Callback A callback function that will be invoked on destruction.
3055  ///
3056  /// \param Data Pointer data that will be provided to the callback function
3057  /// when it is called.
3058  void AddDeallocation(void (*Callback)(void *), void *Data) const;
3059 
3060  /// If T isn't trivially destructible, calls AddDeallocation to register it
3061  /// for destruction.
3062  template <typename T> void addDestruction(T *Ptr) const {
3063  if (!std::is_trivially_destructible<T>::value) {
3064  auto DestroyPtr = [](void *V) { static_cast<T *>(V)->~T(); };
3065  AddDeallocation(DestroyPtr, Ptr);
3066  }
3067  }
3068 
3071 
3072  /// Determines if the decl can be CodeGen'ed or deserialized from PCH
3073  /// lazily, only when used; this is only relevant for function or file scoped
3074  /// var definitions.
3075  ///
3076  /// \returns true if the function/var must be CodeGen'ed/deserialized even if
3077  /// it is not used.
3078  bool DeclMustBeEmitted(const Decl *D);
3079 
3080  /// Visits all versions of a multiversioned function with the passed
3081  /// predicate.
3083  const FunctionDecl *FD,
3084  llvm::function_ref<void(FunctionDecl *)> Pred) const;
3085 
3086  const CXXConstructorDecl *
3088 
3090  CXXConstructorDecl *CD);
3091 
3093 
3095 
3097 
3099 
3100  void setManglingNumber(const NamedDecl *ND, unsigned Number);
3101  unsigned getManglingNumber(const NamedDecl *ND,
3102  bool ForAuxTarget = false) const;
3103 
3104  void setStaticLocalNumber(const VarDecl *VD, unsigned Number);
3105  unsigned getStaticLocalNumber(const VarDecl *VD) const;
3106 
3107  /// Retrieve the context for computing mangling numbers in the given
3108  /// DeclContext.
3112  const Decl *D);
3113 
3114  std::unique_ptr<MangleNumberingContext> createMangleNumberingContext() const;
3115 
3116  /// Used by ParmVarDecl to store on the side the
3117  /// index of the parameter when it exceeds the size of the normal bitfield.
3118  void setParameterIndex(const ParmVarDecl *D, unsigned index);
3119 
3120  /// Used by ParmVarDecl to retrieve on the side the
3121  /// index of the parameter when it exceeds the size of the normal bitfield.
3122  unsigned getParameterIndex(const ParmVarDecl *D) const;
3123 
3124  /// Return a string representing the human readable name for the specified
3125  /// function declaration or file name. Used by SourceLocExpr and
3126  /// PredefinedExpr to cache evaluated results.
3127  StringLiteral *getPredefinedStringLiteralFromCache(StringRef Key) const;
3128 
3129  /// Return a declaration for the global GUID object representing the given
3130  /// GUID value.
3132 
3133  /// Return a declaration for a uniquified anonymous global constant
3134  /// corresponding to a given APValue.
3137 
3138  /// Return the template parameter object of the given type with the given
3139  /// value.
3141  const APValue &V) const;
3142 
3143  /// Parses the target attributes passed in, and returns only the ones that are
3144  /// valid feature names.
3145  ParsedTargetAttr filterFunctionTargetAttrs(const TargetAttr *TD) const;
3146 
3147  void getFunctionFeatureMap(llvm::StringMap<bool> &FeatureMap,
3148  const FunctionDecl *) const;
3149  void getFunctionFeatureMap(llvm::StringMap<bool> &FeatureMap,
3150  GlobalDecl GD) const;
3151 
3152  //===--------------------------------------------------------------------===//
3153  // Statistics
3154  //===--------------------------------------------------------------------===//
3155 
3156  /// The number of implicitly-declared default constructors.
3158 
3159  /// The number of implicitly-declared default constructors for
3160  /// which declarations were built.
3162 
3163  /// The number of implicitly-declared copy constructors.
3165 
3166  /// The number of implicitly-declared copy constructors for
3167  /// which declarations were built.
3169 
3170  /// The number of implicitly-declared move constructors.
3172 
3173  /// The number of implicitly-declared move constructors for
3174  /// which declarations were built.
3176 
3177  /// The number of implicitly-declared copy assignment operators.
3179 
3180  /// The number of implicitly-declared copy assignment operators for
3181  /// which declarations were built.
3183 
3184  /// The number of implicitly-declared move assignment operators.
3186 
3187  /// The number of implicitly-declared move assignment operators for
3188  /// which declarations were built.
3190 
3191  /// The number of implicitly-declared destructors.
3193 
3194  /// The number of implicitly-declared destructors for which
3195  /// declarations were built.
3197 
3198 public:
3199  /// Initialize built-in types.
3200  ///
3201  /// This routine may only be invoked once for a given ASTContext object.
3202  /// It is normally invoked after ASTContext construction.
3203  ///
3204  /// \param Target The target
3205  void InitBuiltinTypes(const TargetInfo &Target,
3206  const TargetInfo *AuxTarget = nullptr);
3207 
3208 private:
3209  void InitBuiltinType(CanQualType &R, BuiltinType::Kind K);
3210 
3211  class ObjCEncOptions {
3212  unsigned Bits;
3213 
3214  ObjCEncOptions(unsigned Bits) : Bits(Bits) {}
3215 
3216  public:
3217  ObjCEncOptions() : Bits(0) {}
3218  ObjCEncOptions(const ObjCEncOptions &RHS) : Bits(RHS.Bits) {}
3219 
3220 #define OPT_LIST(V) \
3221  V(ExpandPointedToStructures, 0) \
3222  V(ExpandStructures, 1) \
3223  V(IsOutermostType, 2) \
3224  V(EncodingProperty, 3) \
3225  V(IsStructField, 4) \
3226  V(EncodeBlockParameters, 5) \
3227  V(EncodeClassNames, 6) \
3228 
3229 #define V(N,I) ObjCEncOptions& set##N() { Bits |= 1 << I; return *this; }
3230 OPT_LIST(V)
3231 #undef V
3232 
3233 #define V(N,I) bool N() const { return Bits & 1 << I; }
3234 OPT_LIST(V)
3235 #undef V
3236 
3237 #undef OPT_LIST
3238 
3239  [[nodiscard]] ObjCEncOptions keepingOnly(ObjCEncOptions Mask) const {
3240  return Bits & Mask.Bits;
3241  }
3242 
3243  [[nodiscard]] ObjCEncOptions forComponentType() const {
3244  ObjCEncOptions Mask = ObjCEncOptions()
3245  .setIsOutermostType()
3246  .setIsStructField();
3247  return Bits & ~Mask.Bits;
3248  }
3249  };
3250 
3251  // Return the Objective-C type encoding for a given type.
3252  void getObjCEncodingForTypeImpl(QualType t, std::string &S,
3253  ObjCEncOptions Options,
3254  const FieldDecl *Field,
3255  QualType *NotEncodedT = nullptr) const;
3256 
3257  // Adds the encoding of the structure's members.
3258  void getObjCEncodingForStructureImpl(RecordDecl *RD, std::string &S,
3259  const FieldDecl *Field,
3260  bool includeVBases = true,
3261  QualType *NotEncodedT=nullptr) const;
3262 
3263 public:
3264  // Adds the encoding of a method parameter or return type.
3266  QualType T, std::string& S,
3267  bool Extended) const;
3268 
3269  /// Returns true if this is an inline-initialized static data member
3270  /// which is treated as a definition for MSVC compatibility.
3271  bool isMSStaticDataMemberInlineDefinition(const VarDecl *VD) const;
3272 
3274  /// Not an inline variable.
3275  None,
3276 
3277  /// Weak definition of inline variable.
3278  Weak,
3279 
3280  /// Weak for now, might become strong later in this TU.
3281  WeakUnknown,
3282 
3283  /// Strong definition.
3284  Strong
3285  };
3286 
3287  /// Determine whether a definition of this inline variable should
3288  /// be treated as a weak or strong definition. For compatibility with
3289  /// C++14 and before, for a constexpr static data member, if there is an
3290  /// out-of-line declaration of the member, we may promote it from weak to
3291  /// strong.
3293  getInlineVariableDefinitionKind(const VarDecl *VD) const;
3294 
3295 private:
3296  friend class DeclarationNameTable;
3297  friend class DeclContext;
3298 
3299  const ASTRecordLayout &
3300  getObjCLayout(const ObjCInterfaceDecl *D,
3301  const ObjCImplementationDecl *Impl) const;
3302 
3303  /// A set of deallocations that should be performed when the
3304  /// ASTContext is destroyed.
3305  // FIXME: We really should have a better mechanism in the ASTContext to
3306  // manage running destructors for types which do variable sized allocation
3307  // within the AST. In some places we thread the AST bump pointer allocator
3308  // into the datastructures which avoids this mess during deallocation but is
3309  // wasteful of memory, and here we require a lot of error prone book keeping
3310  // in order to track and run destructors while we're tearing things down.
3312  llvm::SmallVector<std::pair<void (*)(void *), void *>, 16>;
3313  mutable DeallocationFunctionsAndArguments Deallocations;
3314 
3315  // FIXME: This currently contains the set of StoredDeclMaps used
3316  // by DeclContext objects. This probably should not be in ASTContext,
3317  // but we include it here so that ASTContext can quickly deallocate them.
3318  llvm::PointerIntPair<StoredDeclsMap *, 1> LastSDM;
3319 
3320  std::vector<Decl *> TraversalScope;
3321 
3322  std::unique_ptr<VTableContextBase> VTContext;
3323 
3324  void ReleaseDeclContextMaps();
3325 
3326 public:
3327  enum PragmaSectionFlag : unsigned {
3329  PSF_Read = 0x1,
3330  PSF_Write = 0x2,
3334  PSF_Invalid = 0x80000000U,
3335  };
3336 
3337  struct SectionInfo {
3341 
3342  SectionInfo() = default;
3344  int SectionFlags)
3347  };
3348 
3349  llvm::StringMap<SectionInfo> SectionInfos;
3350 
3351  /// Return a new OMPTraitInfo object owned by this context.
3353 
3354  /// Whether a C++ static variable or CUDA/HIP kernel may be externalized.
3355  bool mayExternalize(const Decl *D) const;
3356 
3357  /// Whether a C++ static variable or CUDA/HIP kernel should be externalized.
3358  bool shouldExternalize(const Decl *D) const;
3359 
3360  StringRef getCUIDHash() const;
3361 
3362 private:
3363  /// All OMPTraitInfo objects live in this collection, one per
3364  /// `pragma omp [begin] declare variant` directive.
3365  SmallVector<std::unique_ptr<OMPTraitInfo>, 4> OMPTraitInfoVector;
3366 };
3367 
3368 /// Insertion operator for diagnostics.
3370  const ASTContext::SectionInfo &Section);
3371 
3372 /// Utility function for constructing a nullary selector.
3373 inline Selector GetNullarySelector(StringRef name, ASTContext &Ctx) {
3374  IdentifierInfo* II = &Ctx.Idents.get(name);
3375  return Ctx.Selectors.getSelector(0, &II);
3376 }
3377 
3378 /// Utility function for constructing an unary selector.
3379 inline Selector GetUnarySelector(StringRef name, ASTContext &Ctx) {
3380  IdentifierInfo* II = &Ctx.Idents.get(name);
3381  return Ctx.Selectors.getSelector(1, &II);
3382 }
3383 
3384 } // namespace clang
3385 
3386 // operator new and delete aren't allowed inside namespaces.
3387 
3388 /// Placement new for using the ASTContext's allocator.
3389 ///
3390 /// This placement form of operator new uses the ASTContext's allocator for
3391 /// obtaining memory.
3392 ///
3393 /// IMPORTANT: These are also declared in clang/AST/ASTContextAllocate.h!
3394 /// Any changes here need to also be made there.
3395 ///
3396 /// We intentionally avoid using a nothrow specification here so that the calls
3397 /// to this operator will not perform a null check on the result -- the
3398 /// underlying allocator never returns null pointers.
3399 ///
3400 /// Usage looks like this (assuming there's an ASTContext 'Context' in scope):
3401 /// @code
3402 /// // Default alignment (8)
3403 /// IntegerLiteral *Ex = new (Context) IntegerLiteral(arguments);
3404 /// // Specific alignment
3405 /// IntegerLiteral *Ex2 = new (Context, 4) IntegerLiteral(arguments);
3406 /// @endcode
3407 /// Memory allocated through this placement new operator does not need to be
3408 /// explicitly freed, as ASTContext will free all of this memory when it gets
3409 /// destroyed. Please note that you cannot use delete on the pointer.
3410 ///
3411 /// @param Bytes The number of bytes to allocate. Calculated by the compiler.
3412 /// @param C The ASTContext that provides the allocator.
3413 /// @param Alignment The alignment of the allocated memory (if the underlying
3414 /// allocator supports it).
3415 /// @return The allocated memory. Could be nullptr.
3416 inline void *operator new(size_t Bytes, const clang::ASTContext &C,
3417  size_t Alignment /* = 8 */) {
3418  return C.Allocate(Bytes, Alignment);
3419 }
3420 
3421 /// Placement delete companion to the new above.
3422 ///
3423 /// This operator is just a companion to the new above. There is no way of
3424 /// invoking it directly; see the new operator for more details. This operator
3425 /// is called implicitly by the compiler if a placement new expression using
3426 /// the ASTContext throws in the object constructor.
3427 inline void operator delete(void *Ptr, const clang::ASTContext &C, size_t) {
3428  C.Deallocate(Ptr);
3429 }
3430 
3431 /// This placement form of operator new[] uses the ASTContext's allocator for
3432 /// obtaining memory.
3433 ///
3434 /// We intentionally avoid using a nothrow specification here so that the calls
3435 /// to this operator will not perform a null check on the result -- the
3436 /// underlying allocator never returns null pointers.
3437 ///
3438 /// Usage looks like this (assuming there's an ASTContext 'Context' in scope):
3439 /// @code
3440 /// // Default alignment (8)
3441 /// char *data = new (Context) char[10];
3442 /// // Specific alignment
3443 /// char *data = new (Context, 4) char[10];
3444 /// @endcode
3445 /// Memory allocated through this placement new[] operator does not need to be
3446 /// explicitly freed, as ASTContext will free all of this memory when it gets
3447 /// destroyed. Please note that you cannot use delete on the pointer.
3448 ///
3449 /// @param Bytes The number of bytes to allocate. Calculated by the compiler.
3450 /// @param C The ASTContext that provides the allocator.
3451 /// @param Alignment The alignment of the allocated memory (if the underlying
3452 /// allocator supports it).
3453 /// @return The allocated memory. Could be nullptr.
3454 inline void *operator new[](size_t Bytes, const clang::ASTContext& C,
3455  size_t Alignment /* = 8 */) {
3456  return C.Allocate(Bytes, Alignment);
3457 }
3458 
3459 /// Placement delete[] companion to the new[] above.
3460 ///
3461 /// This operator is just a companion to the new[] above. There is no way of
3462 /// invoking it directly; see the new[] operator for more details. This operator
3463 /// is called implicitly by the compiler if a placement new[] expression using
3464 /// the ASTContext throws in the object constructor.
3465 inline void operator delete[](void *Ptr, const clang::ASTContext &C, size_t) {
3466  C.Deallocate(Ptr);
3467 }
3468 
3469 /// Create the representation of a LazyGenerationalUpdatePtr.
3470 template <typename Owner, typename T,
3471  void (clang::ExternalASTSource::*Update)(Owner)>
3474  const clang::ASTContext &Ctx, T Value) {
3475  // Note, this is implemented here so that ExternalASTSource.h doesn't need to
3476  // include ASTContext.h. We explicitly instantiate it for all relevant types
3477  // in ASTContext.cpp.
3478  if (auto *Source = Ctx.getExternalSource())
3479  return new (Ctx) LazyData(Source, Value);
3480  return Value;
3481 }
3482 
3483 #endif // LLVM_CLANG_AST_ASTCONTEXT_H
clang::QualifierCollector::strip
const Type * strip(QualType type)
Collect any qualifiers on the given type and return an unqualified type.
Definition: Type.h:6622
clang::ASTContext::FriendsDifferByConstraints
bool FriendsDifferByConstraints(const FunctionDecl *X, const FunctionDecl *Y) const
Determine whether two Friend functions are different because constraints that refer to an enclosing t...
Definition: ASTContext.cpp:6475
clang::BuiltinType
This class is used for builtin types like 'int'.
Definition: Type.h:2617
clang::ASTContext::areCommonBaseCompatible
QualType areCommonBaseCompatible(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
Definition: ASTContext.cpp:9904
clang::operator!=
bool operator!=(CanQual< T > x, CanQual< U > y)
Definition: CanonicalType.h:207
clang::ElaboratedTypeKeyword
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
Definition: Type.h:5581
clang::ASTContext::getInjectedTemplateArg
TemplateArgument getInjectedTemplateArg(NamedDecl *ParamDecl)
Definition: ASTContext.cpp:5175
clang::ASTContext::getAutoType
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent, bool IsPack=false, ConceptDecl *TypeConstraintConcept=nullptr, ArrayRef< TemplateArgument > TypeConstraintArgs={}) const
C++11 deduced auto type.
Definition: ASTContext.cpp:5798
clang::ASTContext::setObjCImplementation
void setObjCImplementation(ObjCInterfaceDecl *IFaceD, ObjCImplementationDecl *ImplD)
Set the implementation of ObjCInterfaceDecl.
Definition: ASTContext.cpp:2916
clang::ASTContext::getBuiltinVaListDecl
TypedefDecl * getBuiltinVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_va_list type.
Definition: ASTContext.cpp:9084
clang::ObjCInterfaceDecl
Represents an ObjC class declaration.
Definition: DeclObjC.h:1150
clang::ASTContext::adjustDeducedFunctionResultType
void adjustDeducedFunctionResultType(FunctionDecl *FD, QualType ResultType)
Change the result type of a function type once it is deduced.
Definition: ASTContext.cpp:3149
clang::ASTContext::SatUnsignedLongFractTy
CanQualType SatUnsignedLongFractTy
Definition: ASTContext.h:1130
clang::ASTContext::getTypeSizeInChars
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
Definition: ASTContext.cpp:2472
clang::ASTContext::OCLEventTy
CanQualType OCLEventTy
Definition: ASTContext.h:1143
clang::isTargetAddressSpace
bool isTargetAddressSpace(LangAS AS)
Definition: AddressSpaces.h:71
clang::ASTContext::getObjCEncodingForPropertyDecl
std::string getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container) const
getObjCEncodingForPropertyDecl - Return the encoded type for this method declaration.
Definition: ASTContext.cpp:7834
clang::ASTContext::LongDoubleTy
CanQualType LongDoubleTy
Definition: ASTContext.h:1119
clang::ASTContext::NumImplicitDestructorsDeclared
unsigned NumImplicitDestructorsDeclared
The number of implicitly-declared destructors for which declarations were built.
Definition: ASTContext.h:3196
clang::ASTContext::getCFConstantStringTagDecl
RecordDecl * getCFConstantStringTagDecl() const
Definition: ASTContext.cpp:7330
clang::Type::getNullability
Optional< NullabilityKind > getNullability(const ASTContext &context) const
Determine the nullability of the given type.
Definition: Type.cpp:4128
clang::ASTContext::getRawCommentForDeclNoCacheImpl
RawComment * getRawCommentForDeclNoCacheImpl(const Decl *D, const SourceLocation RepresentativeLocForDecl, const std::map< unsigned, RawComment * > &CommentsInFile) const
Definition: ASTContext.cpp:206
clang::ASTContext::getTypePackElementName
IdentifierInfo * getTypePackElementName() const
Definition: ASTContext.h:1920
clang::ASTContext::getQualifiedType
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
Definition: ASTContext.h:2140
clang::ASTContext::getTypedefType
QualType getTypedefType(const TypedefNameDecl *Decl, QualType Underlying=QualType()) const
Return the unique reference to the type for the specified typedef-name decl.
Definition: ASTContext.cpp:4643
clang::ASTContext::~ASTContext
~ASTContext()
Definition: ASTContext.cpp:1033
clang::AtomicExpr
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Definition: Expr.h:6238
clang::ASTContext::NumImplicitMoveConstructorsDeclared
unsigned NumImplicitMoveConstructorsDeclared
The number of implicitly-declared move constructors for which declarations were built.
Definition: ASTContext.h:3175
clang::ASTContext::getASTObjCImplementationLayout
const ASTRecordLayout & getASTObjCImplementationLayout(const ObjCImplementationDecl *D) const
Get or compute information about the layout of the specified Objective-C implementation.
Definition: ASTContext.cpp:3000
clang::LangAS::opencl_private
@ opencl_private
clang::ASTContext::areLaxCompatibleSveTypes
bool areLaxCompatibleSveTypes(QualType FirstType, QualType SecondType)
Return true if the given vector types are lax-compatible SVE vector types, false otherwise.
Definition: ASTContext.cpp:9434
clang::ASTContext::getASTMutationListener
ASTMutationListener * getASTMutationListener() const
Retrieve a pointer to the AST mutation listener associated with this AST context, if any.
Definition: ASTContext.h:1209
clang::ASTContext::getDeclaratorForUnnamedTagDecl
DeclaratorDecl * getDeclaratorForUnnamedTagDecl(const TagDecl *TD)
Definition: ASTContext.cpp:12035
clang::ASTContext::getIntegerTypeOrder
int getIntegerTypeOrder(QualType LHS, QualType RHS) const
Return the highest ranked integer type, see C99 6.3.1.8p1.
Definition: ASTContext.cpp:7201
clang::ASTContext::GetGVALinkageForVariable
GVALinkage GetGVALinkageForVariable(const VarDecl *VD)
Definition: ASTContext.cpp:11645
clang::DynTypedNodeList
Container for either a single DynTypedNode or for an ArrayRef to DynTypedNode.
Definition: ParentMapContext.h:92
clang::ASTContext::getObjCInstanceTypeDecl
TypedefDecl * getObjCInstanceTypeDecl()
Retrieve the typedef declaration corresponding to the Objective-C "instancetype" type.
Definition: ASTContext.cpp:7555
clang::ASTContext::NestedNameSpecifier
friend class NestedNameSpecifier
Definition: ASTContext.h:210
clang::ASTContext::CUDAConstantEvalContext
Definition: ASTContext.h:671
clang::ASTContext::IncompleteMatrixIdxTy
CanQualType IncompleteMatrixIdxTy
Definition: ASTContext.h:1145
clang::ASTContext::isAlignmentRequired
bool isAlignmentRequired(const Type *T) const
Determine if the alignment the type has was required using an alignment attribute.
Definition: ASTContext.cpp:1896
clang::ASTContext::getBlockDescriptorExtendedType
QualType getBlockDescriptorExtendedType() const
Gets the struct used to keep track of the extended descriptor for pointer to blocks.
Definition: ASTContext.cpp:7393
clang::ASTContext::BuiltinVectorTypeInfo::NumVectors
unsigned NumVectors
Definition: ASTContext.h:1490
llvm
YAML serialization mapping.
Definition: Dominators.h:30
clang::CXXConstructorDecl
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2436
clang::ASTContext::getTypeDeclType
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
Definition: ASTContext.h:1583
clang::ASTContext::getOpenMPDefaultSimdAlign
unsigned getOpenMPDefaultSimdAlign(QualType T) const
Get default simd alignment of the specified complete type in bits.
Definition: ASTContext.cpp:2455
clang::ASTContext::getInt128Decl
TypedefDecl * getInt128Decl() const
Retrieve the declaration for the 128-bit signed integer type.
Definition: ASTContext.cpp:1262
clang::TypeInfoChars::AlignRequirement
AlignRequirementKind AlignRequirement
Definition: ASTContext.h:196
clang::ASTContext::mergeTypes
QualType mergeTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false, bool BlockReturnType=false)
Definition: ASTContext.cpp:10369
clang::ASTContext::getBOOLType
QualType getBOOLType() const
type of 'BOOL' type.
Definition: ASTContext.h:2088
clang::ASTContext::getFILEType
QualType getFILEType() const
Retrieve the C FILE type.
Definition: ASTContext.h:1940
clang::ExternCContextDecl
Declaration context for names declared as extern "C" in C++.
Definition: Decl.h:220
clang::ASTContext::hasDirectOwnershipQualifier
bool hasDirectOwnershipQualifier(QualType Ty) const
Return true if the type has been explicitly qualified with ObjC ownership.
Definition: ASTContext.cpp:9486
clang::ASTContext::BFloat16Ty
CanQualType BFloat16Ty
Definition: ASTContext.h:1132
Specifiers.h
ASTContextAllocate.h
clang::interp::APInt
llvm::APInt APInt
Definition: Integral.h:27
clang::ast_matchers::blockExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, BlockExpr > blockExpr
Matches a reference to a block.
Definition: ASTMatchersInternal.cpp:893
clang::MSGuidDeclParts
Parts of a decomposed MSGuidDecl.
Definition: DeclCXX.h:4151
clang::ASTContext::getNSIntegerType
CanQualType getNSIntegerType() const
Definition: ASTContext.cpp:7546
clang::ASTContext::OCLReserveIDTy
CanQualType OCLReserveIDTy
Definition: ASTContext.h:1144
clang::ASTContext::getTemplateParamObjectDecl
TemplateParamObjectDecl * getTemplateParamObjectDecl(QualType T, const APValue &V) const
Return the template parameter object of the given type with the given value.
Definition: ASTContext.cpp:12110
clang::ASTContext::canAssignObjCInterfacesInBlockPointer
bool canAssignObjCInterfacesInBlockPointer(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT, bool BlockReturnType)
canAssignObjCInterfacesInBlockPointer - This routine is specifically written for providing type-safet...
Definition: ASTContext.cpp:9714
clang::ASTContext::getCharWidth
uint64_t getCharWidth() const
Return the size of the character type, in bits.
Definition: ASTContext.h:2303
clang::ASTContext::UnsignedShortTy
CanQualType UnsignedShortTy
Definition: ASTContext.h:1117
clang::ASTContext::GetGVALinkageForFunction
GVALinkage GetGVALinkageForFunction(const FunctionDecl *FD) const
Definition: ASTContext.cpp:11562
clang::ASTContext::getObjCInstanceType
QualType getObjCInstanceType()
Retrieve the Objective-C "instancetype" type, if already known; otherwise, returns a NULL type;.
Definition: ASTContext.h:1928
clang::ASTContext::ResetObjCLayout
void ResetObjCLayout(const ObjCContainerDecl *CD)
Definition: ASTContext.cpp:10777
clang::ASTContext::getNSObjectName
IdentifierInfo * getNSObjectName() const
Retrieve the identifier 'NSObject'.
Definition: ASTContext.h:1886
clang::ASTContext::hasSameType
bool hasSameType(const Type *T1, const Type *T2) const
Definition: ASTContext.h:2541
clang::MemberSpecializationInfo
Provides information a specialization of a member of a class template, which may be a member function...
Definition: DeclTemplate.h:632
clang::ASTContext::getBitIntType
QualType getBitIntType(bool Unsigned, unsigned NumBits) const
Return a bit-precise integer type with the specified signedness and bit count.
Definition: ASTContext.cpp:4548
clang::FullSourceLoc
A SourceLocation and its associated SourceManager.
Definition: SourceLocation.h:368
clang::ASTContext::buildImplicitRecord
RecordDecl * buildImplicitRecord(StringRef Name, RecordDecl::TagKind TK=TTK_Struct) const
Create a new implicit TU-level CXXRecordDecl or RecordDecl declaration.
Definition: ASTContext.cpp:1236
clang::ASTContext::getTemplateSpecializationTypeInfo
TypeSourceInfo * getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc, const TemplateArgumentListInfo &Args, QualType Canon=QualType()) const
Definition: ASTContext.cpp:4878
clang::ASTContext::GE_Missing_setjmp
@ GE_Missing_setjmp
Missing a type from <setjmp.h>
Definition: ASTContext.h:2221
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:210
clang::ASTContext::hasSameExpr
bool hasSameExpr(const Expr *X, const Expr *Y) const
Determine whether the given expressions X and Y are equivalent.
Definition: ASTContext.cpp:12210
clang::ASTContext::CountNonClassIvars
unsigned CountNonClassIvars(const ObjCInterfaceDecl *OI) const
Definition: ASTContext.cpp:2863
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::DeclContext
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1389
clang::ASTContext::getFunctionFeatureMap
void getFunctionFeatureMap(llvm::StringMap< bool > &FeatureMap, const FunctionDecl *) const
Definition: ASTContext.cpp:13291
clang::ASTContext::getDependentNameType
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
Definition: ASTContext.cpp:5087
clang::ASTContext::GetBuiltinType
QualType GetBuiltinType(unsigned ID, GetBuiltinTypeError &Error, unsigned *IntegerConstantArgs=nullptr) const
Return the type for the specified builtin.
Definition: ASTContext.cpp:11383
clang::ASTContext::createMangleNumberingContext
std::unique_ptr< MangleNumberingContext > createMangleNumberingContext() const
Definition: ASTContext.cpp:12003
clang::Qualifiers::fromCVRMask
static Qualifiers fromCVRMask(unsigned CVR)
Definition: Type.h:240
clang::ObjCImplementationDecl
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2548
clang::ASTContext::InlineVariableDefinitionKind::Strong
@ Strong
Strong definition.
clang::ConstantArrayType
Represents the canonical version of C arrays with a specified constant size.
Definition: Type.h:3055
clang::ASTContext::BuiltinVectorTypeInfo::ElementType
QualType ElementType
Definition: ASTContext.h:1488
clang::ASTContext::getRawCommentForDeclNoCache
RawComment * getRawCommentForDeclNoCache(const Decl *D) const
Return the documentation comment attached to a given declaration, without looking into cache.
Definition: ASTContext.cpp:284
clang::ASTContext::NumImplicitDefaultConstructors
unsigned NumImplicitDefaultConstructors
The number of implicitly-declared default constructors.
Definition: ASTContext.h:3157
clang::ASTContext::ExternalSource
IntrusiveRefCntPtr< ExternalASTSource > ExternalSource
Definition: ASTContext.h:665
clang::ASTContext::getParents
DynTypedNodeList getParents(const NodeT &Node)
Forwards to get node parents from the ParentMapContext.
Definition: ParentMapContext.h:131
clang::ASTContext::getMacroQualifiedType
QualType getMacroQualifiedType(QualType UnderlyingTy, const IdentifierInfo *MacroII) const
Definition: ASTContext.cpp:5075
clang::ASTContext::UnsignedAccumTy
CanQualType UnsignedAccumTy
Definition: ASTContext.h:1122
clang::ASTContext::setcudaConfigureCallDecl
void setcudaConfigureCallDecl(FunctionDecl *FD)
Definition: ASTContext.h:1416
clang::serialization::AbstractTypeReader
Definition: ASTContext.h:162
clang::ASTContext::VoidTy
CanQualType VoidTy
Definition: ASTContext.h:1107
llvm::SmallVector
Definition: LLVM.h:38
clang::ASTContext::operator=
ASTContext & operator=(const ASTContext &)=delete
clang::ASTContext::getParameterIndex
unsigned getParameterIndex(const ParmVarDecl *D) const
Used by ParmVarDecl to retrieve on the side the index of the parameter when it exceeds the size of th...
Definition: ASTContext.cpp:12043
clang::ASTContext::getAtomicType
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
Definition: ASTContext.cpp:5835
clang::IdentifierTable::get
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
Definition: IdentifierTable.h:597
clang::ASTContext::setModuleForCodeGen
void setModuleForCodeGen(Module *M)
Set the (C++20) module we are building.
Definition: ASTContext.h:1084
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::ASTContext::getManglingNumberContext
MangleNumberingContext & getManglingNumberContext(const DeclContext *DC)
Retrieve the context for computing mangling numbers in the given DeclContext.
Definition: ASTContext.cpp:11984
clang::BuiltinType::Kind
Kind
Definition: Type.h:2619
clang::ASTContext::getTemplateSpecializationType
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
Definition: ASTContext.cpp:4925
clang::ASTContext::getQualifiedType
QualType getQualifiedType(QualType T, Qualifiers Qs) const
Return a type with additional qualifiers.
Definition: ASTContext.h:2145
clang::ASTContext::CUDAConstantEvalContextRAII
Definition: ASTContext.h:675
clang::ASTContext::getObjCNSStringType
QualType getObjCNSStringType() const
Definition: ASTContext.h:1838
clang::ASTContext::getIntWidth
unsigned getIntWidth(QualType T) const
Definition: ASTContext.cpp:10860
clang::ASTContext::DeallocateDeclListNode
void DeallocateDeclListNode(DeclListNode *N)
Deallcates a DeclListNode by returning it to the ListNodeFreeList pool.
Definition: ASTContext.h:755
clang::ASTContext::getVariableArrayDecayedType
QualType getVariableArrayDecayedType(QualType Ty) const
Returns a vla type where known sizes are replaced with [*].
Definition: ASTContext.cpp:3575
clang::TTK_Struct
@ TTK_Struct
The "struct" keyword.
Definition: Type.h:5564
clang::Qualifiers::addObjCLifetime
void addObjCLifetime(ObjCLifetime type)
Definition: Type.h:359
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:247
clang::ASTContext::getWritePipeType
QualType getWritePipeType(QualType T) const
Return a write_only pipe type for the specified type.
Definition: ASTContext.cpp:4544
clang::ASTContext::OMPArraySectionTy
CanQualType OMPArraySectionTy
Definition: ASTContext.h:1146
clang::ASTContext::BuiltinInfo
Builtin::Context & BuiltinInfo
Definition: ASTContext.h:662
clang::ASTContext::getInnerObjCOwnership
Qualifiers::ObjCLifetime getInnerObjCOwnership(QualType T) const
Recurses in pointer/array types until it finds an Objective-C retainable type and returns its ownersh...
Definition: ASTContext.cpp:7173
clang::ASTContext::CUDADeviceVarODRUsedByHost
llvm::DenseSet< const VarDecl * > CUDADeviceVarODRUsedByHost
Keep track of CUDA/HIP device-side variables ODR-used by host code.
Definition: ASTContext.h:1172
clang::MultiVersionKind::Target
@ Target
clang::Qualifiers::GC
GC
Definition: Type.h:156
clang::ASTContext::setFILEDecl
void setFILEDecl(TypeDecl *FILEDecl)
Set the type for the C FILE type.
Definition: ASTContext.h:1937
clang::ASTContext::getAdjustedParameterType
QualType getAdjustedParameterType(QualType T) const
Perform adjustment on the parameter type of a function.
Definition: ASTContext.cpp:6894
clang::ASTContext::NeedExtraManglingDecl_t
NeedExtraManglingDecl_t
Definition: ASTContext.h:3110
clang::ParsedTargetAttr
Contains information gathered from parsing the contents of TargetAttr.
Definition: TargetInfo.h:54
clang::ASTContext::PseudoObjectTy
CanQualType PseudoObjectTy
Definition: ASTContext.h:1137
clang::ASTContext::GE_Missing_ucontext
@ GE_Missing_ucontext
Missing a type from <ucontext.h>
Definition: ASTContext.h:2224
clang::ASTContext::DeclarationNames
DeclarationNameTable DeclarationNames
Definition: ASTContext.h:664
clang::ASTContext::getObjCClassDecl
TypedefDecl * getObjCClassDecl() const
Retrieve the typedef declaration corresponding to the predefined Objective-C 'Class' type.
Definition: ASTContext.cpp:8675
clang::ASTContext::AnyObjCImplementation
bool AnyObjCImplementation()
Return true if there is at least one @implementation in the TU.
Definition: ASTContext.h:2998
clang::ASTContext::getObjCSelRedefinitionType
QualType getObjCSelRedefinitionType() const
Retrieve the type that 'SEL' has been defined to, which may be different from the built-in 'SEL' if '...
Definition: ASTContext.h:1874
clang::ASTContext::getObjCEncodingForFunctionDecl
std::string getObjCEncodingForFunctionDecl(const FunctionDecl *Decl) const
Emit the encoded type for the function Decl into S.
Definition: ASTContext.cpp:7679
clang::LazyGenerationalUpdatePtr::LazyData
A cache of the value of this pointer, in the most recent generation in which we queried it.
Definition: ExternalASTSource.h:391
clang::ASTContext::getFullLoc
FullSourceLoc getFullLoc(SourceLocation Loc) const
Definition: ASTContext.h:811
clang::ASTContext::cacheRawCommentForDecl
void cacheRawCommentForDecl(const Decl &OriginalD, const RawComment &Comment) const
Attaches Comment to OriginalD and to its redeclaration chain and removes the redeclaration chain from...
Definition: ASTContext.cpp:458
clang::OMPTraitInfo
Helper data structure representing the traits in a match clause of an declare variant or metadirectiv...
Definition: OpenMPClause.h:8809
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:737
clang::ASTContext::getTargetAddressSpace
unsigned getTargetAddressSpace(QualType T) const
Definition: ASTContext.cpp:12189
clang::ArrayType::ArraySizeModifier
ArraySizeModifier
Capture whether this is a normal array (e.g.
Definition: Type.h:3015
clang::ASTContext::CommentlessRedeclChains
llvm::DenseMap< const Decl *, const Decl * > CommentlessRedeclChains
Keeps track of redeclaration chains that don't have any comment attached.
Definition: ASTContext.h:846
AttributeLangSupport::C
@ C
Definition: SemaDeclAttr.cpp:55
clang::NestedNameSpecifier
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Definition: NestedNameSpecifier.h:50
clang::ASTContext::getWCharType
QualType getWCharType() const
Return the unique wchar_t type available in C++ (and available as __wchar_t as a Microsoft extension)...
Definition: ASTContext.h:1772
clang::ASTContext::SatLongAccumTy
CanQualType SatLongAccumTy
Definition: ASTContext.h:1125
clang::ASTContext::getDependentTemplateName
TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, const IdentifierInfo *Name) const
Retrieve the template name that represents a dependent template name such as MetaFun::template apply.
Definition: ASTContext.cpp:9182
clang::ASTContext::getCommentForDecl
comments::FullComment * getCommentForDecl(const Decl *D, const Preprocessor *PP) const
Return parsed documentation comment attached to a given declaration.
Definition: ASTContext.cpp:560
clang::GVALinkage
GVALinkage
A more specific kind of linkage than enum Linkage.
Definition: Linkage.h:73
clang::ASTContext::Comments
RawCommentList Comments
All comments in this translation unit.
Definition: ASTContext.h:821
clang::ASTContext::getFloatTypeSemantics
const llvm::fltSemantics & getFloatTypeSemantics(QualType T) const
Return the APFloat 'semantics' for the specified scalar floating point type.
Definition: ASTContext.cpp:1704
clang::UnresolvedSetIterator
The iterator over UnresolvedSets.
Definition: UnresolvedSet.h:32
clang::ASTContext::getUnresolvedUsingType
QualType getUnresolvedUsingType(const UnresolvedUsingTypenameDecl *Decl) const
Definition: ASTContext.cpp:4730
clang::QualType::getCanonicalType
QualType getCanonicalType() const
Definition: Type.h:6727
clang::ASTContext::SatShortAccumTy
CanQualType SatShortAccumTy
Definition: ASTContext.h:1125
clang::FieldDecl
Represents a member of a struct/union/class.
Definition: Decl.h:2903
clang::DiagnosticsEngine
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:192
clang::TypeInfoChars::isAlignRequired
bool isAlignRequired()
Definition: ASTContext.h:202
clang::ASTContext::getBaseElementType
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
Definition: ASTContext.cpp:6947
clang::Qualifiers
The collection of all-type qualifiers we support.
Definition: Type.h:147
clang::ast_matchers::type
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Definition: ASTMatchersInternal.cpp:773
clang::ParmVarDecl
Represents a parameter to a function.
Definition: Decl.h:1685
clang::ASTContext::TUKind
const TranslationUnitKind TUKind
Definition: ASTContext.h:663
clang::TargetInfo
Exposes information about the current target.
Definition: TargetInfo.h:205
clang::CanQual< Type >::CreateUnsafe
static CanQual< Type > CreateUnsafe(QualType Other)
Builds a canonical type from a QualType.
Definition: CanonicalType.h:642
int
__device__ int
Definition: __clang_hip_libdevice_declares.h:63
clang::ASTContext::getAuxTargetInfo
const TargetInfo * getAuxTargetInfo() const
Definition: ASTContext.h:774
clang::TypeInfo::Width
uint64_t Width
Definition: ASTContext.h:180
clang::ASTContext::getUnsignedWCharType
QualType getUnsignedWCharType() const
Return the type of "unsigned wchar_t".
Definition: ASTContext.cpp:5921
clang::ASTContext::BlockRequiresCopying
bool BlockRequiresCopying(QualType Ty, const VarDecl *D)
Returns true iff we need copy/dispose helpers for the given type.
Definition: ASTContext.cpp:7475
clang::ASTContext::getFunctionType
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
Definition: ASTContext.h:1561
clang::ASTContext::addComment
void addComment(const RawComment &RC)
Definition: ASTContext.cpp:311
clang::AlignRequirementKind::RequiredByEnum
@ RequiredByEnum
The alignment comes from an alignment attribute on a enum type.
clang::ASTContext::getBOOLDecl
TypedefDecl * getBOOLDecl() const
Retrieve declaration of 'BOOL' typedef.
Definition: ASTContext.h:2078
clang::ASTContext::eraseDeclAttrs
void eraseDeclAttrs(const Decl *D)
Erase the attributes corresponding to the given declaration.
Definition: ASTContext.cpp:1515
clang::ASTContext::getInstantiatedFromUsingEnumDecl
UsingEnumDecl * getInstantiatedFromUsingEnumDecl(UsingEnumDecl *Inst)
If the given using-enum decl Inst is an instantiation of another using-enum decl, return it.
Definition: ASTContext.cpp:1583
clang::UsingShadowDecl
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Definition: DeclCXX.h:3222
clang::ASTContext::PSF_Execute
@ PSF_Execute
Definition: ASTContext.h:3331
clang::ASTContext::PSF_Write
@ PSF_Write
Definition: ASTContext.h:3330
clang::ASTContext::getObjCEncodingTypeSize
CharUnits getObjCEncodingTypeSize(QualType T) const
Return the size of type T for Objective-C encoding purpose, in characters.
Definition: ASTContext.cpp:7574
clang::ASTContext::setObjCNSStringType
void setObjCNSStringType(QualType T)
Definition: ASTContext.h:1842
clang::ASTContext::getCorrespondingSignedFixedPointType
QualType getCorrespondingSignedFixedPointType(QualType Ty) const
Definition: ASTContext.cpp:13246
clang::ASTContext::createMangleContext
MangleContext * createMangleContext(const TargetInfo *T=nullptr)
If T is null pointer, assume the target in ASTContext.
Definition: ASTContext.cpp:11845
clang::ObjCPropertyImplDecl
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition: DeclObjC.h:2753
ProfileList.h
clang::ASTContext::NumImplicitCopyConstructorsDeclared
unsigned NumImplicitCopyConstructorsDeclared
The number of implicitly-declared copy constructors for which declarations were built.
Definition: ASTContext.h:3168
clang::ASTContext::OverloadTy
CanQualType OverloadTy
Definition: ASTContext.h:1135
clang::QualType::withFastQualifiers
QualType withFastQualifiers(unsigned TQs) const
Definition: Type.h:957
llvm::Optional< unsigned >
clang::ASTContext::getObjCMethodRedeclaration
const ObjCMethodDecl * getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const
Get the duplicate declaration of a ObjCMethod in the same interface, or null if none exists.
Definition: ASTContext.cpp:2930
clang::ASTContext::getScalableVectorType
QualType getScalableVectorType(QualType EltTy, unsigned NumElts) const
Return the unique reference to a scalable vector type of the specified element type and scalable numb...
Definition: ASTContext.cpp:3978
llvm::SmallPtrSet
Definition: ASTContext.h:82
clang::ASTContext::SectionInfo::SectionFlags
int SectionFlags
Definition: ASTContext.h:3340
clang::NoSanitizeList
Definition: NoSanitizeList.h:29
clang::ASTContext::getUnqualifiedObjCPointerType
QualType getUnqualifiedObjCPointerType(QualType type) const
getUnqualifiedObjCPointerType - Returns version of Objective-C pointer type with lifetime qualifier r...
Definition: ASTContext.h:2175
clang::ASTContext::PSF_None
@ PSF_None
Definition: ASTContext.h:3328
clang::interp::Context
Holds all information required to evaluate constexpr code in a module.
Definition: Context.h:36
clang::ASTContext::canBindObjCObjectType
bool canBindObjCObjectType(QualType To, QualType From)
Definition: ASTContext.cpp:10101
clang::ASTContext::cloneFullComment
comments::FullComment * cloneFullComment(comments::FullComment *FC, const Decl *D) const
Definition: ASTContext.cpp:540
clang::ASTContext::getWIntType
QualType getWIntType() const
In C99, this returns a type compatible with the type defined in <stddef.h> as defined by the target.
Definition: ASTContext.h:1791
clang::AlignRequirementKind
AlignRequirementKind
Definition: ASTContext.h:165
clang::ASTContext::getTargetDefaultAlignForAttributeAligned
unsigned getTargetDefaultAlignForAttributeAligned() const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
Definition: ASTContext.cpp:2557
clang::ASTContext::UnwrapSimilarArrayTypes
void UnwrapSimilarArrayTypes(QualType &T1, QualType &T2, bool AllowPiMismatch=true)
Attempt to unwrap two types that may both be array types with the same bound (or both be array types ...
Definition: ASTContext.cpp:6037
clang::ASTContext::Char8Ty
CanQualType Char8Ty
Definition: ASTContext.h:1113
clang::ASTContext::mergeTransparentUnionType
QualType mergeTransparentUnionType(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
mergeTransparentUnionType - if T is a transparent union type and a member of T is compatible with Sub...
Definition: ASTContext.cpp:10130
clang::tooling::X
static ToolExecutorPluginRegistry::Add< AllTUsToolExecutorPlugin > X("all-TUs", "Runs FrontendActions on all TUs in the compilation database. " "Tool results are stored in memory.")
clang::ASTContext::getObjCIdRedefinitionType
QualType getObjCIdRedefinitionType() const
Retrieve the type that id has been defined to, which may be different from the built-in id if id has ...
Definition: ASTContext.h:1848
clang::PrintingPolicy
Describes how types, statements, expressions, and declarations should be printed.
Definition: PrettyPrinter.h:57
clang::ArrayInitLoopExpr
Represents a loop initializing the elements of an array.
Definition: Expr.h:5425
clang::ASTContext::Ibm128Ty
CanQualType Ibm128Ty
Definition: ASTContext.h:1119
clang::ASTContext::getCurrentKeyFunction
const CXXMethodDecl * getCurrentKeyFunction(const CXXRecordDecl *RD)
Get our current best idea for the key function of the given record decl, or nullptr if there isn't on...
Definition: RecordLayoutBuilder.cpp:3362
clang::ASTContext::getUnsignedPointerDiffType
QualType getUnsignedPointerDiffType() const
Return the unique unsigned counterpart of "ptrdiff_t" integer type.
Definition: ASTContext.cpp:5943
clang::ASTContext::getPackExpansionType
QualType getPackExpansionType(QualType Pattern, Optional< unsigned > NumExpansions, bool ExpectPackInType=true)
Form a pack expansion type with the given pattern.
Definition: ASTContext.cpp:5223
clang::ASTContext::getFixedPointMax
llvm::APFixedPoint getFixedPointMax(QualType Ty) const
Definition: ASTContext.cpp:13236
clang::FunctionType
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:3672
clang::ASTContext::getUsingType
QualType getUsingType(const UsingShadowDecl *Found, QualType Underlying) const
Definition: ASTContext.cpp:4677
clang::ASTContext::applyObjCProtocolQualifiers
QualType applyObjCProtocolQualifiers(QualType type, ArrayRef< ObjCProtocolDecl * > protocols, bool &hasError, bool allowOnPointerType=false) const
Apply Objective-C protocol qualifiers to the given type.
Definition: ASTContext.cpp:5377
clang::ASTContext::getNSCopyingName
IdentifierInfo * getNSCopyingName()
Retrieve the identifier 'NSCopying'.
Definition: ASTContext.h:1895
clang::ASTContext::getLocalCommentForDeclUncached
comments::FullComment * getLocalCommentForDeclUncached(const Decl *D) const
Return parsed documentation comment attached to a given declaration.
Definition: ASTContext.cpp:555
clang::ASTContext::setCFConstantStringType
void setCFConstantStringType(QualType T)
Definition: ASTContext.cpp:7350
clang::ASTContext::getSubstTemplateTypeParmType
QualType getSubstTemplateTypeParmType(const TemplateTypeParmType *Replaced, QualType Replacement, Optional< unsigned > PackIndex) const
Retrieve a substitution-result type.
Definition: ASTContext.cpp:4788
clang::ASTContext::getDependentBitIntType
QualType getDependentBitIntType(bool Unsigned, Expr *BitsExpr) const
Return a dependent bit-precise integer type with the specified signedness and bit count.
Definition: ASTContext.cpp:4562
ASTFwd.h
clang::ASTContext::toBits
int64_t toBits(CharUnits CharSize) const
Convert a size in characters to a size in bits.
Definition: ASTContext.cpp:2466
clang::ASTContext::getAutoRRefDeductType
QualType getAutoRRefDeductType() const
C++11 deduction pattern for 'auto &&' type.
Definition: ASTContext.cpp:5873
TemplateName.h
clang::DeclarationName
The name of a declaration.
Definition: DeclarationName.h:144
End
SourceLocation End
Definition: USRLocFinder.cpp:167
clang::ASTContext::getDeducedTemplateSpecializationType
QualType getDeducedTemplateSpecializationType(TemplateName Template, QualType DeducedType, bool IsDependent) const
C++17 deduced class template specialization type.
Definition: ASTContext.cpp:5812
clang::ASTContext::getSourceManager
SourceManager & getSourceManager()
Definition: ASTContext.h:721
clang::ASTContext::getDecayedType
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
Definition: ASTContext.cpp:3353
clang::ASTContext::getTranslationUnitDecl
TranslationUnitDecl * getTranslationUnitDecl() const
Definition: ASTContext.h:1089
clang::ASTContext::getBTFTagAttributedType
QualType getBTFTagAttributedType(const BTFTypeTagAttr *BTFAttr, QualType Wrapped)
Definition: ASTContext.cpp:4766
clang::ASTContext::isSameConstraintExpr
bool isSameConstraintExpr(const Expr *XCE, const Expr *YCE) const
Determine whether two 'requires' expressions are similar enough that they may be used in re-declarati...
Definition: ASTContext.cpp:6263
clang::TargetCXXABI::Kind
Kind
The basic C++ ABI kind.
Definition: TargetCXXABI.h:31
clang::ASTContext::Char16Ty
CanQualType Char16Ty
Definition: ASTContext.h:1114
clang::ASTContext::AtomicUsesUnsupportedLibcall
bool AtomicUsesUnsupportedLibcall(const AtomicExpr *E) const
Definition: ASTContext.cpp:12130
clang::ASTContext::getcudaConfigureCallDecl
FunctionDecl * getcudaConfigureCallDecl()
Definition: ASTContext.h:1420
clang::ASTContext::getFixedPointScale
unsigned char getFixedPointScale(QualType Ty) const
Definition: ASTContext.cpp:13133
clang::ASTContext::NumImplicitCopyConstructors
unsigned NumImplicitCopyConstructors
The number of implicitly-declared copy constructors.
Definition: ASTContext.h:3164
clang::Qualifiers::Restrict
@ Restrict
Definition: Type.h:151
clang::TypeInfo::AlignRequirement
AlignRequirementKind AlignRequirement
Definition: ASTContext.h:182
clang::ASTContext::mergeExtParameterInfo
bool mergeExtParameterInfo(const FunctionProtoType *FirstFnType, const FunctionProtoType *SecondFnType, bool &CanUseFirst, bool &CanUseSecond, SmallVectorImpl< FunctionProtoType::ExtParameterInfo > &NewParamInfos)
This function merges the ExtParameterInfo lists of two functions.
Definition: ASTContext.cpp:10730
clang::ASTContext::CommentsLoaded
bool CommentsLoaded
True if comments are already loaded from ExternalASTSource.
Definition: ASTContext.h:824
clang::SourceManager
This class handles loading and caching of source files into memory.
Definition: SourceManager.h:627
clang::ASTContext::hasSameTemplateName
bool hasSameTemplateName(const TemplateName &X, const TemplateName &Y) const
Determine whether the given template names refer to the same template.
Definition: ASTContext.cpp:6257
clang::ASTContext::InlineVariableDefinitionKind::WeakUnknown
@ WeakUnknown
Weak for now, might become strong later in this TU.
clang::ASTContext::getRawCFConstantStringType
QualType getRawCFConstantStringType() const
Get the structure type used to representation CFStrings, or NULL if it hasn't yet been built.
Definition: ASTContext.h:1823
clang::EnumDecl
Represents an enum.
Definition: Decl.h:3676
clang::ASTContext::getCanonicalFunctionResultType
CanQualType getCanonicalFunctionResultType(QualType ResultType) const
Adjust the given function result type.
Definition: ASTContext.cpp:4321
clang::ASTContext::getObjCEncodingForMethodDecl
std::string getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl, bool Extended=false) const
Emit the encoded type for the method declaration Decl into S.
Definition: ASTContext.cpp:7737
clang::ASTContext::OMPIteratorTy
CanQualType OMPIteratorTy
Definition: ASTContext.h:1146
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1565
llvm::RefCountedBase
Definition: LLVM.h:49
Decl.h
clang::ASTContext::ARCUnbridgedCastTy
CanQualType ARCUnbridgedCastTy
Definition: ASTContext.h:1137
clang::ObjCObjectType
Represents a class type in Objective C.
Definition: Type.h:6067
clang::ASTContext::setParameterIndex
void setParameterIndex(const ParmVarDecl *D, unsigned index)
Used by ParmVarDecl to store on the side the index of the parameter when it exceeds the size of the n...
Definition: ASTContext.cpp:12039
clang::ASTContext::SectionInfo::SectionInfo
SectionInfo(NamedDecl *Decl, SourceLocation PragmaSectionLocation, int SectionFlags)
Definition: ASTContext.h:3343
clang::ASTContext::getObjCGCQualType
QualType getObjCGCQualType(QualType T, Qualifiers::GC gcAttr) const
Return the uniqued reference to the type for an Objective-C gc-qualified type.
Definition: ASTContext.cpp:3093
RawCommentList.h
AddressSpaces.h
clang::ASTContext::getObjCSelDecl
TypedefDecl * getObjCSelDecl() const
Retrieve the typedef corresponding to the predefined 'SEL' type in Objective-C.
Definition: ASTContext.cpp:8667
clang::ASTContext::getAsDependentSizedArrayType
const DependentSizedArrayType * getAsDependentSizedArrayType(QualType T) const
Definition: ASTContext.h:2729
clang::GlobalDecl
GlobalDecl - represents a global declaration.
Definition: GlobalDecl.h:56
clang::ASTContext::local_imports
import_range local_imports() const
Definition: ASTContext.h:1047
clang::ASTContext::getAlignOfGlobalVar
unsigned getAlignOfGlobalVar(QualType T) const
Return the alignment in bits that should be given to a global variable with type T.
Definition: ASTContext.cpp:2563
uint64_t
unsigned long uint64_t
Definition: hlsl_basic_types.h:24
clang::ASTContext::typesAreCompatible
bool typesAreCompatible(QualType T1, QualType T2, bool CompareUnqualified=false)
Compatibility predicates used to check assignment expressions.
Definition: ASTContext.cpp:10111
clang::ASTContext::getBlockPointerType
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
Definition: ASTContext.cpp:3378
clang::ASTContext::BoundMemberTy
CanQualType BoundMemberTy
Definition: ASTContext.h:1135
clang::RawCommentList
This class represents all comments included in the translation unit, sorted in order of appearance in...
Definition: RawCommentList.h:195
clang::ASTContext::getQualifiedTemplateName
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateName Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
Definition: ASTContext.cpp:9158
clang::FloatModeKind
FloatModeKind
Definition: TargetInfo.h:69
size_t
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
Definition: opencl-c-base.h:118
clang::ASTContext::ObjCBuiltinBoolTy
CanQualType ObjCBuiltinBoolTy
Definition: ASTContext.h:1139
clang::ASTContext::UnsignedShortFractTy
CanQualType UnsignedShortFractTy
Definition: ASTContext.h:1124
clang::ASTContext::PSF_ZeroInit
@ PSF_ZeroInit
Definition: ASTContext.h:3333
clang::ASTContext::getFixedPointMin
llvm::APFixedPoint getFixedPointMin(QualType Ty) const
Definition: ASTContext.cpp:13241
clang::ASTContext::getTypeAlignInChars
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
Definition: ASTContext.cpp:2481
PrettyPrinter.h
clang::CanQual::getTypePtr
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
Definition: CanonicalType.h:83
clang::ASTContext::getAssumedTemplateName
TemplateName getAssumedTemplateName(DeclarationName Name) const
Retrieve a template name representing an unqualified-id that has been assumed to name a template for ...
Definition: ASTContext.cpp:9151
APSInt
llvm::APSInt APSInt
Definition: ByteCodeEmitter.cpp:19
clang::Redeclarable::setPreviousDecl
void setPreviousDecl(decl_type *PrevDecl)
Set the previous declaration.
Definition: Decl.h:4754
U
clang::ASTContext::Allocate
void * Allocate(size_t Size, unsigned Align=8) const
Definition: ASTContext.h:734
clang::UnresolvedUsingTypenameDecl
Represents a dependent using declaration which was marked with typename.
Definition: DeclCXX.h:3844
clang::ASTContext::UnsignedShortAccumTy
CanQualType UnsignedShortAccumTy
Definition: ASTContext.h:1122
clang::Qualifiers::hasNonFastQualifiers
bool hasNonFastQualifiers() const
Return true if the set contains any qualifiers which require an ExtQuals node to be allocated.
Definition: Type.h:431
clang::ASTContext::getReferenceQualifiedType
QualType getReferenceQualifiedType(const Expr *e) const
getReferenceQualifiedType - Given an expr, will return the type for that expression,...
Definition: ASTContext.cpp:5660
clang::ASTContext::setTraversalScope
void setTraversalScope(const std::vector< Decl * > &)
Definition: ASTContext.cpp:1035
clang::ASTContext::ProtocolCompatibleWithProtocol
bool ProtocolCompatibleWithProtocol(ObjCProtocolDecl *lProto, ObjCProtocolDecl *rProto) const
ProtocolCompatibleWithProtocol - return 'true' if 'lProto' is in the inheritance hierarchy of 'rProto...
Definition: ASTContext.cpp:9515
clang::ASTContext::getObjCIdType
QualType getObjCIdType() const
Represents the Objective-CC id type.
Definition: ASTContext.h:2047
clang::TypeInfo
Definition: ASTContext.h:179
clang::ASTContext::setNonKeyFunction
void setNonKeyFunction(const CXXMethodDecl *method)
Observe that the given method cannot be a key function.
Definition: RecordLayoutBuilder.cpp:3385
clang::ASTContext::getUIntPtrType
QualType getUIntPtrType() const
Return a type compatible with "uintptr_t" (C99 7.18.1.4), as defined by the target.
Definition: ASTContext.cpp:5930
V
#define V(N, I)
Definition: ASTContext.h:3233
clang::ASTContext::getSubstTemplateTypeParmPackType
QualType getSubstTemplateTypeParmPackType(const TemplateTypeParmType *Replaced, const TemplateArgument &ArgPack)
Retrieve a.
Definition: ASTContext.cpp:4811
clang::ASTContext::getIntMaxType
CanQualType getIntMaxType() const
Return the unique type for "intmax_t" (C99 7.18.1.5), defined in <stdint.h>.
Definition: ASTContext.cpp:5903
clang::ASTContext::CollectInheritedProtocols
void CollectInheritedProtocols(const Decl *CDecl, llvm::SmallPtrSet< ObjCProtocolDecl *, 8 > &Protocols)
CollectInheritedProtocols - Collect all protocols in current class and those inherited by it.
Definition: ASTContext.cpp:2626
clang::ASTContext::getExternalSource
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any.
Definition: ASTContext.h:1194
clang::ASTContext::getSubstTemplateTemplateParm
TemplateName getSubstTemplateTemplateParm(TemplateTemplateParmDecl *param, TemplateName replacement) const
Definition: ASTContext.cpp:9253
clang::ASTContext::getObjCIdDecl
TypedefDecl * getObjCIdDecl() const
Retrieve the typedef corresponding to the predefined id type in Objective-C.
Definition: ASTContext.cpp:8658
clang::TranslationUnitDecl
The top declaration context.
Definition: Decl.h:80
clang::ASTContext::getExtVectorType
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size.
Definition: ASTContext.cpp:4092
clang::ASTContext::getExnObjectAlignment
CharUnits getExnObjectAlignment() const
Return the alignment (in bytes) of the thrown exception object.
Definition: ASTContext.cpp:1840
clang::ASTContext::SatLongFractTy
CanQualType SatLongFractTy
Definition: ASTContext.h:1128
clang::MangleContext
MangleContext - Context for tracking state which persists across multiple calls to the C++ name mangl...
Definition: Mangle.h:44
clang::Module
Describes a module or submodule.
Definition: Module.h:98
clang::Type::isSignedIntegerOrEnumerationType
bool isSignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is signed or an enumeration types whose underlying ty...
Definition: Type.cpp:2039
clang::ASTContext::removeAddrSpaceQualType
QualType removeAddrSpaceQualType(QualType T) const
Remove any existing address space on the type and returns the type with qualifiers intact (or that's ...
Definition: ASTContext.cpp:3059
clang::ASTContext::areCompatibleSveTypes
bool areCompatibleSveTypes(QualType FirstType, QualType SecondType)
Return true if the given types are an SVE builtin and a VectorType that is a fixed-length representat...
Definition: ASTContext.cpp:9405
clang::ASTContext::getOffsetOfBaseWithVBPtr
CharUnits getOffsetOfBaseWithVBPtr(const CXXRecordDecl *RD) const
Loading virtual member pointers using the virtual inheritance model always results in an adjustment u...
Definition: ASTContext.cpp:2575
clang::ASTContext::WideCharTy
CanQualType WideCharTy
Definition: ASTContext.h:1111
clang::ASTContext::NumImplicitMoveAssignmentOperators
unsigned NumImplicitMoveAssignmentOperators
The number of implicitly-declared move assignment operators.
Definition: ASTContext.h:3185
clang::TemplateArgumentListInfo
A convenient class for passing around template argument information.
Definition: TemplateBase.h:563
clang::ASTContext::AccumTy
CanQualType AccumTy
Definition: ASTContext.h:1120
clang::ASTContext::OCLSamplerTy
CanQualType OCLSamplerTy
Definition: ASTContext.h:1143
clang::ImportDecl
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:4558
clang::ASTContext::getAsConstantArrayType
const ConstantArrayType * getAsConstantArrayType(QualType T) const
Definition: ASTContext.h:2720
clang::ASTContext::getDependentVectorType
QualType getDependentVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc, VectorType::VectorKind VecKind) const
Return the unique reference to the type for a dependently sized vector of the specified element type.
Definition: ASTContext.cpp:4052
clang::ASTContext::WIntTy
CanQualType WIntTy
Definition: ASTContext.h:1112
clang::LangASMap
unsigned[(unsigned) LangAS::FirstTargetAddressSpace] LangASMap
The type of a lookup table which maps from language-specific address spaces to target-specific ones.
Definition: AddressSpaces.h:67
clang::ASTContext::getNameForTemplate
DeclarationNameInfo getNameForTemplate(TemplateName Name, SourceLocation NameLoc) const
Definition: ASTContext.cpp:6157
clang::TagTypeKind
TagTypeKind
The kind of a tag type.
Definition: Type.h:5562
Node
DynTypedNode Node
Definition: ASTMatchFinder.cpp:68
clang::ASTContext::NumImplicitCopyAssignmentOperators
unsigned NumImplicitCopyAssignmentOperators
The number of implicitly-declared copy assignment operators.
Definition: ASTContext.h:3178
clang::ASTContext::getAsIncompleteArrayType
const IncompleteArrayType * getAsIncompleteArrayType(QualType T) const
Definition: ASTContext.h:2726
clang::ASTContext::getObjCImplementation
ObjCImplementationDecl * getObjCImplementation(ObjCInterfaceDecl *D)
Get the implementation of the ObjCInterfaceDecl D, or nullptr if none exists.
Definition: ASTContext.cpp:2897
clang::ASTContext::getDefaultCallingConvention
CallingConv getDefaultCallingConvention(bool IsVariadic, bool IsCXXMethod, bool IsBuiltin=false) const
Retrieves the default calling convention for the current target.
Definition: ASTContext.cpp:11787
clang::ASTContext::CUDAConstantEvalContextRAII::CUDAConstantEvalContextRAII
CUDAConstantEvalContextRAII(ASTContext &Ctx_, bool NoWrongSidedVars)
Definition: ASTContext.h:678
clang::FunctionProtoType::ExceptionSpecInfo
Holds information about the various types of exception specification.
Definition: Type.h:4070
clang::ASTContext::getReadPipeType
QualType getReadPipeType(QualType T) const
Return a read_only pipe type for the specified type.
Definition: ASTContext.cpp:4540
DeclBase.h
clang::ASTContext::getUInt128Decl
TypedefDecl * getUInt128Decl() const
Retrieve the declaration for the 128-bit unsigned integer type.
Definition: ASTContext.cpp:1268
clang::ConceptDecl
Declaration of a C++2a concept.
Definition: DeclTemplate.h:3265
clang::SelectorTable::getSelector
Selector getSelector(unsigned NumArgs, IdentifierInfo **IIV)
Can create any sort of selector.
Definition: IdentifierTable.cpp:784
clang::ASTContext::Float16Ty
CanQualType Float16Ty
Definition: ASTContext.h:1133
clang::ASTContext::Selectors
SelectorTable & Selectors
Definition: ASTContext.h:661
OperatorKinds.h
clang::ASTContext::getAsArrayType
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
Definition: ASTContext.cpp:6836
clang::ASTContext::getBlockVarCopyInit
BlockVarCopyInit getBlockVarCopyInit(const VarDecl *VD) const
Get the copy initialization expression of the VarDecl VD, or nullptr if none exists.
Definition: ASTContext.cpp:2954
clang::Decl::ObjCDeclQualifier
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
Definition: DeclBase.h:195
clang::ASTContext::getPrimaryMergedDecl
Decl * getPrimaryMergedDecl(Decl *D)
Definition: ASTContext.h:1051
clang::VectorType
Represents a GCC generic vector type.
Definition: Type.h:3355
clang::ASTContext::getTargetNullPointerValue
uint64_t getTargetNullPointerValue(QualType QT) const
Get target-dependent integer value for null pointer which is used for constant folding.
Definition: ASTContext.cpp:12179
clang::ASTContext::PSF_Read
@ PSF_Read
Definition: ASTContext.h:3329
clang::ASTContext::DependentTy
CanQualType DependentTy
Definition: ASTContext.h:1135
clang::TypeInfoChars::TypeInfoChars
TypeInfoChars()
Definition: ASTContext.h:198
clang::ASTContext::getTypeInfoDataSizeInChars
TypeInfoChars getTypeInfoDataSizeInChars(QualType T) const
Definition: ASTContext.cpp:1848
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:209
clang::TU_Incremental
@ TU_Incremental
The translation unit is a is a complete translation unit that we might incrementally extend later.
Definition: LangOptions.h:915
clang::GetUnarySelector
Selector GetUnarySelector(StringRef name, ASTContext &Ctx)
Utility function for constructing an unary selector.
Definition: ASTContext.h:3379
clang::ASTContext::getSizeType
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
Definition: ASTContext.cpp:5892
clang::ComparisonCategories
Definition: ComparisonCategories.h:173
clang::ASTContext::addOverriddenMethod
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
Definition: ASTContext.cpp:1658
clang::ASTContext::getTypeAlignIfKnown
unsigned getTypeAlignIfKnown(QualType T, bool NeedsPreferredAlignment=false) const
Return the alignment of a type, in bits, or 0 if the type is incomplete and we cannot determine the a...
Definition: ASTContext.cpp:1904
clang::StreamingDiagnostic
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
Definition: Diagnostic.h:1110
clang::ASTContext::getUnaryTransformType
QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType, UnaryTransformType::UTTKind UKind) const
Unary type transforms.
Definition: ASTContext.cpp:5715
clang::ArrayType
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition: Type.h:3009
NestedNameSpecifier.h
clang::ASTContext::getFloatingTypeOrder
int getFloatingTypeOrder(QualType LHS, QualType RHS) const
Compare the rank of the two specified floating point types, ignoring the domain of the type (i....
Definition: ASTContext.cpp:7015
LangOptions.h
clang::ASTContext::SectionInfo::PragmaSectionLocation
SourceLocation PragmaSectionLocation
Definition: ASTContext.h:3339
clang::ASTContext::getCFConstantStringType
QualType getCFConstantStringType() const
Return the C structure type used to represent constant CFStrings.
Definition: ASTContext.cpp:7337
clang::ASTContext::DeepCollectObjCIvars
void DeepCollectObjCIvars(const ObjCInterfaceDecl *OI, bool leafClass, SmallVectorImpl< const ObjCIvarDecl * > &Ivars) const
DeepCollectObjCIvars - This routine first collects all declared, but not synthesized,...
Definition: ASTContext.cpp:2609
Depth
int Depth
Definition: ASTDiff.cpp:191
clang::ASTContext::overridden_method_range
llvm::iterator_range< overridden_cxx_method_iterator > overridden_method_range
Definition: ASTContext.h:1017
clang::ASTContext::getConstantArrayElementCount
uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const
Return number of constant array elements.
Definition: ASTContext.cpp:6967
clang::ASTContext::getRValueReferenceType
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type.
Definition: ASTContext.cpp:3450
clang::ASTContext::getObjCSuperType
QualType getObjCSuperType() const
Returns the C struct type for objc_super.
Definition: ASTContext.cpp:7341
clang::ASTContext::getAsVariableArrayType
const VariableArrayType * getAsVariableArrayType(QualType T) const
Definition: ASTContext.h:2723
clang::TypeInfo::isAlignRequired
bool isAlignRequired()
Definition: ASTContext.h:188
clang::ASTContext::getDeclAttrs
AttrVec & getDeclAttrs(const Decl *D)
Retrieve the attributes for the given declaration.
Definition: ASTContext.cpp:1504
clang::TemplateArgument
Represents a template argument.
Definition: TemplateBase.h:61
clang::ASTContext::UnsignedFractTy
CanQualType UnsignedFractTy
Definition: ASTContext.h:1124
clang::ASTMutationListener
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
Definition: ASTMutationListener.h:46
clang::ASTContext::getSignatureParameterType
QualType getSignatureParameterType(QualType T) const
Retrieve the parameter type as adjusted for use in the signature of a function, decaying array and fu...
Definition: ASTContext.cpp:6900
clang::ASTContext::BuiltinVectorTypeInfo::EC
llvm::ElementCount EC
Definition: ASTContext.h:1489
clang::LazyGenerationalUpdatePtr
A lazy value (of type T) that is within an AST node of type Owner, where the value might change in la...
Definition: ExternalASTSource.h:388
clang::ASTContext::filterFunctionTargetAttrs
ParsedTargetAttr filterFunctionTargetAttrs(const TargetAttr *TD) const
Parses the target attributes passed in, and returns only the ones that are valid feature names.
Definition: ASTContext.cpp:13281
clang::ASTContext::setInstantiatedFromUsingShadowDecl
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, UsingShadowDecl *Pattern)
Definition: ASTContext.cpp:1608
clang::CanQualType
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
Definition: CanonicalType.h:212
clang::ASTContext::WCharTy
CanQualType WCharTy
Definition: ASTContext.h:1110
clang::ASTContext::setExternalSource
void setExternalSource(IntrusiveRefCntPtr< ExternalASTSource > Source)
Attach an external AST source to the AST context.
Definition: ASTContext.cpp:1045
clang::ASTContext::NumImplicitDefaultConstructorsDeclared
unsigned NumImplicitDefaultConstructorsDeclared
The number of implicitly-declared default constructors for which declarations were built.
Definition: ASTContext.h:3161
clang::ASTContext::isSameEntity
bool isSameEntity(const NamedDecl *X, const NamedDecl *Y) const
Determine whether the two declarations refer to the same entity.
Definition: ASTContext.cpp:6500
clang::ASTContext::getObjCInterfaceType
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl.
Definition: ASTContext.cpp:5587
clang::ASTContext::getTemplateTypeParmType
QualType getTemplateTypeParmType(unsigned Depth, unsigned Index, bool ParameterPack, TemplateTypeParmDecl *ParmDecl=nullptr) const
Retrieve the template type parameter type for a template parameter or parameter pack with the given d...
Definition: ASTContext.cpp:4847
clang::ASTContext::ParsedComments
llvm::DenseMap< const Decl *, comments::FullComment * > ParsedComments
Mapping from declarations to parsed comments attached to any redeclaration.
Definition: ASTContext.h:850
clang::RISCV::Policy
Policy
Definition: RISCVVIntrinsicUtils.h:94
clang::Qualifiers::Volatile
@ Volatile
Definition: Type.h:152
clang::ASTContext::getBuiltinVectorTypeInfo
BuiltinVectorTypeInfo getBuiltinVectorTypeInfo(const BuiltinType *VecTy) const
Returns the element type, element count and number of vectors (in case of tuple) for a builtin vector...
Definition: ASTContext.cpp:3850
clang::ASTContext::UnknownAnyTy
CanQualType UnknownAnyTy
Definition: ASTContext.h:1135
clang::ASTContext::getManglingNumber
unsigned getManglingNumber(const NamedDecl *ND, bool ForAuxTarget=false) const
Definition: ASTContext.cpp:11958
clang::ASTContext::getTypeInfo
TypeInfo getTypeInfo(QualType T) const
Definition: ASTContext.h:2293
clang::MSGuidDecl
A global _GUID constant.
Definition: DeclCXX.h:4174
clang::comments::FullComment
A full comment attached to a declaration, contains block content.
Definition: Comment.h:1077
clang::ASTContext::getTypeSize
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
Definition: ASTContext.h:2299
clang::ASTContext::hasUniqueObjectRepresentations
bool hasUniqueObjectRepresentations(QualType Ty) const
Return true if the specified type has unique object representations according to (C++17 [meta....
Definition: ASTContext.cpp:2788
clang::ASTContext::getAutoDeductType
QualType getAutoDeductType() const
C++11 deduction pattern for 'auto' type.
Definition: ASTContext.cpp:5862
Linkage.h
IdentifierTable.h
clang::ASTContext::getXRayFilter
const XRayFunctionFilter & getXRayFilter() const
Definition: ASTContext.h:803
Type.h
clang::TypeInfoChars::Align
CharUnits Align
Definition: ASTContext.h:195
clang::ASTContext::UnwrapSimilarTypes
bool UnwrapSimilarTypes(QualType &T1, QualType &T2, bool AllowPiMismatch=true)
Attempt to unwrap two types that may be similar (C++ [conv.qual]).
Definition: ASTContext.cpp:6088
clang::ASTContext::ObjCBuiltinSelTy
CanQualType ObjCBuiltinSelTy
Definition: ASTContext.h:1138
clang::ASTContext::getObjCEncodingForBlock
std::string getObjCEncodingForBlock(const BlockExpr *blockExpr) const
Return the encoded type for this block declaration.
Definition: ASTContext.cpp:7623
clang::diff::Update
@ Update
Definition: ASTDiff.h:30
clang::SelectorTable
This table allows us to fully hide how we implement multi-keyword caching.
Definition: IdentifierTable.h:904
clang::ASTContext::adjustExceptionSpec
void adjustExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI, bool AsWritten=false)
Change the exception specification on a function once it is delay-parsed, instantiated,...
Definition: ASTContext.cpp:3228
clang::TemplateTemplateParmDecl
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Definition: DeclTemplate.h:1630
clang::TypeInfoChars::Width
CharUnits Width
Definition: ASTContext.h:194
clang::RawComment
Definition: RawCommentList.h:32
clang::ASTContext::getRecordType
QualType getRecordType(const RecordDecl *Decl) const
Definition: ASTContext.cpp:4704
clang::AlignRequirementKind::RequiredByTypedef
@ RequiredByTypedef
The alignment comes from an alignment attribute on a typedef.
clang::ASTContext::CompCategories
ComparisonCategories CompCategories
Types and expressions required to build C++2a three-way comparisons using operator<=>,...
Definition: ASTContext.h:2241
clang::ASTContext::getCanonicalType
const Type * getCanonicalType(const Type *T) const
Definition: ASTContext.h:2526
clang::ASTContext::getIntTypeForBitwidth
QualType getIntTypeForBitwidth(unsigned DestWidth, unsigned Signed) const
getIntTypeForBitwidth - sets integer QualTy according to specified details: bitwidth,...
Definition: ASTContext.cpp:11917
clang::ASTContext::getFloatingTypeSemanticOrder
int getFloatingTypeSemanticOrder(QualType LHS, QualType RHS) const
Compare the rank of two floating point types as above, but compare equal if both types have the same ...
Definition: ASTContext.cpp:7026
clang::CallingConv
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition: Specifiers.h:266
clang::ASTContext::getObjContainingInterface
const ObjCInterfaceDecl * getObjContainingInterface(const NamedDecl *ND) const
Returns the Objective-C interface that ND belongs to if it is an Objective-C method/property/ivar etc...
Definition: ASTContext.cpp:2940
clang::ASTContext::LongAccumTy
CanQualType LongAccumTy
Definition: ASTContext.h:1121
clang::ASTContext::getCommonSugaredType
QualType getCommonSugaredType(QualType X, QualType Y, bool Unqualified=false)
Definition: ASTContext.cpp:13016
clang::VarDecl
Represents a variable declaration or definition.
Definition: Decl.h:879
clang::ASTContext::canAssignObjCInterfaces
bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
canAssignObjCInterfaces - Return true if the two interface types are compatible for assignment from R...
Definition: ASTContext.cpp:9661
clang::ASTContext::setObjCClassRedefinitionType
void setObjCClassRedefinitionType(QualType RedefType)
Set the user-written type that redefines 'SEL'.
Definition: ASTContext.h:1868
clang::ASTContext::FloatTy
CanQualType FloatTy
Definition: ASTContext.h:1119
clang::ASTContext::getObjCClassType
QualType getObjCClassType() const
Represents the Objective-C Class type.
Definition: ASTContext.h:2069
clang::ASTContext::UnsignedLongAccumTy
CanQualType UnsignedLongAccumTy
Definition: ASTContext.h:1122
clang::XRayFunctionFilter
Definition: XRayLists.h:29
clang::TagDecl
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3396
clang::ASTContext::getRealTypeForBitwidth
QualType getRealTypeForBitwidth(unsigned DestWidth, FloatModeKind ExplicitType) const
getRealTypeForBitwidth - sets floating point QualTy according to specified bitwidth.
Definition: ASTContext.cpp:11929
clang::Type::getCanonicalTypeInternal
QualType getCanonicalTypeInternal() const
Definition: Type.h:2581
clang::ASTContext::getBoolName
IdentifierInfo * getBoolName() const
Retrieve the identifier 'bool'.
Definition: ASTContext.h:1908
clang::TemplateParameterList
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:70
clang::StringLiteral
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1775
clang::ASTContext::getDefaultOpenCLPointeeAddrSpace
LangAS getDefaultOpenCLPointeeAddrSpace()
Returns default address space based on OpenCL version and enabled features.
Definition: ASTContext.h:1411
clang::ASTContext::getInterpContext
interp::Context & getInterpContext()
Returns the clang bytecode interpreter context.
Definition: ASTContext.cpp:915
clang::ASTContext::isPromotableBitField
QualType isPromotableBitField(Expr *E) const
Whether this is a promotable bitfield reference according to C99 6.3.1.1p2, bullet 2 (and GCC extensi...
Definition: ASTContext.cpp:7075
clang::ASTContext::getLifetimeQualifiedType
QualType getLifetimeQualifiedType(QualType type, Qualifiers::ObjCLifetime lifetime)
Return a type with the given lifetime qualifier.
Definition: ASTContext.h:2163
clang::ObjCCategoryImplDecl
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
Definition: DeclObjC.h:2495
clang::ASTContext::getCanonicalType
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
Definition: ASTContext.h:2522
clang::CXXABI
Implements C++ ABI-specific semantic analysis functions.
Definition: CXXABI.h:29
clang::ASTContext::setObjCMethodRedeclaration
void setObjCMethodRedeclaration(const ObjCMethodDecl *MD, const ObjCMethodDecl *Redecl)
Definition: ASTContext.cpp:2934
clang::TypeDecl
Represents a declaration of a type.
Definition: Decl.h:3206
clang::SplitQualType::Ty
const Type * Ty
The locally-unqualified type.
Definition: Type.h:672
clang::ASTContext::getObjCObjectType
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
Definition: ASTContext.cpp:5288
llvm::DenseSet
Definition: Sema.h:77
clang::ASTContext::AllocateDeclListNode
DeclListNode * AllocateDeclListNode(clang::NamedDecl *ND)
Allocates a DeclListNode or returns one from the ListNodeFreeList pool.
Definition: ASTContext.h:744
clang::ASTContext::setInstantiatedFromStaticDataMember
void setInstantiatedFromStaticDataMember(VarDecl *Inst, VarDecl *Tmpl, TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
Note that the static data member Inst is an instantiation of the static data member template Tmpl of ...
Definition: ASTContext.cpp:1542
clang::ASTContext::SatAccumTy
CanQualType SatAccumTy
Definition: ASTContext.h:1125
clang::ASTContext::getCommentCommandTraits
comments::CommandTraits & getCommentCommandTraits() const
Definition: ASTContext.h:952
clang::ASTContext::getObjCEncodingForMethodParameter
void getObjCEncodingForMethodParameter(Decl::ObjCDeclQualifier QT, QualType T, std::string &S, bool Extended) const
getObjCEncodingForMethodParameter - Return the encoded type for a single method parameter or return t...
Definition: ASTContext.cpp:7720
clang::ASTContext::addDestruction
void addDestruction(T *Ptr) const
If T isn't trivially destructible, calls AddDeallocation to register it for destruction.
Definition: ASTContext.h:3062
clang::ASTContext::getObjCEncodingForTypeQualifier
void getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT, std::string &S) const
Put the string version of the type qualifiers QT into S.
Definition: ASTContext.cpp:8642
NoSanitizeList.h
clang::ASTContext::getComplexType
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type.
Definition: ASTContext.cpp:3258
CXXABI
#define CXXABI(Name, Str)
Definition: TargetCXXABI.h:32
clang::ASTContext::getConstantMatrixType
QualType getConstantMatrixType(QualType ElementType, unsigned NumRows, unsigned NumColumns) const
Return the unique reference to the matrix type of the specified element type and size.
Definition: ASTContext.cpp:4167
clang::QualifierCollector
A qualifier set is used to build a set of qualifiers.
Definition: Type.h:6615
clang::ASTContext::getVolatileType
QualType getVolatileType(QualType T) const
Return the uniqued reference to the type for a volatile qualified type.
Definition: ASTContext.h:1292
clang::ASTContext::getPromotedIntegerType
QualType getPromotedIntegerType(QualType PromotableType) const
Return the type that PromotableType will promote to: C99 6.3.1.1p2, assuming that PromotableType is a...
Definition: ASTContext.cpp:7130
clang::ASTContext::isNearlyEmpty
bool isNearlyEmpty(const CXXRecordDecl *RD) const
Definition: ASTContext.cpp:11825
clang::CanQual< Type >
Base
clang::BlockVarCopyInit
Copy initialization expr of a __block variable and a boolean flag that indicates whether the expressi...
Definition: Expr.h:6020
clang::ASTWriter
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:85
clang::ASTContext::getPointerType
CanQualType getPointerType(CanQualType T) const
Definition: ASTContext.h:1351
clang::ASTContext::DumpRecordLayout
void DumpRecordLayout(const RecordDecl *RD, raw_ostream &OS, bool Simple=false) const
Definition: RecordLayoutBuilder.cpp:3684
clang::ASTContext::getVaListTagDecl
Decl * getVaListTagDecl() const
Retrieve the C type declaration corresponding to the predefined __va_list_tag type used to help defin...
Definition: ASTContext.cpp:9093
clang::ASTContext::getObjCProtocolDecl
ObjCInterfaceDecl * getObjCProtocolDecl() const
Retrieve the Objective-C class declaration corresponding to the predefined Protocol class.
Definition: ASTContext.cpp:8684
clang::operator<<
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
Definition: ASTContext.cpp:13355
clang::ASTContext::InlineVariableDefinitionKind
InlineVariableDefinitionKind
Definition: ASTContext.h:3273
clang::AutoTypeKeyword
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
Definition: Type.h:1528
clang::ASTContext::ASTContext
ASTContext(LangOptions &LOpts, SourceManager &SM, IdentifierTable &idents, SelectorTable &sels, Builtin::Context &builtins, TranslationUnitKind TUKind)
Definition: ASTContext.cpp:973
clang::ASTContext::deduplicateMergedDefinitonsFor
void deduplicateMergedDefinitonsFor(NamedDecl *ND)
Clean up the merged definition list.
Definition: ASTContext.cpp:1119
clang::ASTContext::getSignedSizeType
CanQualType getSignedSizeType() const
Return the unique signed counterpart of the integer type corresponding to size_t.
Definition: ASTContext.cpp:5898
clang::ASTContext::RedeclChainComments
llvm::DenseMap< const Decl *, const Decl * > RedeclChainComments
Mapping from canonical declaration to the first redeclaration in chain that has a comment attached.
Definition: ASTContext.h:837
clang::ASTContext::getOverriddenMethods
void getOverriddenMethods(const NamedDecl *Method, SmallVectorImpl< const NamedDecl * > &Overridden) const
Return C++ or ObjC overridden methods for the given Method.
Definition: ASTContext.cpp:1664
clang::ASTContext::setObjCSelRedefinitionType
void setObjCSelRedefinitionType(QualType RedefType)
Set the user-written type that redefines 'SEL'.
Definition: ASTContext.h:1881
clang::TemplateTypeParmDecl
Declaration of a template type parameter.
Definition: DeclTemplate.h:1208
clang::IncrementalParser
Provides support for incremental compilation.
Definition: IncrementalParser.h:39
clang::ASTContext::ObjCObjectAdoptsQTypeProtocols
bool ObjCObjectAdoptsQTypeProtocols(QualType QT, ObjCInterfaceDecl *Decl)
ObjCObjectAdoptsQTypeProtocols - Checks that protocols in IC's protocol list adopt all protocols in Q...
Definition: ASTContext.cpp:5492
clang::TypeOfKind
TypeOfKind
The kind of 'typeof' expression we're after.
Definition: Type.h:718
clang::TemplateParamObjectDecl
A template parameter object.
Definition: DeclTemplate.h:3321
clang::ASTContext::MSGuidTagDecl
TagDecl * MSGuidTagDecl
Definition: ASTContext.h:1169
clang::OverloadedOperatorKind
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:21
clang::ASTContext::getInstantiatedFromUsingDecl
NamedDecl * getInstantiatedFromUsingDecl(NamedDecl *Inst)
If the given using decl Inst is an instantiation of another (possibly unresolved) using decl,...
Definition: ASTContext.cpp:1560
clang::ASTContext::getASTAllocatedMemory
size_t getASTAllocatedMemory() const
Return the total amount of physical memory allocated for representing AST nodes and type information.
Definition: ASTContext.h:762
OPT_LIST
#define OPT_LIST(V)
Definition: ASTContext.h:3220
clang::ASTContext::ShortTy
CanQualType ShortTy
Definition: ASTContext.h:1116
clang::ASTContext::getDecltypeType
QualType getDecltypeType(Expr *e, QualType UnderlyingType) const
C++11 decltype.
Definition: ASTContext.cpp:5684
clang::ASTContext::Deallocate
void Deallocate(void *Ptr) const
Definition: ASTContext.h:740
clang::IncompleteArrayType
Represents a C array with an unspecified size.
Definition: Type.h:3115
clang::ASTContext::getFunctionNoProtoType
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
Definition: ASTContext.cpp:4283
clang::Qualifiers::ObjCLifetime
ObjCLifetime
Definition: Type.h:162
clang::ASTContext::setManglingNumber
void setManglingNumber(const NamedDecl *ND, unsigned Number)
Definition: ASTContext.cpp:11953
ExternalASTSource.h
clang::ASTContext::getObjCTypeParamType
QualType getObjCTypeParamType(const ObjCTypeParamDecl *Decl, ArrayRef< ObjCProtocolDecl * > protocols) const
Definition: ASTContext.cpp:5448
clang::ASTContext::UnsignedLongLongTy
CanQualType UnsignedLongLongTy
Definition: ASTContext.h:1118
clang::ASTContext::getOpenCLTypeKind
OpenCLTypeKind getOpenCLTypeKind(const Type *T) const
Map an AST Type to an OpenCLTypeKind enum value.
Definition: ASTContext.cpp:7432
clang::ASTContext::setObjCConstantStringInterface
void setObjCConstantStringInterface(ObjCInterfaceDecl *Decl)
Definition: ASTContext.cpp:9117
clang::ASTContext::isSameTemplateParameterList
bool isSameTemplateParameterList(const TemplateParameterList *X, const TemplateParameterList *Y) const
Determine whether two template parameter lists are similar enough that they may be used in declaratio...
Definition: ASTContext.cpp:6344
clang::ASTContext::hasSameFunctionTypeIgnoringPtrSizes
bool hasSameFunctionTypeIgnoringPtrSizes(QualType T, QualType U)
Determine whether two function types are the same, ignoring pointer sizes in the return type and para...
Definition: ASTContext.cpp:3222
TargetCXXABI.h
clang::ASTContext::ObjCQualifiedClassTypesAreCompatible
bool ObjCQualifiedClassTypesAreCompatible(const ObjCObjectPointerType *LHS, const ObjCObjectPointerType *RHS)
ObjCQualifiedClassTypesAreCompatible - compare Class<pr,...> and Class<pr1, ...>.
Definition: ASTContext.cpp:9527
clang::ObjCCategoryDecl
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2276
clang::ASTContext::getCorrespondingUnsignedType
QualType getCorrespondingUnsignedType(QualType T) const
Definition: ASTContext.cpp:10871
clang::ASTContext::getWideCharType
QualType getWideCharType() const
Return the type of wide characters.
Definition: ASTContext.h:1777
clang::ASTContext::adjustStringLiteralBaseType
QualType adjustStringLiteralBaseType(QualType StrLTy) const
Definition: ASTContext.cpp:4534
clang::ASTContext::getMSGuidType
QualType getMSGuidType() const
Retrieve the implicitly-predeclared 'struct _GUID' type.
Definition: ASTContext.h:2124
clang::ASTContext::UnsignedCharTy
CanQualType UnsignedCharTy
Definition: ASTContext.h:1117
clang::TemplateTypeParmType
Definition: Type.h:4999
clang::ASTContext::getExceptionObjectType
QualType getExceptionObjectType(QualType T) const
Definition: ASTContext.cpp:6906
clang::ASTContext::FractTy
CanQualType FractTy
Definition: ASTContext.h:1123
clang::ParentMapContext
Definition: ParentMapContext.h:23
clang::LangAS
LangAS
Defines the address space values used by the address space qualifier of QualType.
Definition: AddressSpaces.h:25
clang::ASTContext::BuiltinFnTy
CanQualType BuiltinFnTy
Definition: ASTContext.h:1136
clang::TypeInfoChars::TypeInfoChars
TypeInfoChars(CharUnits Width, CharUnits Align, AlignRequirementKind AlignRequirement)
Definition: ASTContext.h:199
clang::ASTContext::getCanonicalParamType
CanQualType getCanonicalParamType(QualType T) const
Return the canonical parameter type corresponding to the specific potentially non-canonical one.
Definition: ASTContext.cpp:5957
operator*
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, const clang::CharUnits &CU)
Definition: CharUnits.h:218
clang::ASTContext::getFunctionTypeWithoutPtrSizes
QualType getFunctionTypeWithoutPtrSizes(QualType T)
Get a function type and produce the equivalent function type where pointer size address spaces in the...
Definition: ASTContext.cpp:3205
clang::ASTContext::UnsignedLongTy
CanQualType UnsignedLongTy
Definition: ASTContext.h:1117
clang::ASTContext::getConstType
QualType getConstType(QualType T) const
Return the uniqued reference to the type for a const qualified type.
Definition: ASTContext.h:1303
clang::ObjCObjectPointerType
Represents a pointer to an Objective C object.
Definition: Type.h:6323
clang::ASTContext::overridden_methods_end
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
Definition: ASTContext.cpp:1639
clang::ASTRecordLayout
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
Definition: RecordLayout.h:38
clang::ASTContext::getDecayedType
CanQualType getDecayedType(CanQualType T) const
Definition: ASTContext.h:1367
clang::UsingEnumDecl
Represents a C++ using-enum-declaration.
Definition: DeclCXX.h:3614
clang::ASTContext::getAdjustedType
QualType getAdjustedType(QualType Orig, QualType New) const
Return the uniqued reference to a type adjusted from the original type to a new type.
Definition: ASTContext.cpp:3312
clang::TranslationUnitDecl::Create
static TranslationUnitDecl * Create(ASTContext &C)
Definition: Decl.cpp:4896
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:254
clang::ASTContext::getPreferredTypeAlign
unsigned getPreferredTypeAlign(QualType T) const
Return the "preferred" alignment of the specified type T for the current target, in bits.
Definition: ASTContext.h:2387
clang::ASTContext::getCUIDHash
StringRef getCUIDHash() const
Definition: ASTContext.cpp:13385
SourceLocation.h
clang::ASTContext::getLogicalOperationType
QualType getLogicalOperationType() const
The result type of logical operations, '<', '>', '!=', etc.
Definition: ASTContext.h:1983
createCXXABI
static CGCXXABI * createCXXABI(CodeGenModule &CGM)
Definition: CodeGenModule.cpp:82
clang::ASTContext::getNewOMPTraitInfo
OMPTraitInfo & getNewOMPTraitInfo()
Return a new OMPTraitInfo object owned by this context.
Definition: ASTContext.cpp:13349
clang::ASTContext::adjustFunctionType
const FunctionType * adjustFunctionType(const FunctionType *Fn, FunctionType::ExtInfo EInfo)
Change the ExtInfo on a function type.
Definition: ASTContext.cpp:3131
clang::ASTContext::LongLongTy
CanQualType LongLongTy
Definition: ASTContext.h:1116
clang::Type::isDependentType
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:2298
clang::ASTContext::getRawCommentForAnyRedecl
const RawComment * getRawCommentForAnyRedecl(const Decl *D, const Decl **OriginalDecl=nullptr) const
Return the documentation comment attached to a given declaration.
Definition: ASTContext.cpp:387
clang::TemplateSpecializationKind
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
Definition: Specifiers.h:176
clang::ASTContext::getFixedPointIBits
unsigned char getFixedPointIBits(QualType Ty) const
Definition: ASTContext.cpp:13179
clang::ASTContext::AutoRRefDeductTy
QualType AutoRRefDeductTy
Definition: ASTContext.h:1162
clang::ASTContext::getVectorType
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorType::VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
Definition: ASTContext.cpp:4018
clang::DependentSizedArrayType
Represents an array type in C++ whose size is a value-dependent expression.
Definition: Type.h:3213
clang::ASTContext::addLazyModuleInitializers
void addLazyModuleInitializers(Module *M, ArrayRef< uint32_t > IDs)
Definition: ASTContext.cpp:1184
clang::ASTContext::UnsignedIntTy
CanQualType UnsignedIntTy
Definition: ASTContext.h:1117
clang::attr::Kind
Kind
Definition: AttrKinds.h:22
clang::VariableArrayType
Represents a C array with a specified size that is not an integer-constant-expression.
Definition: Type.h:3159
clang::ASTContext::VoidPtrTy
CanQualType VoidPtrTy
Definition: ASTContext.h:1134
clang::ASTContext::getCXXABIKind
TargetCXXABI::Kind getCXXABIKind() const
Return the C++ ABI kind that should be used.
Definition: ASTContext.cpp:889
clang::ASTContext::ObjCQualifiedIdTypesAreCompatible
bool ObjCQualifiedIdTypesAreCompatible(const ObjCObjectPointerType *LHS, const ObjCObjectPointerType *RHS, bool ForCompare)
ObjCQualifiedIdTypesAreCompatible - We know that one of lhs/rhs is an ObjCQualifiedIDType.
Definition: ASTContext.cpp:9545
clang::ASTContext::getInstantiatedFromStaticDataMember
MemberSpecializationInfo * getInstantiatedFromStaticDataMember(const VarDecl *Var)
If this variable is an instantiated static data member of a class template specialization,...
Definition: ASTContext.cpp:1525
clang::ASTContext::DoubleTy
CanQualType DoubleTy
Definition: ASTContext.h:1119
clang::ASTContext::getSourceManager
const SourceManager & getSourceManager() const
Definition: ASTContext.h:722
clang::ASTContext::getCFConstantStringDecl
TypedefDecl * getCFConstantStringDecl() const
Definition: ASTContext.cpp:7246
clang::ASTContext::isSameTypeConstraint
bool isSameTypeConstraint(const TypeConstraint *XTC, const TypeConstraint *YTC) const
Determine whether two type contraint are similar enough that they could used in declarations of the s...
Definition: ASTContext.cpp:6276
clang::ASTContext::InlineVariableDefinitionKind::Weak
@ Weak
Weak definition of inline variable.
clang::ASTContext::getParentMapContext
ParentMapContext & getParentMapContext()
Returns the dynamic AST node parent map context.
Definition: ASTContext.cpp:922
clang::ASTContext::isObjCIdType
bool isObjCIdType(QualType T) const
Definition: ASTContext.h:2856
clang::ASTContext::setObjCSuperType
void setObjCSuperType(QualType ST)
Definition: ASTContext.h:1819
clang::ASTContext::NullPtrTy
CanQualType NullPtrTy
Definition: ASTContext.h:1134
clang::ASTContext::canBuiltinBeRedeclared
bool canBuiltinBeRedeclared(const FunctionDecl *) const
Return whether a declaration to a builtin is allowed to be overloaded/redeclared.
Definition: ASTContext.cpp:9109
clang::ASTContext::getDeclAlign
CharUnits getDeclAlign(const Decl *D, bool ForAlignof=false) const
Return a conservative estimate of the alignment of the specified decl D.
Definition: ASTContext.cpp:1737
clang::ASTContext::getAttributedType
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType) const
Definition: ASTContext.cpp:4746
clang::ASTContext::overridden_methods
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
Definition: ASTContext.cpp:1650
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
clang::ASTContext::getUnqualifiedArrayType
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals)
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals.
Definition: ASTContext.cpp:5975
clang::ASTContext::IntTy
CanQualType IntTy
Definition: ASTContext.h:1116
clang::ASTContext::overridden_cxx_method_iterator
CXXMethodVector::const_iterator overridden_cxx_method_iterator
Definition: ASTContext.h:1007
clang::ASTContext::addModuleInitializer
void addModuleInitializer(Module *M, Decl *Init)
Add a declaration to the list of declarations that are initialized for a module.
Definition: ASTContext.cpp:1158
clang::ASTContext::GE_Missing_stdio
@ GE_Missing_stdio
Missing a type from <stdio.h>
Definition: ASTContext.h:2218
clang::NullabilityKind::Unspecified
@ Unspecified
Whether values of this type can be null is (explicitly) unspecified.
clang::ASTContext::getEnumType
QualType getEnumType(const EnumDecl *Decl) const
Definition: ASTContext.cpp:4717
clang::ASTContext::getUIntMaxType
CanQualType getUIntMaxType() const
Return the unique type for "uintmax_t" (C99 7.18.1.5), defined in <stdint.h>.
Definition: ASTContext.cpp:5908
clang::ASTContext::PSF_Implicit
@ PSF_Implicit
Definition: ASTContext.h:3332
clang::ASTContext::getOpenCLTypeAddrSpace
LangAS getOpenCLTypeAddrSpace(const Type *T) const
Get address space for OpenCL type.
Definition: ASTContext.cpp:7468
clang::TemplateName
Represents a C++ template name within the type system.
Definition: TemplateName.h:192
clang::ASTContext::isObjCClassType
bool isObjCClassType(QualType T) const
Definition: ASTContext.h:2862
clang::ASTContext::getPreferredTypeAlignInChars
CharUnits getPreferredTypeAlignInChars(QualType T) const
Return the PreferredAlignment of a (complete) type T, in characters.
Definition: ASTContext.h:2358
clang::ASTContext::setBlockVarCopyInit
void setBlockVarCopyInit(const VarDecl *VD, Expr *CopyExpr, bool CanThrow)
Set the copy initialization expression of a block var decl.
Definition: ASTContext.cpp:2965
clang::ASTContext::getTagDeclType
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl.
Definition: ASTContext.cpp:5882
clang::ASTContext::getMakeIntegerSeqDecl
BuiltinTemplateDecl * getMakeIntegerSeqDecl() const
Definition: ASTContext.cpp:1221
clang::FunctionProtoType
Represents a prototype with parameter type info, e.g.
Definition: Type.h:4013
clang::ASTContext::getFieldOffset
uint64_t getFieldOffset(const ValueDecl *FD) const
Get the offset of a FieldDecl or IndirectFieldDecl, in bits.
Definition: RecordLayoutBuilder.cpp:3413
clang::ASTContext::Idents
IdentifierTable & Idents
Definition: ASTContext.h:660
clang::ASTContext::Int128Ty
CanQualType Int128Ty
Definition: ASTContext.h:1116
clang::ASTContext::LongFractTy
CanQualType LongFractTy
Definition: ASTContext.h:1123
clang::ASTContext::isSameTemplateParameter
bool isSameTemplateParameter(const NamedDecl *X, const NamedDecl *Y) const
Determine whether two template parameters are similar enough that they may be used in declarations of...
Definition: ASTContext.cpp:6314
clang::VectorType::VectorKind
VectorKind
Definition: Type.h:3357
clang::ASTContext::getPrintingPolicy
const clang::PrintingPolicy & getPrintingPolicy() const
Definition: ASTContext.h:713
clang::ASTContext::getIntPtrType
QualType getIntPtrType() const
Return a type compatible with "intptr_t" (C99 7.18.1.4), as defined by the target.
Definition: ASTContext.cpp:5926
clang::ASTContext::CUDAConstantEvalContext::NoWrongSidedVars
bool NoWrongSidedVars
Do not allow wrong-sided variables in constant expressions.
Definition: ASTContext.h:673
clang::ASTContext::CUDAConstantEvalCtx
struct clang::ASTContext::CUDAConstantEvalContext CUDAConstantEvalCtx
clang::ASTContext::GE_Missing_type
@ GE_Missing_type
Missing a type.
Definition: ASTContext.h:2215
Begin
SourceLocation Begin
Definition: USRLocFinder.cpp:165
clang::ASTContext::getObjCProtoType
QualType getObjCProtoType() const
Retrieve the type of the Objective-C Protocol class.
Definition: ASTContext.h:2093
clang::BlockExpr
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:5974
llvm::ArrayRef
Definition: LLVM.h:34
clang::ASTContext::overridden_methods_size
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
Definition: ASTContext.cpp:1644
Value
Value
Definition: UninitializedValues.cpp:102
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:83
clang::DeclaratorDecl
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:731
clang::ASTContext::LongTy
CanQualType LongTy
Definition: ASTContext.h:1116
clang::ObjCPropertyDecl
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:732
clang::ASTContext::getArrayInitLoopExprElementCount
uint64_t getArrayInitLoopExprElementCount(const ArrayInitLoopExpr *AILE) const
Return number of elements initialized in an ArrayInitLoopExpr.
Definition: ASTContext.cpp:6977
clang::ASTContext::getSignedWCharType
QualType getSignedWCharType() const
Return the type of "signed wchar_t".
Definition: ASTContext.cpp:5914
clang::ASTContext::createDeviceMangleContext
MangleContext * createDeviceMangleContext(const TargetInfo &T)
Creates a device mangle context to correctly mangle lambdas in a mixed architecture compile by settin...
Definition: ASTContext.cpp:11866
clang::ASTContext::setPrimaryMergedDecl
void setPrimaryMergedDecl(Decl *D, Decl *Primary)
Definition: ASTContext.h:1055
clang::ASTContext::getCanonicalTemplateName
TemplateName getCanonicalTemplateName(const TemplateName &Name) const
Retrieves the "canonical" template name that refers to a given template.
Definition: ASTContext.cpp:6214
clang::ASTContext::mergeFunctionParameterTypes
QualType mergeFunctionParameterTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
mergeFunctionParameterTypes - merge two types which appear as function parameter types
Definition: ASTContext.cpp:10150
clang::ASTContext::GE_None
@ GE_None
No error.
Definition: ASTContext.h:2212
LLVM.h
clang::ASTContext::getDiagAllocator
PartialDiagnostic::DiagStorageAllocator & getDiagAllocator()
Definition: ASTContext.h:769
clang::ASTContext::CharTy
CanQualType CharTy
Definition: ASTContext.h:1109
clang::ASTContext::HalfTy
CanQualType HalfTy
Definition: ASTContext.h:1131
clang::ASTContext::attachCommentsToJustParsedDecls
void attachCommentsToJustParsedDecls(ArrayRef< Decl * > Decls, const Preprocessor *PP)
Searches existing comments for doc comments that should be attached to Decls.
Definition: ASTContext.cpp:484
clang::ASTContext::SectionInfo::SectionInfo
SectionInfo()=default
clang::ASTContext::MakeIntValue
llvm::APSInt MakeIntValue(uint64_t Value, QualType Type) const
Make an APSInt of the appropriate width and signedness for the given Value and integer Type.
Definition: ASTContext.h:2976
clang::ASTContext::getTypeAlign
unsigned getTypeAlign(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in bits.
Definition: ASTContext.h:2330
clang::ASTContext::SectionInfo::Decl
NamedDecl * Decl
Definition: ASTContext.h:3338
clang::ASTContext::getInlineVariableDefinitionKind
InlineVariableDefinitionKind getInlineVariableDefinitionKind(const VarDecl *VD) const
Determine whether a definition of this inline variable should be treated as a weak or strong definiti...
Definition: ASTContext.cpp:7597
clang::ASTContext::Char32Ty
CanQualType Char32Ty
Definition: ASTContext.h:1115
clang::ASTContext::CUDAConstantEvalContextRAII::SavedCtx
CUDAConstantEvalContext SavedCtx
Definition: ASTContext.h:677
clang::ASTContext::setPrintingPolicy
void setPrintingPolicy(const clang::PrintingPolicy &Policy)
Definition: ASTContext.h:717
clang::ASTContext::TemplateOrSpecializationInfo
llvm::PointerUnion< VarTemplateDecl *, MemberSpecializationInfo * > TemplateOrSpecializationInfo
A type synonym for the TemplateOrInstantiation mapping.
Definition: ASTContext.h:489
clang::ASTContext::getMakeIntegerSeqName
IdentifierInfo * getMakeIntegerSeqName() const
Definition: ASTContext.h:1914
clang::ASTContext::getObjCSelType
QualType getObjCSelType() const
Retrieve the type that corresponds to the predefined Objective-C 'SEL' type.
Definition: ASTContext.h:2057
clang::ASTContext::getTypedefNameForUnnamedTagDecl
TypedefNameDecl * getTypedefNameForUnnamedTagDecl(const TagDecl *TD)
Definition: ASTContext.cpp:12026
clang::ASTContext::forEachMultiversionedFunctionVersion
void forEachMultiversionedFunctionVersion(const FunctionDecl *FD, llvm::function_ref< void(FunctionDecl *)> Pred) const
Visits all versions of a multiversioned function with the passed predicate.
Definition: ASTContext.cpp:11767
clang::ASTContext::getucontext_tType
QualType getucontext_tType() const
Retrieve the C ucontext_t type.
Definition: ASTContext.h:1976
clang::FunctionType::ExtInfo
A class which abstracts out some details necessary for making a call.
Definition: Type.h:3783
clang::SplitQualType
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
Definition: Type.h:670
clang::UnaryTransformType::UTTKind
UTTKind
Definition: Type.h:4732
clang::ASTContext::getInjectedTemplateArgs
void getInjectedTemplateArgs(const TemplateParameterList *Params, SmallVectorImpl< TemplateArgument > &Args)
Get a template argument list with one argument per template parameter in a template parameter list,...
Definition: ASTContext.cpp:5215
clang::ASTContext::setInstantiatedFromUsingEnumDecl
void setInstantiatedFromUsingEnumDecl(UsingEnumDecl *Inst, UsingEnumDecl *Pattern)
Remember that the using enum decl Inst is an instantiation of the using enum decl Pattern of a class ...
Definition: ASTContext.cpp:1591
clang::ASTContext::SatUnsignedShortFractTy
CanQualType SatUnsignedShortFractTy
Definition: ASTContext.h:1129
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:85
clang::LazyGenerationalUpdatePtr::ValueType
llvm::PointerUnion< T, LazyData * > ValueType
Definition: ExternalASTSource.h:401
clang::ASTContext::ObjCBuiltinIdTy
CanQualType ObjCBuiltinIdTy
Definition: ASTContext.h:1138
clang::TypedefDecl
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Definition: Decl.h:3350
clang::ASTContext::SatUnsignedShortAccumTy
CanQualType SatUnsignedShortAccumTy
Definition: ASTContext.h:1126
clang::ASTContext::getTargetInfo
const TargetInfo & getTargetInfo() const
Definition: ASTContext.h:773
clang::ASTContext::getInjectedClassNameType
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
Definition: ASTContext.cpp:4596
clang::ASTContext::CUDAExternalDeviceDeclODRUsedByHost
llvm::DenseSet< const ValueDecl * > CUDAExternalDeviceDeclODRUsedByHost
Keep track of CUDA/HIP external kernels or device variables ODR-used by host code.
Definition: ASTContext.h:1176
clang::ASTContext::getTypeOfType
QualType getTypeOfType(QualType QT, TypeOfKind Kind) const
getTypeOfType - Unlike many "get<Type>" functions, we don't unique TypeOfType nodes.
Definition: ASTContext.cpp:5649
clang::ASTContext::getNextLocalImport
static ImportDecl * getNextLocalImport(ImportDecl *Import)
Definition: ASTContext.h:1041
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::ASTContext::getObjCEncodingForPropertyType
void getObjCEncodingForPropertyType(QualType T, std::string &S) const
Emit the Objective-C property type encoding for the given type T into S.
Definition: ASTContext.cpp:7932
clang::ASTContext::getElaboratedType
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
Definition: ASTContext.cpp:5021
clang::ASTContext::getLegacyIntegralTypeEncoding
void getLegacyIntegralTypeEncoding(QualType &t) const
getLegacyIntegralTypeEncoding - Another legacy compatibility encoding: 32-bit longs are encoded as 'l...
Definition: ASTContext.cpp:7905
clang::ASTContext::getCorrespondingSignedType
QualType getCorrespondingSignedType(QualType T) const
Definition: ASTContext.cpp:10945
clang::ASTContext::Listener
ASTMutationListener * Listener
Definition: ASTContext.h:666
clang::ASTContext::getLValueReferenceType
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type.
Definition: ASTContext.cpp:3410
clang::ObjCPropertyAttribute::Kind
Kind
Definition: DeclObjCCommon.h:22
clang::ObjCTypeParamDecl
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:582
int64_t
long int64_t
Definition: hlsl_basic_types.h:25
clang::ASTContext::hasSameFunctionTypeIgnoringExceptionSpec
bool hasSameFunctionTypeIgnoringExceptionSpec(QualType T, QualType U) const
Determine whether two function types are the same, ignoring exception specifications in cases where t...
Definition: ASTContext.cpp:3197
clang::ASTContext::isObjCNSObjectType
static bool isObjCNSObjectType(QualType Ty)
Return true if this is an NSObject object with its NSObject attribute set.
Definition: ASTContext.h:2279
clang::ASTReader
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:341
clang::MangleNumberingContext
Keeps track of the mangled names of lambda expressions and block literals within a particular context...
Definition: MangleNumberingContext.h:29
clang::ASTContext::adjustObjCTypeParamBoundType
void adjustObjCTypeParamBoundType(const ObjCTypeParamDecl *Orig, ObjCTypeParamDecl *New) const
Definition: ASTContext.cpp:5478
clang::ASTContext::mergeDefinitionIntoModule
void mergeDefinitionIntoModule(NamedDecl *ND, Module *M, bool NotifyListeners=true)
Note that the definition ND has been merged into module M, and should be visible whenever M is visibl...
Definition: ASTContext.cpp:1110
clang::AlignRequirementKind::RequiredByRecord
@ RequiredByRecord
The alignment comes from an alignment attribute on a record type.
ComparisonCategories.h
clang::ASTContext::setInstantiatedFromUsingDecl
void setInstantiatedFromUsingDecl(NamedDecl *Inst, NamedDecl *Pattern)
Remember that the using decl Inst is an instantiation of the using decl Pattern of a class template.
Definition: ASTContext.cpp:1569
clang::ASTContext::getModulesWithMergedDefinition
ArrayRef< Module * > getModulesWithMergedDefinition(const NamedDecl *Def)
Get the additional modules in which the definition Def has been merged.
Definition: ASTContext.cpp:1133
clang::ASTContext::setjmp_bufDecl
void setjmp_bufDecl(TypeDecl *jmp_bufDecl)
Set the type for the C jmp_buf type.
Definition: ASTContext.h:1947
clang::AlignRequirementKind::None
@ None
The alignment was not explicit in code.
clang::TranslationUnitKind
TranslationUnitKind
Describes the kind of translation unit being processed.
Definition: LangOptions.h:902
clang::ObjCMethodDecl
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:139
DeclarationName.h
clang::ASTContext::shouldExternalize
bool shouldExternalize(const Decl *D) const
Whether a C++ static variable or CUDA/HIP kernel should be externalized.
Definition: ASTContext.cpp:13379
clang::ASTContext::buildImplicitTypedef
TypedefDecl * buildImplicitTypedef(QualType T, StringRef Name) const
Create a new implicit TU-level typedef declaration.
Definition: ASTContext.cpp:1252
clang::ASTContext::areComparableObjCPointerTypes
bool areComparableObjCPointerTypes(QualType LHS, QualType RHS)
Definition: ASTContext.cpp:10089
clang::ASTContext::AutoDeductTy
QualType AutoDeductTy
Definition: ASTContext.h:1161
clang::ASTContext::PragmaSectionFlag
PragmaSectionFlag
Definition: ASTContext.h:3327
clang::ASTContext::getComplexType
CanQualType getComplexType(CanQualType T) const
Definition: ASTContext.h:1344
clang::ASTContext::SectionInfos
llvm::StringMap< SectionInfo > SectionInfos
Definition: ASTContext.h:3349
clang::ASTContext::getTypeUnadjustedAlign
unsigned getTypeUnadjustedAlign(QualType T) const
Return the ABI-specified natural alignment of a (complete) type T, before alignment adjustments,...
Definition: ASTContext.h:2338
clang::ASTContext::getBuiltinVaListType
QualType getBuiltinVaListType() const
Retrieve the type of the __builtin_va_list type.
Definition: ASTContext.h:2102
clang::Qualifiers::OCL_None
@ OCL_None
There is no lifetime qualification on this type.
Definition: Type.h:164
clang::ASTContext::OMPArrayShapingTy
CanQualType OMPArrayShapingTy
Definition: ASTContext.h:1146
clang::ASTContext::setInstantiatedFromUnnamedFieldDecl
void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl)
Definition: ASTContext.cpp:1623
clang::ASTContext::getjmp_bufType
QualType getjmp_bufType() const
Retrieve the C jmp_buf type.
Definition: ASTContext.h:1952
clang::ASTContext::getModuleForCodeGen
Module * getModuleForCodeGen() const
Get module under construction, nullptr if this is not a C++20 module.
Definition: ASTContext.h:1087
clang::ASTContext::getParenType
QualType getParenType(QualType NamedType) const
Definition: ASTContext.cpp:5051
clang::ASTContext::cleanup
void cleanup()
Definition: ASTContext.cpp:994
clang::ASTContext::mayExternalize
bool mayExternalize(const Decl *D) const
Whether a C++ static variable or CUDA/HIP kernel may be externalized.
Definition: ASTContext.cpp:13362
clang::OpenCLTypeKind
OpenCLTypeKind
OpenCL type kinds.
Definition: TargetInfo.h:192
clang::ASTContext::getPredefinedStringLiteralFromCache
StringLiteral * getPredefinedStringLiteralFromCache(StringRef Key) const
Return a string representing the human readable name for the specified function declaration or file n...
Definition: ASTContext.cpp:12065
clang::ASTContext::getAddrSpaceQualType
QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
Definition: ASTContext.cpp:3039
clang::Builtin::ID
ID
Definition: Builtins.h:52
clang::FunctionProtoType::ExtProtoInfo
Extra information about a function prototype.
Definition: Type.h:4096
clang::DeclListNode
A list storing NamedDecls in the lookup tables.
Definition: DeclBase.h:1281
clang::ASTContext::BuiltinVectorTypeInfo
Definition: ASTContext.h:1487
clang::ASTContext::addedLocalImportDecl
void addedLocalImportDecl(ImportDecl *Import)
Notify the AST context that a new import declaration has been parsed or implicitly created within thi...
Definition: ASTContext.cpp:1684
PartialDiagnostic.h
clang
Definition: CalledOnceCheck.h:17
XRayLists.h
clang::TypeInfo::Align
unsigned Align
Definition: ASTContext.h:181
clang::ASTContext::ObjCMethodsAreEqual
bool ObjCMethodsAreEqual(const ObjCMethodDecl *MethodDecl, const ObjCMethodDecl *MethodImp)
Definition: ASTContext.cpp:12149
clang::ASTContext::getTemplateOrSpecializationInfo
TemplateOrSpecializationInfo getTemplateOrSpecializationInfo(const VarDecl *Var)
Definition: ASTContext.cpp:1532
clang::Selector
Smart pointer class that efficiently represents Objective-C method names.
Definition: IdentifierTable.h:759
clang::ASTContext::toCharUnitsFromBits
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
Definition: ASTContext.cpp:2461
clang::ASTContext::getLangASForBuiltinAddressSpace
LangAS getLangASForBuiltinAddressSpace(unsigned AS) const
Definition: ASTContext.cpp:13114
clang::ASTContext::SatUnsignedFractTy
CanQualType SatUnsignedFractTy
Definition: ASTContext.h:1129
clang::Builtin::Context
Holds information about both target-independent and target-specific builtins, allowing easy queries b...
Definition: Builtins.h:71
clang::TypeInfoChars
Definition: ASTContext.h:193
clang::ASTContext::getObjCClassRedefinitionType
QualType getObjCClassRedefinitionType() const
Retrieve the type that Class has been defined to, which may be different from the built-in Class if C...
Definition: ASTContext.h:1861
clang::GetNullarySelector
Selector GetNullarySelector(StringRef name, ASTContext &Ctx)
Utility function for constructing a nullary selector.
Definition: ASTContext.h:3373
clang::ObjCIvarDecl
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1923
clang::ASTContext::getByrefLifetime
bool getByrefLifetime(QualType Ty, Qualifiers::ObjCLifetime &Lifetime, bool &HasByrefExtendedLayout) const
Returns true, if given type has a known lifetime.
Definition: ASTContext.cpp:7515
clang::QualType::withConst
QualType withConst() const
Definition: Type.h:914
clang::ASTContext::getDependentSizedMatrixType
QualType getDependentSizedMatrixType(QualType ElementType, Expr *RowExpr, Expr *ColumnExpr, SourceLocation AttrLoc) const
Return the unique reference to the matrix type of the specified element type and size.
Definition: ASTContext.cpp:4199
clang::ASTContext::ObjCBuiltinClassTy
CanQualType ObjCBuiltinClassTy
Definition: ASTContext.h:1138
clang::ASTContext::isSentinelNullExpr
bool isSentinelNullExpr(const Expr *E)
Definition: ASTContext.cpp:2877
clang::ASTContext::getTypeUnadjustedAlignInChars
CharUnits getTypeUnadjustedAlignInChars(QualType T) const
getTypeUnadjustedAlignInChars - Return the ABI-specified alignment of a type, in characters,...
Definition: ASTContext.cpp:2491
clang::ASTContext::SignedCharTy
CanQualType SignedCharTy
Definition: ASTContext.h:1116
clang::ASTContext::getAdjustedType
CanQualType getAdjustedType(CanQualType Orig, CanQualType New) const
Definition: ASTContext.h:1358
clang::ASTContext::CUDAConstantEvalContextRAII::~