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