Clang Project

clang_source_code/include/clang/AST/ASTContext.h
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/ASTContextAllocate.h"
18#include "clang/AST/ASTTypeTraits.h"
19#include "clang/AST/CanonicalType.h"
20#include "clang/AST/CommentCommandTraits.h"
21#include "clang/AST/ComparisonCategories.h"
22#include "clang/AST/Decl.h"
23#include "clang/AST/DeclBase.h"
24#include "clang/AST/DeclarationName.h"
25#include "clang/AST/Expr.h"
26#include "clang/AST/ExternalASTSource.h"
27#include "clang/AST/NestedNameSpecifier.h"
28#include "clang/AST/PrettyPrinter.h"
29#include "clang/AST/RawCommentList.h"
30#include "clang/AST/TemplateBase.h"
31#include "clang/AST/TemplateName.h"
32#include "clang/AST/Type.h"
33#include "clang/Basic/AddressSpaces.h"
34#include "clang/Basic/AttrKinds.h"
35#include "clang/Basic/IdentifierTable.h"
36#include "clang/Basic/LLVM.h"
37#include "clang/Basic/LangOptions.h"
38#include "clang/Basic/Linkage.h"
39#include "clang/Basic/OperatorKinds.h"
40#include "clang/Basic/PartialDiagnostic.h"
41#include "clang/Basic/SanitizerBlacklist.h"
42#include "clang/Basic/SourceLocation.h"
43#include "clang/Basic/Specifiers.h"
44#include "clang/Basic/TargetInfo.h"
45#include "clang/Basic/XRayLists.h"
46#include "llvm/ADT/APSInt.h"
47#include "llvm/ADT/ArrayRef.h"
48#include "llvm/ADT/DenseMap.h"
49#include "llvm/ADT/FoldingSet.h"
50#include "llvm/ADT/IntrusiveRefCntPtr.h"
51#include "llvm/ADT/MapVector.h"
52#include "llvm/ADT/None.h"
53#include "llvm/ADT/Optional.h"
54#include "llvm/ADT/PointerIntPair.h"
55#include "llvm/ADT/PointerUnion.h"
56#include "llvm/ADT/SmallVector.h"
57#include "llvm/ADT/StringMap.h"
58#include "llvm/ADT/StringRef.h"
59#include "llvm/ADT/TinyPtrVector.h"
60#include "llvm/ADT/Triple.h"
61#include "llvm/ADT/iterator_range.h"
62#include "llvm/Support/AlignOf.h"
63#include "llvm/Support/Allocator.h"
64#include "llvm/Support/Casting.h"
65#include "llvm/Support/Compiler.h"
66#include <cassert>
67#include <cstddef>
68#include <cstdint>
69#include <iterator>
70#include <memory>
71#include <string>
72#include <type_traits>
73#include <utility>
74#include <vector>
75
76namespace llvm {
77
78struct fltSemantics;
79
80// namespace llvm
81
82namespace clang {
83
84class APFixedPoint;
85class APValue;
86class ASTMutationListener;
87class ASTRecordLayout;
88class AtomicExpr;
89class BlockExpr;
90class BuiltinTemplateDecl;
91class CharUnits;
92class CXXABI;
93class CXXConstructorDecl;
94class CXXMethodDecl;
95class CXXRecordDecl;
96class DiagnosticsEngine;
97class Expr;
98class FixedPointSemantics;
99class MangleContext;
100class MangleNumberingContext;
101class MaterializeTemporaryExpr;
102class MemberSpecializationInfo;
103class Module;
104class ObjCCategoryDecl;
105class ObjCCategoryImplDecl;
106class ObjCContainerDecl;
107class ObjCImplDecl;
108class ObjCImplementationDecl;
109class ObjCInterfaceDecl;
110class ObjCIvarDecl;
111class ObjCMethodDecl;
112class ObjCPropertyDecl;
113class ObjCPropertyImplDecl;
114class ObjCProtocolDecl;
115class ObjCTypeParamDecl;
116class Preprocessor;
117class Stmt;
118class StoredDeclsMap;
119class TemplateDecl;
120class TemplateParameterList;
121class TemplateTemplateParmDecl;
122class TemplateTypeParmDecl;
123class UnresolvedSetIterator;
124class UsingShadowDecl;
125class VarTemplateDecl;
126class VTableContextBase;
127
128namespace Builtin {
129
130class Context;
131
132// namespace Builtin
133
134enum BuiltinTemplateKind : int;
135
136namespace comments {
137
138class FullComment;
139
140// namespace comments
141
142struct TypeInfo {
143  uint64_t Width = 0;
144  unsigned Align = 0;
145  bool AlignIsRequired : 1;
146
147  TypeInfo() : AlignIsRequired(false) {}
148  TypeInfo(uint64_t Widthunsigned Alignbool AlignIsRequired)
149      : Width(Width), Align(Align), AlignIsRequired(AlignIsRequired) {}
150};
151
152/// Holds long-lived AST nodes (such as types and decls) that can be
153/// referred to throughout the semantic analysis of a file.
154class ASTContext : public RefCountedBase<ASTContext> {
155public:
156  /// Copy initialization expr of a __block variable and a boolean flag that
157  /// indicates whether the expression can throw.
158  struct BlockVarCopyInit {
159    BlockVarCopyInit() = default;
160    BlockVarCopyInit(Expr *CopyExprbool CanThrow)
161        : ExprAndFlag(CopyExpr, CanThrow) {}
162    void setExprAndFlag(Expr *CopyExprbool CanThrow) {
163      ExprAndFlag.setPointerAndInt(CopyExpr, CanThrow);
164    }
165    Expr *getCopyExpr() const { return ExprAndFlag.getPointer(); }
166    bool canThrow() const { return ExprAndFlag.getInt(); }
167    llvm::PointerIntPair<Expr *, 1boolExprAndFlag;
168  };
169
170private:
171  friend class NestedNameSpecifier;
172
173  mutable SmallVector<Type *, 0Types;
174  mutable llvm::FoldingSet<ExtQuals> ExtQualNodes;
175  mutable llvm::FoldingSet<ComplexType> ComplexTypes;
176  mutable llvm::FoldingSet<PointerType> PointerTypes;
177  mutable llvm::FoldingSet<AdjustedType> AdjustedTypes;
178  mutable llvm::FoldingSet<BlockPointerType> BlockPointerTypes;
179  mutable llvm::FoldingSet<LValueReferenceType> LValueReferenceTypes;
180  mutable llvm::FoldingSet<RValueReferenceType> RValueReferenceTypes;
181  mutable llvm::FoldingSet<MemberPointerType> MemberPointerTypes;
182  mutable llvm::FoldingSet<ConstantArrayType> ConstantArrayTypes;
183  mutable llvm::FoldingSet<IncompleteArrayType> IncompleteArrayTypes;
184  mutable std::vector<VariableArrayType*> VariableArrayTypes;
185  mutable llvm::FoldingSet<DependentSizedArrayType> DependentSizedArrayTypes;
186  mutable llvm::FoldingSet<DependentSizedExtVectorType>
187    DependentSizedExtVectorTypes;
188  mutable llvm::FoldingSet<DependentAddressSpaceType>
189      DependentAddressSpaceTypes;
190  mutable llvm::FoldingSet<VectorType> VectorTypes;
191  mutable llvm::FoldingSet<DependentVectorType> DependentVectorTypes;
192  mutable llvm::FoldingSet<FunctionNoProtoType> FunctionNoProtoTypes;
193  mutable llvm::ContextualFoldingSet<FunctionProtoType, ASTContext&>
194    FunctionProtoTypes;
195  mutable llvm::FoldingSet<DependentTypeOfExprType> DependentTypeOfExprTypes;
196  mutable llvm::FoldingSet<DependentDecltypeType> DependentDecltypeTypes;
197  mutable llvm::FoldingSet<TemplateTypeParmType> TemplateTypeParmTypes;
198  mutable llvm::FoldingSet<ObjCTypeParamType> ObjCTypeParamTypes;
199  mutable llvm::FoldingSet<SubstTemplateTypeParmType>
200    SubstTemplateTypeParmTypes;
201  mutable llvm::FoldingSet<SubstTemplateTypeParmPackType>
202    SubstTemplateTypeParmPackTypes;
203  mutable llvm::ContextualFoldingSet<TemplateSpecializationType, ASTContext&>
204    TemplateSpecializationTypes;
205  mutable llvm::FoldingSet<ParenType> ParenTypes;
206  mutable llvm::FoldingSet<ElaboratedType> ElaboratedTypes;
207  mutable llvm::FoldingSet<DependentNameType> DependentNameTypes;
208  mutable llvm::ContextualFoldingSet<DependentTemplateSpecializationType,
209                                     ASTContext&>
210    DependentTemplateSpecializationTypes;
211  llvm::FoldingSet<PackExpansionType> PackExpansionTypes;
212  mutable llvm::FoldingSet<ObjCObjectTypeImpl> ObjCObjectTypes;
213  mutable llvm::FoldingSet<ObjCObjectPointerType> ObjCObjectPointerTypes;
214  mutable llvm::FoldingSet<DependentUnaryTransformType>
215    DependentUnaryTransformTypes;
216  mutable llvm::FoldingSet<AutoType> AutoTypes;
217  mutable llvm::FoldingSet<DeducedTemplateSpecializationType>
218    DeducedTemplateSpecializationTypes;
219  mutable llvm::FoldingSet<AtomicType> AtomicTypes;
220  llvm::FoldingSet<AttributedType> AttributedTypes;
221  mutable llvm::FoldingSet<PipeType> PipeTypes;
222
223  mutable llvm::FoldingSet<QualifiedTemplateName> QualifiedTemplateNames;
224  mutable llvm::FoldingSet<DependentTemplateName> DependentTemplateNames;
225  mutable llvm::FoldingSet<SubstTemplateTemplateParmStorage>
226    SubstTemplateTemplateParms;
227  mutable llvm::ContextualFoldingSet<SubstTemplateTemplateParmPackStorage,
228                                     ASTContext&>
229    SubstTemplateTemplateParmPacks;
230
231  /// The set of nested name specifiers.
232  ///
233  /// This set is managed by the NestedNameSpecifier class.
234  mutable llvm::FoldingSet<NestedNameSpecifier> NestedNameSpecifiers;
235  mutable NestedNameSpecifier *GlobalNestedNameSpecifier = nullptr;
236
237  /// A cache mapping from RecordDecls to ASTRecordLayouts.
238  ///
239  /// This is lazily created.  This is intentionally not serialized.
240  mutable llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>
241    ASTRecordLayouts;
242  mutable llvm::DenseMap<const ObjCContainerDecl*, const ASTRecordLayout*>
243    ObjCLayouts;
244
245  /// A cache from types to size and alignment information.
246  using TypeInfoMap = llvm::DenseMap<const Type *, struct TypeInfo>;
247  mutable TypeInfoMap MemoizedTypeInfo;
248
249  /// A cache from types to unadjusted alignment information. Only ARM and
250  /// AArch64 targets need this information, keeping it separate prevents
251  /// imposing overhead on TypeInfo size.
252  using UnadjustedAlignMap = llvm::DenseMap<const Type *, unsigned>;
253  mutable UnadjustedAlignMap MemoizedUnadjustedAlign;
254
255  /// A cache mapping from CXXRecordDecls to key functions.
256  llvm::DenseMap<const CXXRecordDecl*, LazyDeclPtr> KeyFunctions;
257
258  /// Mapping from ObjCContainers to their ObjCImplementations.
259  llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*> ObjCImpls;
260
261  /// Mapping from ObjCMethod to its duplicate declaration in the same
262  /// interface.
263  llvm::DenseMap<const ObjCMethodDecl*,const ObjCMethodDecl*> ObjCMethodRedecls;
264
265  /// Mapping from __block VarDecls to BlockVarCopyInit.
266  llvm::DenseMap<const VarDecl *, BlockVarCopyInit> BlockVarCopyInits;
267
268  /// Mapping from class scope functions specialization to their
269  /// template patterns.
270  llvm::DenseMap<const FunctionDecl*, FunctionDecl*>
271    ClassScopeSpecializationPattern;
272
273  /// Mapping from materialized temporaries with static storage duration
274  /// that appear in constant initializers to their evaluated values.  These are
275  /// allocated in a std::map because their address must be stable.
276  llvm::DenseMap<const MaterializeTemporaryExpr *, APValue *>
277    MaterializedTemporaryValues;
278
279  /// Representation of a "canonical" template template parameter that
280  /// is used in canonical template names.
281  class CanonicalTemplateTemplateParm : public llvm::FoldingSetNode {
282    TemplateTemplateParmDecl *Parm;
283
284  public:
285    CanonicalTemplateTemplateParm(TemplateTemplateParmDecl *Parm)
286        : Parm(Parm) {}
287
288    TemplateTemplateParmDecl *getParam() const { return Parm; }
289
290    void Profile(llvm::FoldingSetNodeID &ID) { Profile(IDParm); }
291
292    static void Profile(llvm::FoldingSetNodeID &ID,
293                        TemplateTemplateParmDecl *Parm);
294  };
295  mutable llvm::FoldingSet<CanonicalTemplateTemplateParm>
296    CanonTemplateTemplateParms;
297
298  TemplateTemplateParmDecl *
299    getCanonicalTemplateTemplateParmDecl(TemplateTemplateParmDecl *TTPconst;
300
301  /// The typedef for the __int128_t type.
302  mutable TypedefDecl *Int128Decl = nullptr;
303
304  /// The typedef for the __uint128_t type.
305  mutable TypedefDecl *UInt128Decl = nullptr;
306
307  /// The typedef for the target specific predefined
308  /// __builtin_va_list type.
309  mutable TypedefDecl *BuiltinVaListDecl = nullptr;
310
311  /// The typedef for the predefined \c __builtin_ms_va_list type.
312  mutable TypedefDecl *BuiltinMSVaListDecl = nullptr;
313
314  /// The typedef for the predefined \c id type.
315  mutable TypedefDecl *ObjCIdDecl = nullptr;
316
317  /// The typedef for the predefined \c SEL type.
318  mutable TypedefDecl *ObjCSelDecl = nullptr;
319
320  /// The typedef for the predefined \c Class type.
321  mutable TypedefDecl *ObjCClassDecl = nullptr;
322
323  /// The typedef for the predefined \c Protocol class in Objective-C.
324  mutable ObjCInterfaceDecl *ObjCProtocolClassDecl = nullptr;
325
326  /// The typedef for the predefined 'BOOL' type.
327  mutable TypedefDecl *BOOLDecl = nullptr;
328
329  // Typedefs which may be provided defining the structure of Objective-C
330  // pseudo-builtins
331  QualType ObjCIdRedefinitionType;
332  QualType ObjCClassRedefinitionType;
333  QualType ObjCSelRedefinitionType;
334
335  /// The identifier 'bool'.
336  mutable IdentifierInfo *BoolName = nullptr;
337
338  /// The identifier 'NSObject'.
339  mutable IdentifierInfo *NSObjectName = nullptr;
340
341  /// The identifier 'NSCopying'.
342  IdentifierInfo *NSCopyingName = nullptr;
343
344  /// The identifier '__make_integer_seq'.
345  mutable IdentifierInfo *MakeIntegerSeqName = nullptr;
346
347  /// The identifier '__type_pack_element'.
348  mutable IdentifierInfo *TypePackElementName = nullptr;
349
350  QualType ObjCConstantStringType;
351  mutable RecordDecl *CFConstantStringTagDecl = nullptr;
352  mutable TypedefDecl *CFConstantStringTypeDecl = nullptr;
353
354  mutable QualType ObjCSuperType;
355
356  QualType ObjCNSStringType;
357
358  /// The typedef declaration for the Objective-C "instancetype" type.
359  TypedefDecl *ObjCInstanceTypeDecl = nullptr;
360
361  /// The type for the C FILE type.
362  TypeDecl *FILEDecl = nullptr;
363
364  /// The type for the C jmp_buf type.
365  TypeDecl *jmp_bufDecl = nullptr;
366
367  /// The type for the C sigjmp_buf type.
368  TypeDecl *sigjmp_bufDecl = nullptr;
369
370  /// The type for the C ucontext_t type.
371  TypeDecl *ucontext_tDecl = nullptr;
372
373  /// Type for the Block descriptor for Blocks CodeGen.
374  ///
375  /// Since this is only used for generation of debug info, it is not
376  /// serialized.
377  mutable RecordDecl *BlockDescriptorType = nullptr;
378
379  /// Type for the Block descriptor for Blocks CodeGen.
380  ///
381  /// Since this is only used for generation of debug info, it is not
382  /// serialized.
383  mutable RecordDecl *BlockDescriptorExtendedType = nullptr;
384
385  /// Declaration for the CUDA cudaConfigureCall function.
386  FunctionDecl *cudaConfigureCallDecl = nullptr;
387
388  /// Keeps track of all declaration attributes.
389  ///
390  /// Since so few decls have attrs, we keep them in a hash map instead of
391  /// wasting space in the Decl class.
392  llvm::DenseMap<const Decl*, AttrVec*> DeclAttrs;
393
394  /// A mapping from non-redeclarable declarations in modules that were
395  /// merged with other declarations to the canonical declaration that they were
396  /// merged into.
397  llvm::DenseMap<Decl*, Decl*> MergedDecls;
398
399  /// A mapping from a defining declaration to a list of modules (other
400  /// than the owning module of the declaration) that contain merged
401  /// definitions of that entity.
402  llvm::DenseMap<NamedDecl*, llvm::TinyPtrVector<Module*>> MergedDefModules;
403
404  /// Initializers for a module, in order. Each Decl will be either
405  /// something that has a semantic effect on startup (such as a variable with
406  /// a non-constant initializer), or an ImportDecl (which recursively triggers
407  /// initialization of another module).
408  struct PerModuleInitializers {
409    llvm::SmallVector<Decl*, 4Initializers;
410    llvm::SmallVector<uint32_t4LazyInitializers;
411
412    void resolve(ASTContext &Ctx);
413  };
414  llvm::DenseMap<Module*, PerModuleInitializers*> ModuleInitializers;
415
416  ASTContext &this_() { return *this; }
417
418public:
419  /// A type synonym for the TemplateOrInstantiation mapping.
420  using TemplateOrSpecializationInfo =
421      llvm::PointerUnion<VarTemplateDecl *, MemberSpecializationInfo *>;
422
423private:
424  friend class ASTDeclReader;
425  friend class ASTReader;
426  friend class ASTWriter;
427  friend class CXXRecordDecl;
428
429  /// A mapping to contain the template or declaration that
430  /// a variable declaration describes or was instantiated from,
431  /// respectively.
432  ///
433  /// For non-templates, this value will be NULL. For variable
434  /// declarations that describe a variable template, this will be a
435  /// pointer to a VarTemplateDecl. For static data members
436  /// of class template specializations, this will be the
437  /// MemberSpecializationInfo referring to the member variable that was
438  /// instantiated or specialized. Thus, the mapping will keep track of
439  /// the static data member templates from which static data members of
440  /// class template specializations were instantiated.
441  ///
442  /// Given the following example:
443  ///
444  /// \code
445  /// template<typename T>
446  /// struct X {
447  ///   static T value;
448  /// };
449  ///
450  /// template<typename T>
451  ///   T X<T>::value = T(17);
452  ///
453  /// int *x = &X<int>::value;
454  /// \endcode
455  ///
456  /// This mapping will contain an entry that maps from the VarDecl for
457  /// X<int>::value to the corresponding VarDecl for X<T>::value (within the
458  /// class template X) and will be marked TSK_ImplicitInstantiation.
459  llvm::DenseMap<const VarDecl *, TemplateOrSpecializationInfo>
460  TemplateOrInstantiation;
461
462  /// Keeps track of the declaration from which a using declaration was
463  /// created during instantiation.
464  ///
465  /// The source and target declarations are always a UsingDecl, an
466  /// UnresolvedUsingValueDecl, or an UnresolvedUsingTypenameDecl.
467  ///
468  /// For example:
469  /// \code
470  /// template<typename T>
471  /// struct A {
472  ///   void f();
473  /// };
474  ///
475  /// template<typename T>
476  /// struct B : A<T> {
477  ///   using A<T>::f;
478  /// };
479  ///
480  /// template struct B<int>;
481  /// \endcode
482  ///
483  /// This mapping will contain an entry that maps from the UsingDecl in
484  /// B<int> to the UnresolvedUsingDecl in B<T>.
485  llvm::DenseMap<NamedDecl *, NamedDecl *> InstantiatedFromUsingDecl;
486
487  llvm::DenseMap<UsingShadowDecl*, UsingShadowDecl*>
488    InstantiatedFromUsingShadowDecl;
489
490  llvm::DenseMap<FieldDecl *, FieldDecl *> InstantiatedFromUnnamedFieldDecl;
491
492  /// Mapping that stores the methods overridden by a given C++
493  /// member function.
494  ///
495  /// Since most C++ member functions aren't virtual and therefore
496  /// don't override anything, we store the overridden functions in
497  /// this map on the side rather than within the CXXMethodDecl structure.
498  using CXXMethodVector = llvm::TinyPtrVector<const CXXMethodDecl *>;
499  llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector> OverriddenMethods;
500
501  /// Mapping from each declaration context to its corresponding
502  /// mangling numbering context (used for constructs like lambdas which
503  /// need to be consistently numbered for the mangler).
504  llvm::DenseMap<const DeclContext *, std::unique_ptr<MangleNumberingContext>>
505      MangleNumberingContexts;
506
507  /// Side-table of mangling numbers for declarations which rarely
508  /// need them (like static local vars).
509  llvm::MapVector<const NamedDecl *, unsignedMangleNumbers;
510  llvm::MapVector<const VarDecl *, unsignedStaticLocalNumbers;
511
512  /// Mapping that stores parameterIndex values for ParmVarDecls when
513  /// that value exceeds the bitfield size of ParmVarDeclBits.ParameterIndex.
514  using ParameterIndexTable = llvm::DenseMap<const VarDecl *, unsigned>;
515  ParameterIndexTable ParamIndices;
516
517  ImportDecl *FirstLocalImport = nullptr;
518  ImportDecl *LastLocalImport = nullptr;
519
520  TranslationUnitDecl *TUDecl;
521  mutable ExternCContextDecl *ExternCContext = nullptr;
522  mutable BuiltinTemplateDecl *MakeIntegerSeqDecl = nullptr;
523  mutable BuiltinTemplateDecl *TypePackElementDecl = nullptr;
524
525  /// The associated SourceManager object.
526  SourceManager &SourceMgr;
527
528  /// The language options used to create the AST associated with
529  ///  this ASTContext object.
530  LangOptions &LangOpts;
531
532  /// Blacklist object that is used by sanitizers to decide which
533  /// entities should not be instrumented.
534  std::unique_ptr<SanitizerBlacklistSanitizerBL;
535
536  /// Function filtering mechanism to determine whether a given function
537  /// should be imbued with the XRay "always" or "never" attributes.
538  std::unique_ptr<XRayFunctionFilterXRayFilter;
539
540  /// The allocator used to create AST objects.
541  ///
542  /// AST objects are never destructed; rather, all memory associated with the
543  /// AST objects will be released when the ASTContext itself is destroyed.
544  mutable llvm::BumpPtrAllocator BumpAlloc;
545
546  /// Allocator for partial diagnostics.
547  PartialDiagnostic::StorageAllocator DiagAllocator;
548
549  /// The current C++ ABI.
550  std::unique_ptr<CXXABIABI;
551  CXXABI *createCXXABI(const TargetInfo &T);
552
553  /// The logical -> physical address space map.
554  const LangASMap *AddrSpaceMap = nullptr;
555
556  /// Address space map mangling must be used with language specific
557  /// address spaces (e.g. OpenCL/CUDA)
558  bool AddrSpaceMapMangling;
559
560  const TargetInfo *Target = nullptr;
561  const TargetInfo *AuxTarget = nullptr;
562  clang::PrintingPolicy PrintingPolicy;
563
564public:
565  IdentifierTable &Idents;
566  SelectorTable &Selectors;
567  Builtin::Context &BuiltinInfo;
568  mutable DeclarationNameTable DeclarationNames;
569  IntrusiveRefCntPtr<ExternalASTSourceExternalSource;
570  ASTMutationListener *Listener = nullptr;
571
572  /// Container for either a single DynTypedNode or for an ArrayRef to
573  /// DynTypedNode. For use with ParentMap.
574  class DynTypedNodeList {
575    using DynTypedNode = ast_type_traits::DynTypedNode;
576
577    llvm::AlignedCharArrayUnion<ast_type_traits::DynTypedNode,
578                                ArrayRef<DynTypedNode>> Storage;
579    bool IsSingleNode;
580
581  public:
582    DynTypedNodeList(const DynTypedNode &N) : IsSingleNode(true) {
583      new (Storage.buffer) DynTypedNode(N);
584    }
585
586    DynTypedNodeList(ArrayRef<DynTypedNodeA) : IsSingleNode(false) {
587      new (Storage.buffer) ArrayRef<DynTypedNode>(A);
588    }
589
590    const ast_type_traits::DynTypedNode *begin() const {
591      if (!IsSingleNode)
592        return reinterpret_cast<const ArrayRef<DynTypedNode> *>(Storage.buffer)
593            ->begin();
594      return reinterpret_cast<const DynTypedNode *>(Storage.buffer);
595    }
596
597    const ast_type_traits::DynTypedNode *end() const {
598      if (!IsSingleNode)
599        return reinterpret_cast<const ArrayRef<DynTypedNode> *>(Storage.buffer)
600            ->end();
601      return reinterpret_cast<const DynTypedNode *>(Storage.buffer) + 1;
602    }
603
604    size_t size() const { return end() - begin(); }
605    bool empty() const { return begin() == end(); }
606
607    const DynTypedNode &operator[](size_t Nconst {
608       (0) . __assert_fail ("N < size() && \"Out of bounds!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ASTContext.h", 608, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(N < size() && "Out of bounds!");
609      return *(begin() + N);
610    }
611  };
612
613  // A traversal scope limits the parts of the AST visible to certain analyses.
614  // RecursiveASTVisitor::TraverseAST will only visit reachable nodes, and
615  // getParents() will only observe reachable parent edges.
616  //
617  // The scope is defined by a set of "top-level" declarations.
618  // Initially, it is the entire TU: {getTranslationUnitDecl()}.
619  // Changing the scope clears the parent cache, which is expensive to rebuild.
620  std::vector<Decl *> getTraversalScope() const { return TraversalScope; }
621  void setTraversalScope(const std::vector<Decl *> &);
622
623  /// Returns the parents of the given node (within the traversal scope).
624  ///
625  /// Note that this will lazily compute the parents of all nodes
626  /// and store them for later retrieval. Thus, the first call is O(n)
627  /// in the number of AST nodes.
628  ///
629  /// Caveats and FIXMEs:
630  /// Calculating the parent map over all AST nodes will need to load the
631  /// full AST. This can be undesirable in the case where the full AST is
632  /// expensive to create (for example, when using precompiled header
633  /// preambles). Thus, there are good opportunities for optimization here.
634  /// One idea is to walk the given node downwards, looking for references
635  /// to declaration contexts - once a declaration context is found, compute
636  /// the parent map for the declaration context; if that can satisfy the
637  /// request, loading the whole AST can be avoided. Note that this is made
638  /// more complex by statements in templates having multiple parents - those
639  /// problems can be solved by building closure over the templated parts of
640  /// the AST, which also avoids touching large parts of the AST.
641  /// Additionally, we will want to add an interface to already give a hint
642  /// where to search for the parents, for example when looking at a statement
643  /// inside a certain function.
644  ///
645  /// 'NodeT' can be one of Decl, Stmt, Type, TypeLoc,
646  /// NestedNameSpecifier or NestedNameSpecifierLoc.
647  template <typename NodeT> DynTypedNodeList getParents(const NodeT &Node) {
648    return getParents(ast_type_traits::DynTypedNode::create(Node));
649  }
650
651  DynTypedNodeList getParents(const ast_type_traits::DynTypedNode &Node);
652
653  const clang::PrintingPolicy &getPrintingPolicy() const {
654    return PrintingPolicy;
655  }
656
657  void setPrintingPolicy(const clang::PrintingPolicy &Policy) {
658    PrintingPolicy = Policy;
659  }
660
661  SourceManagergetSourceManager() { return SourceMgr; }
662  const SourceManagergetSourceManager() const { return SourceMgr; }
663
664  llvm::BumpPtrAllocator &getAllocator() const {
665    return BumpAlloc;
666  }
667
668  void *Allocate(size_t Sizeunsigned Align = 8const {
669    return BumpAlloc.Allocate(Size, Align);
670  }
671  template <typename T> T *Allocate(size_t Num = 1const {
672    return static_cast<T *>(Allocate(Num * sizeof(T), alignof(T)));
673  }
674  void Deallocate(void *Ptrconst {}
675
676  /// Return the total amount of physical memory allocated for representing
677  /// AST nodes and type information.
678  size_t getASTAllocatedMemory() const {
679    return BumpAlloc.getTotalMemory();
680  }
681
682  /// Return the total memory used for various side tables.
683  size_t getSideTableAllocatedMemory() const;
684
685  PartialDiagnostic::StorageAllocator &getDiagAllocator() {
686    return DiagAllocator;
687  }
688
689  const TargetInfo &getTargetInfo() const { return *Target; }
690  const TargetInfo *getAuxTargetInfo() const { return AuxTarget; }
691
692  /// getIntTypeForBitwidth -
693  /// sets integer QualTy according to specified details:
694  /// bitwidth, signed/unsigned.
695  /// Returns empty type if there is no appropriate target types.
696  QualType getIntTypeForBitwidth(unsigned DestWidth,
697                                 unsigned Signedconst;
698
699  /// getRealTypeForBitwidth -
700  /// sets floating point QualTy according to specified bitwidth.
701  /// Returns empty type if there is no appropriate target types.
702  QualType getRealTypeForBitwidth(unsigned DestWidthconst;
703
704  bool AtomicUsesUnsupportedLibcall(const AtomicExpr *Econst;
705
706  const LangOptionsgetLangOpts() const { return LangOpts; }
707
708  const SanitizerBlacklist &getSanitizerBlacklist() const {
709    return *SanitizerBL;
710  }
711
712  const XRayFunctionFilter &getXRayFilter() const {
713    return *XRayFilter;
714  }
715
716  DiagnosticsEngine &getDiagnostics() const;
717
718  FullSourceLoc getFullLoc(SourceLocation Locconst {
719    return FullSourceLoc(Loc,SourceMgr);
720  }
721
722  /// All comments in this translation unit.
723  RawCommentList Comments;
724
725  /// True if comments are already loaded from ExternalASTSource.
726  mutable bool CommentsLoaded = false;
727
728  class RawCommentAndCacheFlags {
729  public:
730    enum Kind {
731      /// We searched for a comment attached to the particular declaration, but
732      /// didn't find any.
733      ///
734      /// getRaw() == 0.
735      NoCommentInDecl = 0,
736
737      /// We have found a comment attached to this particular declaration.
738      ///
739      /// getRaw() != 0.
740      FromDecl,
741
742      /// This declaration does not have an attached comment, and we have
743      /// searched the redeclaration chain.
744      ///
745      /// If getRaw() == 0, the whole redeclaration chain does not have any
746      /// comments.
747      ///
748      /// If getRaw() != 0, it is a comment propagated from other
749      /// redeclaration.
750      FromRedecl
751    };
752
753    Kind getKind() const LLVM_READONLY {
754      return Data.getInt();
755    }
756
757    void setKind(Kind K) {
758      Data.setInt(K);
759    }
760
761    const RawComment *getRaw() const LLVM_READONLY {
762      return Data.getPointer();
763    }
764
765    void setRaw(const RawComment *RC) {
766      Data.setPointer(RC);
767    }
768
769    const Decl *getOriginalDecl() const LLVM_READONLY {
770      return OriginalDecl;
771    }
772
773    void setOriginalDecl(const Decl *Orig) {
774      OriginalDecl = Orig;
775    }
776
777  private:
778    llvm::PointerIntPair<const RawComment *, 2, Kind> Data;
779    const Decl *OriginalDecl;
780  };
781
782  /// Mapping from declarations to comments attached to any
783  /// redeclaration.
784  ///
785  /// Raw comments are owned by Comments list.  This mapping is populated
786  /// lazily.
787  mutable llvm::DenseMap<const Decl *, RawCommentAndCacheFlags> RedeclComments;
788
789  /// Mapping from declarations to parsed comments attached to any
790  /// redeclaration.
791  mutable llvm::DenseMap<const Decl *, comments::FullComment *> ParsedComments;
792
793  /// Return the documentation comment attached to a given declaration,
794  /// without looking into cache.
795  RawComment *getRawCommentForDeclNoCache(const Decl *Dconst;
796
797public:
798  RawCommentList &getRawCommentList() {
799    return Comments;
800  }
801
802  void addComment(const RawComment &RC) {
803    assert(LangOpts.RetainCommentsFromSystemHeaders ||
804           !SourceMgr.isInSystemHeader(RC.getSourceRange().getBegin()));
805    Comments.addComment(RC, LangOpts.CommentOpts, BumpAlloc);
806  }
807
808  /// Return the documentation comment attached to a given declaration.
809  /// Returns nullptr if no comment is attached.
810  ///
811  /// \param OriginalDecl if not nullptr, is set to declaration AST node that
812  /// had the comment, if the comment we found comes from a redeclaration.
813  const RawComment *
814  getRawCommentForAnyRedecl(const Decl *D,
815                            const Decl **OriginalDecl = nullptrconst;
816
817  /// Return parsed documentation comment attached to a given declaration.
818  /// Returns nullptr if no comment is attached.
819  ///
820  /// \param PP the Preprocessor used with this TU.  Could be nullptr if
821  /// preprocessor is not available.
822  comments::FullComment *getCommentForDecl(const Decl *D,
823                                           const Preprocessor *PPconst;
824
825  /// Return parsed documentation comment attached to a given declaration.
826  /// Returns nullptr if no comment is attached. Does not look at any
827  /// redeclarations of the declaration.
828  comments::FullComment *getLocalCommentForDeclUncached(const Decl *Dconst;
829
830  comments::FullComment *cloneFullComment(comments::FullComment *FC,
831                                         const Decl *Dconst;
832
833private:
834  mutable comments::CommandTraits CommentCommandTraits;
835
836  /// Iterator that visits import declarations.
837  class import_iterator {
838    ImportDecl *Import = nullptr;
839
840  public:
841    using value_type = ImportDecl *;
842    using reference = ImportDecl *;
843    using pointer = ImportDecl *;
844    using difference_type = int;
845    using iterator_category = std::forward_iterator_tag;
846
847    import_iterator() = default;
848    explicit import_iterator(ImportDecl *Import) : Import(Import) {}
849
850    reference operator*() const { return Import; }
851    pointer operator->() const { return Import; }
852
853    import_iterator &operator++() {
854      Import = ASTContext::getNextLocalImport(Import);
855      return *this;
856    }
857
858    import_iterator operator++(int) {
859      import_iterator Other(*this);
860      ++(*this);
861      return Other;
862    }
863
864    friend bool operator==(import_iterator Ximport_iterator Y) {
865      return X.Import == Y.Import;
866    }
867
868    friend bool operator!=(import_iterator Ximport_iterator Y) {
869      return X.Import != Y.Import;
870    }
871  };
872
873public:
874  comments::CommandTraits &getCommentCommandTraits() const {
875    return CommentCommandTraits;
876  }
877
878  /// Retrieve the attributes for the given declaration.
879  AttrVecgetDeclAttrs(const Decl *D);
880
881  /// Erase the attributes corresponding to the given declaration.
882  void eraseDeclAttrs(const Decl *D);
883
884  /// If this variable is an instantiated static data member of a
885  /// class template specialization, returns the templated static data member
886  /// from which it was instantiated.
887  // FIXME: Remove ?
888  MemberSpecializationInfo *getInstantiatedFromStaticDataMember(
889                                                           const VarDecl *Var);
890
891  TemplateOrSpecializationInfo
892  getTemplateOrSpecializationInfo(const VarDecl *Var);
893
894  FunctionDecl *getClassScopeSpecializationPattern(const FunctionDecl *FD);
895
896  void setClassScopeSpecializationPattern(FunctionDecl *FD,
897                                          FunctionDecl *Pattern);
898
899  /// Note that the static data member \p Inst is an instantiation of
900  /// the static data member template \p Tmpl of a class template.
901  void setInstantiatedFromStaticDataMember(VarDecl *InstVarDecl *Tmpl,
902                                           TemplateSpecializationKind TSK,
903                        SourceLocation PointOfInstantiation = SourceLocation());
904
905  void setTemplateOrSpecializationInfo(VarDecl *Inst,
906                                       TemplateOrSpecializationInfo TSI);
907
908  /// If the given using decl \p Inst is an instantiation of a
909  /// (possibly unresolved) using decl from a template instantiation,
910  /// return it.
911  NamedDecl *getInstantiatedFromUsingDecl(NamedDecl *Inst);
912
913  /// Remember that the using decl \p Inst is an instantiation
914  /// of the using decl \p Pattern of a class template.
915  void setInstantiatedFromUsingDecl(NamedDecl *InstNamedDecl *Pattern);
916
917  void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst,
918                                          UsingShadowDecl *Pattern);
919  UsingShadowDecl *getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst);
920
921  FieldDecl *getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field);
922
923  void setInstantiatedFromUnnamedFieldDecl(FieldDecl *InstFieldDecl *Tmpl);
924
925  // Access to the set of methods overridden by the given C++ method.
926  using overridden_cxx_method_iterator = CXXMethodVector::const_iterator;
927  overridden_cxx_method_iterator
928  overridden_methods_begin(const CXXMethodDecl *Method) const;
929
930  overridden_cxx_method_iterator
931  overridden_methods_end(const CXXMethodDecl *Method) const;
932
933  unsigned overridden_methods_size(const CXXMethodDecl *Methodconst;
934
935  using overridden_method_range =
936      llvm::iterator_range<overridden_cxx_method_iterator>;
937
938  overridden_method_range overridden_methods(const CXXMethodDecl *Method) const;
939
940  /// Note that the given C++ \p Method overrides the given \p
941  /// Overridden method.
942  void addOverriddenMethod(const CXXMethodDecl *Method,
943                           const CXXMethodDecl *Overridden);
944
945  /// Return C++ or ObjC overridden methods for the given \p Method.
946  ///
947  /// An ObjC method is considered to override any method in the class's
948  /// base classes, its protocols, or its categories' protocols, that has
949  /// the same selector and is of the same kind (class or instance).
950  /// A method in an implementation is not considered as overriding the same
951  /// method in the interface or its categories.
952  void getOverriddenMethods(
953                        const NamedDecl *Method,
954                        SmallVectorImpl<const NamedDecl *> &Overriddenconst;
955
956  /// Notify the AST context that a new import declaration has been
957  /// parsed or implicitly created within this translation unit.
958  void addedLocalImportDecl(ImportDecl *Import);
959
960  static ImportDecl *getNextLocalImport(ImportDecl *Import) {
961    return Import->NextLocalImport;
962  }
963
964  using import_range = llvm::iterator_range<import_iterator>;
965
966  import_range local_imports() const {
967    return import_range(import_iterator(FirstLocalImport), import_iterator());
968  }
969
970  Decl *getPrimaryMergedDecl(Decl *D) {
971    Decl *Result = MergedDecls.lookup(D);
972    return Result ? Result : D;
973  }
974  void setPrimaryMergedDecl(Decl *DDecl *Primary) {
975    MergedDecls[D] = Primary;
976  }
977
978  /// Note that the definition \p ND has been merged into module \p M,
979  /// and should be visible whenever \p M is visible.
980  void mergeDefinitionIntoModule(NamedDecl *NDModule *M,
981                                 bool NotifyListeners = true);
982
983  /// Clean up the merged definition list. Call this if you might have
984  /// added duplicates into the list.
985  void deduplicateMergedDefinitonsFor(NamedDecl *ND);
986
987  /// Get the additional modules in which the definition \p Def has
988  /// been merged.
989  ArrayRef<Module*> getModulesWithMergedDefinition(const NamedDecl *Def) {
990    auto MergedIt =
991        MergedDefModules.find(cast<NamedDecl>(Def->getCanonicalDecl()));
992    if (MergedIt == MergedDefModules.end())
993      return None;
994    return MergedIt->second;
995  }
996
997  /// Add a declaration to the list of declarations that are initialized
998  /// for a module. This will typically be a global variable (with internal
999  /// linkage) that runs module initializers, such as the iostream initializer,
1000  /// or an ImportDecl nominating another module that has initializers.
1001  void addModuleInitializer(Module *MDecl *Init);
1002
1003  void addLazyModuleInitializers(Module *MArrayRef<uint32_tIDs);
1004
1005  /// Get the initializations to perform when importing a module, if any.
1006  ArrayRef<Decl*> getModuleInitializers(Module *M);
1007
1008  TranslationUnitDecl *getTranslationUnitDecl() const { return TUDecl; }
1009
1010  ExternCContextDecl *getExternCContextDecl() const;
1011  BuiltinTemplateDecl *getMakeIntegerSeqDecl() const;
1012  BuiltinTemplateDecl *getTypePackElementDecl() const;
1013
1014  // Builtin Types.
1015  CanQualType VoidTy;
1016  CanQualType BoolTy;
1017  CanQualType CharTy;
1018  CanQualType WCharTy;  // [C++ 3.9.1p5].
1019  CanQualType WideCharTy// Same as WCharTy in C++, integer type in C99.
1020  CanQualType WIntTy;   // [C99 7.24.1], integer type unchanged by default promotions.
1021  CanQualType Char8Ty;  // [C++20 proposal]
1022  CanQualType Char16Ty// [C++0x 3.9.1p5], integer type in C99.
1023  CanQualType Char32Ty// [C++0x 3.9.1p5], integer type in C99.
1024  CanQualType SignedCharTyShortTyIntTyLongTyLongLongTyInt128Ty;
1025  CanQualType UnsignedCharTyUnsignedShortTyUnsignedIntTyUnsignedLongTy;
1026  CanQualType UnsignedLongLongTyUnsignedInt128Ty;
1027  CanQualType FloatTyDoubleTyLongDoubleTyFloat128Ty;
1028  CanQualType ShortAccumTyAccumTy,
1029      LongAccumTy;  // ISO/IEC JTC1 SC22 WG14 N1169 Extension
1030  CanQualType UnsignedShortAccumTyUnsignedAccumTyUnsignedLongAccumTy;
1031  CanQualType ShortFractTyFractTyLongFractTy;
1032  CanQualType UnsignedShortFractTyUnsignedFractTyUnsignedLongFractTy;
1033  CanQualType SatShortAccumTySatAccumTySatLongAccumTy;
1034  CanQualType SatUnsignedShortAccumTySatUnsignedAccumTy,
1035      SatUnsignedLongAccumTy;
1036  CanQualType SatShortFractTySatFractTySatLongFractTy;
1037  CanQualType SatUnsignedShortFractTySatUnsignedFractTy,
1038      SatUnsignedLongFractTy;
1039  CanQualType HalfTy// [OpenCL 6.1.1.1], ARM NEON
1040  CanQualType Float16Ty// C11 extension ISO/IEC TS 18661-3
1041  CanQualType FloatComplexTyDoubleComplexTyLongDoubleComplexTy;
1042  CanQualType Float128ComplexTy;
1043  CanQualType VoidPtrTyNullPtrTy;
1044  CanQualType DependentTyOverloadTyBoundMemberTyUnknownAnyTy;
1045  CanQualType BuiltinFnTy;
1046  CanQualType PseudoObjectTyARCUnbridgedCastTy;
1047  CanQualType ObjCBuiltinIdTyObjCBuiltinClassTyObjCBuiltinSelTy;
1048  CanQualType ObjCBuiltinBoolTy;
1049#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
1050  CanQualType SingletonId;
1051#include "clang/Basic/OpenCLImageTypes.def"
1052  CanQualType OCLSamplerTyOCLEventTyOCLClkEventTy;
1053  CanQualType OCLQueueTyOCLReserveIDTy;
1054  CanQualType OMPArraySectionTy;
1055#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
1056  CanQualType Id##Ty;
1057#include "clang/Basic/OpenCLExtensionTypes.def"
1058
1059  // Types for deductions in C++0x [stmt.ranged]'s desugaring. Built on demand.
1060  mutable QualType AutoDeductTy;     // Deduction against 'auto'.
1061  mutable QualType AutoRRefDeductTy// Deduction against 'auto &&'.
1062
1063  // Decl used to help define __builtin_va_list for some targets.
1064  // The decl is built when constructing 'BuiltinVaListDecl'.
1065  mutable Decl *VaListTagDecl;
1066
1067  ASTContext(LangOptions &LOptsSourceManager &SMIdentifierTable &idents,
1068             SelectorTable &selsBuiltin::Context &builtins);
1069  ASTContext(const ASTContext &) = delete;
1070  ASTContext &operator=(const ASTContext &) = delete;
1071  ~ASTContext();
1072
1073  /// Attach an external AST source to the AST context.
1074  ///
1075  /// The external AST source provides the ability to load parts of
1076  /// the abstract syntax tree as needed from some external storage,
1077  /// e.g., a precompiled header.
1078  void setExternalSource(IntrusiveRefCntPtr<ExternalASTSourceSource);
1079
1080  /// Retrieve a pointer to the external AST source associated
1081  /// with this AST context, if any.
1082  ExternalASTSource *getExternalSource() const {
1083    return ExternalSource.get();
1084  }
1085
1086  /// Attach an AST mutation listener to the AST context.
1087  ///
1088  /// The AST mutation listener provides the ability to track modifications to
1089  /// the abstract syntax tree entities committed after they were initially
1090  /// created.
1091  void setASTMutationListener(ASTMutationListener *Listener) {
1092    this->Listener = Listener;
1093  }
1094
1095  /// Retrieve a pointer to the AST mutation listener associated
1096  /// with this AST context, if any.
1097  ASTMutationListener *getASTMutationListener() const { return Listener; }
1098
1099  void PrintStats() const;
1100  const SmallVectorImpl<Type *>& getTypes() const { return Types; }
1101
1102  BuiltinTemplateDecl *buildBuiltinTemplateDecl(BuiltinTemplateKind BTK,
1103                                                const IdentifierInfo *IIconst;
1104
1105  /// Create a new implicit TU-level CXXRecordDecl or RecordDecl
1106  /// declaration.
1107  RecordDecl *buildImplicitRecord(StringRef Name,
1108                                  RecordDecl::TagKind TK = TTK_Structconst;
1109
1110  /// Create a new implicit TU-level typedef declaration.
1111  TypedefDecl *buildImplicitTypedef(QualType TStringRef Nameconst;
1112
1113  /// Retrieve the declaration for the 128-bit signed integer type.
1114  TypedefDecl *getInt128Decl() const;
1115
1116  /// Retrieve the declaration for the 128-bit unsigned integer type.
1117  TypedefDecl *getUInt128Decl() const;
1118
1119  //===--------------------------------------------------------------------===//
1120  //                           Type Constructors
1121  //===--------------------------------------------------------------------===//
1122
1123private:
1124  /// Return a type with extended qualifiers.
1125  QualType getExtQualType(const Type *BaseQualifiers Qualsconst;
1126
1127  QualType getTypeDeclTypeSlow(const TypeDecl *Declconst;
1128
1129  QualType getPipeType(QualType Tbool ReadOnlyconst;
1130
1131public:
1132  /// Return the uniqued reference to the type for an address space
1133  /// qualified type with the specified type and address space.
1134  ///
1135  /// The resulting type has a union of the qualifiers from T and the address
1136  /// space. If T already has an address space specifier, it is silently
1137  /// replaced.
1138  QualType getAddrSpaceQualType(QualType TLangAS AddressSpaceconst;
1139
1140  /// Remove any existing address space on the type and returns the type
1141  /// with qualifiers intact (or that's the idea anyway)
1142  ///
1143  /// The return type should be T with all prior qualifiers minus the address
1144  /// space.
1145  QualType removeAddrSpaceQualType(QualType Tconst;
1146
1147  /// Apply Objective-C protocol qualifiers to the given type.
1148  /// \param allowOnPointerType specifies if we can apply protocol
1149  /// qualifiers on ObjCObjectPointerType. It can be set to true when
1150  /// constructing the canonical type of a Objective-C type parameter.
1151  QualType applyObjCProtocolQualifiers(QualType type,
1152      ArrayRef<ObjCProtocolDecl *> protocolsbool &hasError,
1153      bool allowOnPointerType = falseconst;
1154
1155  /// Return the uniqued reference to the type for an Objective-C
1156  /// gc-qualified type.
1157  ///
1158  /// The resulting type has a union of the qualifiers from T and the gc
1159  /// attribute.
1160  QualType getObjCGCQualType(QualType TQualifiers::GC gcAttrconst;
1161
1162  /// Return the uniqued reference to the type for a \c restrict
1163  /// qualified type.
1164  ///
1165  /// The resulting type has a union of the qualifiers from \p T and
1166  /// \c restrict.
1167  QualType getRestrictType(QualType Tconst {
1168    return T.withFastQualifiers(Qualifiers::Restrict);
1169  }
1170
1171  /// Return the uniqued reference to the type for a \c volatile
1172  /// qualified type.
1173  ///
1174  /// The resulting type has a union of the qualifiers from \p T and
1175  /// \c volatile.
1176  QualType getVolatileType(QualType Tconst {
1177    return T.withFastQualifiers(Qualifiers::Volatile);
1178  }
1179
1180  /// Return the uniqued reference to the type for a \c const
1181  /// qualified type.
1182  ///
1183  /// The resulting type has a union of the qualifiers from \p T and \c const.
1184  ///
1185  /// It can be reasonably expected that this will always be equivalent to
1186  /// calling T.withConst().
1187  QualType getConstType(QualType Tconst { return T.withConst(); }
1188
1189  /// Change the ExtInfo on a function type.
1190  const FunctionType *adjustFunctionType(const FunctionType *Fn,
1191                                         FunctionType::ExtInfo EInfo);
1192
1193  /// Adjust the given function result type.
1194  CanQualType getCanonicalFunctionResultType(QualType ResultTypeconst;
1195
1196  /// Change the result type of a function type once it is deduced.
1197  void adjustDeducedFunctionResultType(FunctionDecl *FDQualType ResultType);
1198
1199  /// Get a function type and produce the equivalent function type with the
1200  /// specified exception specification. Type sugar that can be present on a
1201  /// declaration of a function with an exception specification is permitted
1202  /// and preserved. Other type sugar (for instance, typedefs) is not.
1203  QualType getFunctionTypeWithExceptionSpec(
1204      QualType Origconst FunctionProtoType::ExceptionSpecInfo &ESI);
1205
1206  /// Determine whether two function types are the same, ignoring
1207  /// exception specifications in cases where they're part of the type.
1208  bool hasSameFunctionTypeIgnoringExceptionSpec(QualType TQualType U);
1209
1210  /// Change the exception specification on a function once it is
1211  /// delay-parsed, instantiated, or computed.
1212  void adjustExceptionSpec(FunctionDecl *FD,
1213                           const FunctionProtoType::ExceptionSpecInfo &ESI,
1214                           bool AsWritten = false);
1215
1216  /// Return the uniqued reference to the type for a complex
1217  /// number with the specified element type.
1218  QualType getComplexType(QualType Tconst;
1219  CanQualType getComplexType(CanQualType Tconst {
1220    return CanQualType::CreateUnsafe(getComplexType((QualTypeT));
1221  }
1222
1223  /// Return the uniqued reference to the type for a pointer to
1224  /// the specified type.
1225  QualType getPointerType(QualType Tconst;
1226  CanQualType getPointerType(CanQualType Tconst {
1227    return CanQualType::CreateUnsafe(getPointerType((QualTypeT));
1228  }
1229
1230  /// Return the uniqued reference to a type adjusted from the original
1231  /// type to a new type.
1232  QualType getAdjustedType(QualType OrigQualType Newconst;
1233  CanQualType getAdjustedType(CanQualType OrigCanQualType Newconst {
1234    return CanQualType::CreateUnsafe(
1235        getAdjustedType((QualType)Orig, (QualType)New));
1236  }
1237
1238  /// Return the uniqued reference to the decayed version of the given
1239  /// type.  Can only be called on array and function types which decay to
1240  /// pointer types.
1241  QualType getDecayedType(QualType Tconst;
1242  CanQualType getDecayedType(CanQualType Tconst {
1243    return CanQualType::CreateUnsafe(getDecayedType((QualTypeT));
1244  }
1245
1246  /// Return the uniqued reference to the atomic type for the specified
1247  /// type.
1248  QualType getAtomicType(QualType Tconst;
1249
1250  /// Return the uniqued reference to the type for a block of the
1251  /// specified type.
1252  QualType getBlockPointerType(QualType Tconst;
1253
1254  /// Gets the struct used to keep track of the descriptor for pointer to
1255  /// blocks.
1256  QualType getBlockDescriptorType() const;
1257
1258  /// Return a read_only pipe type for the specified type.
1259  QualType getReadPipeType(QualType Tconst;
1260
1261  /// Return a write_only pipe type for the specified type.
1262  QualType getWritePipeType(QualType Tconst;
1263
1264  /// Gets the struct used to keep track of the extended descriptor for
1265  /// pointer to blocks.
1266  QualType getBlockDescriptorExtendedType() const;
1267
1268  /// Map an AST Type to an OpenCLTypeKind enum value.
1269  TargetInfo::OpenCLTypeKind getOpenCLTypeKind(const Type *Tconst;
1270
1271  /// Get address space for OpenCL type.
1272  LangAS getOpenCLTypeAddrSpace(const Type *Tconst;
1273
1274  void setcudaConfigureCallDecl(FunctionDecl *FD) {
1275    cudaConfigureCallDecl = FD;
1276  }
1277
1278  FunctionDecl *getcudaConfigureCallDecl() {
1279    return cudaConfigureCallDecl;
1280  }
1281
1282  /// Returns true iff we need copy/dispose helpers for the given type.
1283  bool BlockRequiresCopying(QualType Tyconst VarDecl *D);
1284
1285  /// Returns true, if given type has a known lifetime. HasByrefExtendedLayout
1286  /// is set to false in this case. If HasByrefExtendedLayout returns true,
1287  /// byref variable has extended lifetime.
1288  bool getByrefLifetime(QualType Ty,
1289                        Qualifiers::ObjCLifetime &Lifetime,
1290                        bool &HasByrefExtendedLayoutconst;
1291
1292  /// Return the uniqued reference to the type for an lvalue reference
1293  /// to the specified type.
1294  QualType getLValueReferenceType(QualType Tbool SpelledAsLValue = true)
1295    const;
1296
1297  /// Return the uniqued reference to the type for an rvalue reference
1298  /// to the specified type.
1299  QualType getRValueReferenceType(QualType Tconst;
1300
1301  /// Return the uniqued reference to the type for a member pointer to
1302  /// the specified type in the specified class.
1303  ///
1304  /// The class \p Cls is a \c Type because it could be a dependent name.
1305  QualType getMemberPointerType(QualType Tconst Type *Clsconst;
1306
1307  /// Return a non-unique reference to the type for a variable array of
1308  /// the specified element type.
1309  QualType getVariableArrayType(QualType EltTyExpr *NumElts,
1310                                ArrayType::ArraySizeModifier ASM,
1311                                unsigned IndexTypeQuals,
1312                                SourceRange Bracketsconst;
1313
1314  /// Return a non-unique reference to the type for a dependently-sized
1315  /// array of the specified element type.
1316  ///
1317  /// FIXME: We will need these to be uniqued, or at least comparable, at some
1318  /// point.
1319  QualType getDependentSizedArrayType(QualType EltTyExpr *NumElts,
1320                                      ArrayType::ArraySizeModifier ASM,
1321                                      unsigned IndexTypeQuals,
1322                                      SourceRange Bracketsconst;
1323
1324  /// Return a unique reference to the type for an incomplete array of
1325  /// the specified element type.
1326  QualType getIncompleteArrayType(QualType EltTy,
1327                                  ArrayType::ArraySizeModifier ASM,
1328                                  unsigned IndexTypeQualsconst;
1329
1330  /// Return the unique reference to the type for a constant array of
1331  /// the specified element type.
1332  QualType getConstantArrayType(QualType EltTyconst llvm::APInt &ArySize,
1333                                ArrayType::ArraySizeModifier ASM,
1334                                unsigned IndexTypeQualsconst;
1335
1336  /// Returns a vla type where known sizes are replaced with [*].
1337  QualType getVariableArrayDecayedType(QualType Tyconst;
1338
1339  /// Return the unique reference to a vector type of the specified
1340  /// element type and size.
1341  ///
1342  /// \pre \p VectorType must be a built-in type.
1343  QualType getVectorType(QualType VectorTypeunsigned NumElts,
1344                         VectorType::VectorKind VecKindconst;
1345  /// Return the unique reference to the type for a dependently sized vector of
1346  /// the specified element type.
1347  QualType getDependentVectorType(QualType VectorTypeExpr *SizeExpr,
1348                                  SourceLocation AttrLoc,
1349                                  VectorType::VectorKind VecKindconst;
1350
1351  /// Return the unique reference to an extended vector type
1352  /// of the specified element type and size.
1353  ///
1354  /// \pre \p VectorType must be a built-in type.
1355  QualType getExtVectorType(QualType VectorTypeunsigned NumEltsconst;
1356
1357  /// \pre Return a non-unique reference to the type for a dependently-sized
1358  /// vector of the specified element type.
1359  ///
1360  /// FIXME: We will need these to be uniqued, or at least comparable, at some
1361  /// point.
1362  QualType getDependentSizedExtVectorType(QualType VectorType,
1363                                          Expr *SizeExpr,
1364                                          SourceLocation AttrLocconst;
1365
1366  QualType getDependentAddressSpaceType(QualType PointeeType,
1367                                        Expr *AddrSpaceExpr,
1368                                        SourceLocation AttrLocconst;
1369
1370  /// Return a K&R style C function type like 'int()'.
1371  QualType getFunctionNoProtoType(QualType ResultTy,
1372                                  const FunctionType::ExtInfo &Infoconst;
1373
1374  QualType getFunctionNoProtoType(QualType ResultTyconst {
1375    return getFunctionNoProtoType(ResultTyFunctionType::ExtInfo());
1376  }
1377
1378  /// Return a normal function type with a typed argument list.
1379  QualType getFunctionType(QualType ResultTyArrayRef<QualTypeArgs,
1380                           const FunctionProtoType::ExtProtoInfo &EPIconst {
1381    return getFunctionTypeInternal(ResultTy, Args, EPI, false);
1382  }
1383
1384  QualType adjustStringLiteralBaseType(QualType StrLTyconst;
1385
1386private:
1387  /// Return a normal function type with a typed argument list.
1388  QualType getFunctionTypeInternal(QualType ResultTyArrayRef<QualTypeArgs,
1389                                   const FunctionProtoType::ExtProtoInfo &EPI,
1390                                   bool OnlyWantCanonicalconst;
1391
1392public:
1393  /// Return the unique reference to the type for the specified type
1394  /// declaration.
1395  QualType getTypeDeclType(const TypeDecl *Decl,
1396                           const TypeDecl *PrevDecl = nullptrconst {
1397     (0) . __assert_fail ("Decl && \"Passed null for Decl param\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ASTContext.h", 1397, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Decl && "Passed null for Decl param");
1398    if (Decl->TypeForDeclreturn QualType(Decl->TypeForDecl0);
1399
1400    if (PrevDecl) {
1401       (0) . __assert_fail ("PrevDecl->TypeForDecl && \"previous decl has no TypeForDecl\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ASTContext.h", 1401, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(PrevDecl->TypeForDecl && "previous decl has no TypeForDecl");
1402      Decl->TypeForDecl = PrevDecl->TypeForDecl;
1403      return QualType(PrevDecl->TypeForDecl0);
1404    }
1405
1406    return getTypeDeclTypeSlow(Decl);
1407  }
1408
1409  /// Return the unique reference to the type for the specified
1410  /// typedef-name decl.
1411  QualType getTypedefType(const TypedefNameDecl *Decl,
1412                          QualType Canon = QualType()) const;
1413
1414  QualType getRecordType(const RecordDecl *Declconst;
1415
1416  QualType getEnumType(const EnumDecl *Declconst;
1417
1418  QualType getInjectedClassNameType(CXXRecordDecl *DeclQualType TSTconst;
1419
1420  QualType getAttributedType(attr::Kind attrKind,
1421                             QualType modifiedType,
1422                             QualType equivalentType);
1423
1424  QualType getSubstTemplateTypeParmType(const TemplateTypeParmType *Replaced,
1425                                        QualType Replacementconst;
1426  QualType getSubstTemplateTypeParmPackType(
1427                                          const TemplateTypeParmType *Replaced,
1428                                            const TemplateArgument &ArgPack);
1429
1430  QualType
1431  getTemplateTypeParmType(unsigned Depthunsigned Index,
1432                          bool ParameterPack,
1433                          TemplateTypeParmDecl *ParmDecl = nullptrconst;
1434
1435  QualType getTemplateSpecializationType(TemplateName T,
1436                                         ArrayRef<TemplateArgumentArgs,
1437                                         QualType Canon = QualType()) const;
1438
1439  QualType
1440  getCanonicalTemplateSpecializationType(TemplateName T,
1441                                         ArrayRef<TemplateArgumentArgsconst;
1442
1443  QualType getTemplateSpecializationType(TemplateName T,
1444                                         const TemplateArgumentListInfo &Args,
1445                                         QualType Canon = QualType()) const;
1446
1447  TypeSourceInfo *
1448  getTemplateSpecializationTypeInfo(TemplateName TSourceLocation TLoc,
1449                                    const TemplateArgumentListInfo &Args,
1450                                    QualType Canon = QualType()) const;
1451
1452  QualType getParenType(QualType NamedTypeconst;
1453
1454  QualType getElaboratedType(ElaboratedTypeKeyword Keyword,
1455                             NestedNameSpecifier *NNSQualType NamedType,
1456                             TagDecl *OwnedTagDecl = nullptrconst;
1457  QualType getDependentNameType(ElaboratedTypeKeyword Keyword,
1458                                NestedNameSpecifier *NNS,
1459                                const IdentifierInfo *Name,
1460                                QualType Canon = QualType()) const;
1461
1462  QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword,
1463                                                  NestedNameSpecifier *NNS,
1464                                                  const IdentifierInfo *Name,
1465                                    const TemplateArgumentListInfo &Argsconst;
1466  QualType getDependentTemplateSpecializationType(
1467      ElaboratedTypeKeyword KeywordNestedNameSpecifier *NNS,
1468      const IdentifierInfo *NameArrayRef<TemplateArgumentArgsconst;
1469
1470  TemplateArgument getInjectedTemplateArg(NamedDecl *ParamDecl);
1471
1472  /// Get a template argument list with one argument per template parameter
1473  /// in a template parameter list, such as for the injected class name of
1474  /// a class template.
1475  void getInjectedTemplateArgs(const TemplateParameterList *Params,
1476                               SmallVectorImpl<TemplateArgument> &Args);
1477
1478  QualType getPackExpansionType(QualType Pattern,
1479                                Optional<unsignedNumExpansions);
1480
1481  QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl,
1482                                ObjCInterfaceDecl *PrevDecl = nullptrconst;
1483
1484  /// Legacy interface: cannot provide type arguments or __kindof.
1485  QualType getObjCObjectType(QualType Base,
1486                             ObjCProtocolDecl * const *Protocols,
1487                             unsigned NumProtocolsconst;
1488
1489  QualType getObjCObjectType(QualType Base,
1490                             ArrayRef<QualTypetypeArgs,
1491                             ArrayRef<ObjCProtocolDecl *> protocols,
1492                             bool isKindOfconst;
1493
1494  QualType getObjCTypeParamType(const ObjCTypeParamDecl *Decl,
1495                                ArrayRef<ObjCProtocolDecl *> protocols,
1496                                QualType Canonical = QualType()) const;
1497
1498  bool ObjCObjectAdoptsQTypeProtocols(QualType QTObjCInterfaceDecl *Decl);
1499
1500  /// QIdProtocolsAdoptObjCObjectProtocols - Checks that protocols in
1501  /// QT's qualified-id protocol list adopt all protocols in IDecl's list
1502  /// of protocols.
1503  bool QIdProtocolsAdoptObjCObjectProtocols(QualType QT,
1504                                            ObjCInterfaceDecl *IDecl);
1505
1506  /// Return a ObjCObjectPointerType type for the given ObjCObjectType.
1507  QualType getObjCObjectPointerType(QualType OITconst;
1508
1509  /// GCC extension.
1510  QualType getTypeOfExprType(Expr *econst;
1511  QualType getTypeOfType(QualType tconst;
1512
1513  /// C++11 decltype.
1514  QualType getDecltypeType(Expr *eQualType UnderlyingTypeconst;
1515
1516  /// Unary type transforms
1517  QualType getUnaryTransformType(QualType BaseTypeQualType UnderlyingType,
1518                                 UnaryTransformType::UTTKind UKindconst;
1519
1520  /// C++11 deduced auto type.
1521  QualType getAutoType(QualType DeducedTypeAutoTypeKeyword Keyword,
1522                       bool IsDependentconst;
1523
1524  /// C++11 deduction pattern for 'auto' type.
1525  QualType getAutoDeductType() const;
1526
1527  /// C++11 deduction pattern for 'auto &&' type.
1528  QualType getAutoRRefDeductType() const;
1529
1530  /// C++17 deduced class template specialization type.
1531  QualType getDeducedTemplateSpecializationType(TemplateName Template,
1532                                                QualType DeducedType,
1533                                                bool IsDependentconst;
1534
1535  /// Return the unique reference to the type for the specified TagDecl
1536  /// (struct/union/class/enum) decl.
1537  QualType getTagDeclType(const TagDecl *Declconst;
1538
1539  /// Return the unique type for "size_t" (C99 7.17), defined in
1540  /// <stddef.h>.
1541  ///
1542  /// The sizeof operator requires this (C99 6.5.3.4p4).
1543  CanQualType getSizeType() const;
1544
1545  /// Return the unique signed counterpart of
1546  /// the integer type corresponding to size_t.
1547  CanQualType getSignedSizeType() const;
1548
1549  /// Return the unique type for "intmax_t" (C99 7.18.1.5), defined in
1550  /// <stdint.h>.
1551  CanQualType getIntMaxType() const;
1552
1553  /// Return the unique type for "uintmax_t" (C99 7.18.1.5), defined in
1554  /// <stdint.h>.
1555  CanQualType getUIntMaxType() const;
1556
1557  /// Return the unique wchar_t type available in C++ (and available as
1558  /// __wchar_t as a Microsoft extension).
1559  QualType getWCharType() const { return WCharTy; }
1560
1561  /// Return the type of wide characters. In C++, this returns the
1562  /// unique wchar_t type. In C99, this returns a type compatible with the type
1563  /// defined in <stddef.h> as defined by the target.
1564  QualType getWideCharType() const { return WideCharTy; }
1565
1566  /// Return the type of "signed wchar_t".
1567  ///
1568  /// Used when in C++, as a GCC extension.
1569  QualType getSignedWCharType() const;
1570
1571  /// Return the type of "unsigned wchar_t".
1572  ///
1573  /// Used when in C++, as a GCC extension.
1574  QualType getUnsignedWCharType() const;
1575
1576  /// In C99, this returns a type compatible with the type
1577  /// defined in <stddef.h> as defined by the target.
1578  QualType getWIntType() const { return WIntTy; }
1579
1580  /// Return a type compatible with "intptr_t" (C99 7.18.1.4),
1581  /// as defined by the target.
1582  QualType getIntPtrType() const;
1583
1584  /// Return a type compatible with "uintptr_t" (C99 7.18.1.4),
1585  /// as defined by the target.
1586  QualType getUIntPtrType() const;
1587
1588  /// Return the unique type for "ptrdiff_t" (C99 7.17) defined in
1589  /// <stddef.h>. Pointer - pointer requires this (C99 6.5.6p9).
1590  QualType getPointerDiffType() const;
1591
1592  /// Return the unique unsigned counterpart of "ptrdiff_t"
1593  /// integer type. The standard (C11 7.21.6.1p7) refers to this type
1594  /// in the definition of %tu format specifier.
1595  QualType getUnsignedPointerDiffType() const;
1596
1597  /// Return the unique type for "pid_t" defined in
1598  /// <sys/types.h>. We need this to compute the correct type for vfork().
1599  QualType getProcessIDType() const;
1600
1601  /// Return the C structure type used to represent constant CFStrings.
1602  QualType getCFConstantStringType() const;
1603
1604  /// Returns the C struct type for objc_super
1605  QualType getObjCSuperType() const;
1606  void setObjCSuperType(QualType ST) { ObjCSuperType = ST; }
1607
1608  /// Get the structure type used to representation CFStrings, or NULL
1609  /// if it hasn't yet been built.
1610  QualType getRawCFConstantStringType() const {
1611    if (CFConstantStringTypeDecl)
1612      return getTypedefType(CFConstantStringTypeDecl);
1613    return QualType();
1614  }
1615  void setCFConstantStringType(QualType T);
1616  TypedefDecl *getCFConstantStringDecl() const;
1617  RecordDecl *getCFConstantStringTagDecl() const;
1618
1619  // This setter/getter represents the ObjC type for an NSConstantString.
1620  void setObjCConstantStringInterface(ObjCInterfaceDecl *Decl);
1621  QualType getObjCConstantStringInterface() const {
1622    return ObjCConstantStringType;
1623  }
1624
1625  QualType getObjCNSStringType() const {
1626    return ObjCNSStringType;
1627  }
1628
1629  void setObjCNSStringType(QualType T) {
1630    ObjCNSStringType = T;
1631  }
1632
1633  /// Retrieve the type that \c id has been defined to, which may be
1634  /// different from the built-in \c id if \c id has been typedef'd.
1635  QualType getObjCIdRedefinitionType() const {
1636    if (ObjCIdRedefinitionType.isNull())
1637      return getObjCIdType();
1638    return ObjCIdRedefinitionType;
1639  }
1640
1641  /// Set the user-written type that redefines \c id.
1642  void setObjCIdRedefinitionType(QualType RedefType) {
1643    ObjCIdRedefinitionType = RedefType;
1644  }
1645
1646  /// Retrieve the type that \c Class has been defined to, which may be
1647  /// different from the built-in \c Class if \c Class has been typedef'd.
1648  QualType getObjCClassRedefinitionType() const {
1649    if (ObjCClassRedefinitionType.isNull())
1650      return getObjCClassType();
1651    return ObjCClassRedefinitionType;
1652  }
1653
1654  /// Set the user-written type that redefines 'SEL'.
1655  void setObjCClassRedefinitionType(QualType RedefType) {
1656    ObjCClassRedefinitionType = RedefType;
1657  }
1658
1659  /// Retrieve the type that 'SEL' has been defined to, which may be
1660  /// different from the built-in 'SEL' if 'SEL' has been typedef'd.
1661  QualType getObjCSelRedefinitionType() const {
1662    if (ObjCSelRedefinitionType.isNull())
1663      return getObjCSelType();
1664    return ObjCSelRedefinitionType;
1665  }
1666
1667  /// Set the user-written type that redefines 'SEL'.
1668  void setObjCSelRedefinitionType(QualType RedefType) {
1669    ObjCSelRedefinitionType = RedefType;
1670  }
1671
1672  /// Retrieve the identifier 'NSObject'.
1673  IdentifierInfo *getNSObjectName() const {
1674    if (!NSObjectName) {
1675      NSObjectName = &Idents.get("NSObject");
1676    }
1677
1678    return NSObjectName;
1679  }
1680
1681  /// Retrieve the identifier 'NSCopying'.
1682  IdentifierInfo *getNSCopyingName() {
1683    if (!NSCopyingName) {
1684      NSCopyingName = &Idents.get("NSCopying");
1685    }
1686
1687    return NSCopyingName;
1688  }
1689
1690  CanQualType getNSUIntegerType() const {
1691     (0) . __assert_fail ("Target && \"Expected target to be initialized\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ASTContext.h", 1691, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Target && "Expected target to be initialized");
1692    const llvm::Triple &T = Target->getTriple();
1693    // Windows is LLP64 rather than LP64
1694    if (T.isOSWindows() && T.isArch64Bit())
1695      return UnsignedLongLongTy;
1696    return UnsignedLongTy;
1697  }
1698
1699  CanQualType getNSIntegerType() const {
1700     (0) . __assert_fail ("Target && \"Expected target to be initialized\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ASTContext.h", 1700, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Target && "Expected target to be initialized");
1701    const llvm::Triple &T = Target->getTriple();
1702    // Windows is LLP64 rather than LP64
1703    if (T.isOSWindows() && T.isArch64Bit())
1704      return LongLongTy;
1705    return LongTy;
1706  }
1707
1708  /// Retrieve the identifier 'bool'.
1709  IdentifierInfo *getBoolName() const {
1710    if (!BoolName)
1711      BoolName = &Idents.get("bool");
1712    return BoolName;
1713  }
1714
1715  IdentifierInfo *getMakeIntegerSeqName() const {
1716    if (!MakeIntegerSeqName)
1717      MakeIntegerSeqName = &Idents.get("__make_integer_seq");
1718    return MakeIntegerSeqName;
1719  }
1720
1721  IdentifierInfo *getTypePackElementName() const {
1722    if (!TypePackElementName)
1723      TypePackElementName = &Idents.get("__type_pack_element");
1724    return TypePackElementName;
1725  }
1726
1727  /// Retrieve the Objective-C "instancetype" type, if already known;
1728  /// otherwise, returns a NULL type;
1729  QualType getObjCInstanceType() {
1730    return getTypeDeclType(getObjCInstanceTypeDecl());
1731  }
1732
1733  /// Retrieve the typedef declaration corresponding to the Objective-C
1734  /// "instancetype" type.
1735  TypedefDecl *getObjCInstanceTypeDecl();
1736
1737  /// Set the type for the C FILE type.
1738  void setFILEDecl(TypeDecl *FILEDecl) { this->FILEDecl = FILEDecl; }
1739
1740  /// Retrieve the C FILE type.
1741  QualType getFILEType() const {
1742    if (FILEDecl)
1743      return getTypeDeclType(FILEDecl);
1744    return QualType();
1745  }
1746
1747  /// Set the type for the C jmp_buf type.
1748  void setjmp_bufDecl(TypeDecl *jmp_bufDecl) {
1749    this->jmp_bufDecl = jmp_bufDecl;
1750  }
1751
1752  /// Retrieve the C jmp_buf type.
1753  QualType getjmp_bufType() const {
1754    if (jmp_bufDecl)
1755      return getTypeDeclType(jmp_bufDecl);
1756    return QualType();
1757  }
1758
1759  /// Set the type for the C sigjmp_buf type.
1760  void setsigjmp_bufDecl(TypeDecl *sigjmp_bufDecl) {
1761    this->sigjmp_bufDecl = sigjmp_bufDecl;
1762  }
1763
1764  /// Retrieve the C sigjmp_buf type.
1765  QualType getsigjmp_bufType() const {
1766    if (sigjmp_bufDecl)
1767      return getTypeDeclType(sigjmp_bufDecl);
1768    return QualType();
1769  }
1770
1771  /// Set the type for the C ucontext_t type.
1772  void setucontext_tDecl(TypeDecl *ucontext_tDecl) {
1773    this->ucontext_tDecl = ucontext_tDecl;
1774  }
1775
1776  /// Retrieve the C ucontext_t type.
1777  QualType getucontext_tType() const {
1778    if (ucontext_tDecl)
1779      return getTypeDeclType(ucontext_tDecl);
1780    return QualType();
1781  }
1782
1783  /// The result type of logical operations, '<', '>', '!=', etc.
1784  QualType getLogicalOperationType() const {
1785    return getLangOpts().CPlusPlus ? BoolTy : IntTy;
1786  }
1787
1788  /// Emit the Objective-CC type encoding for the given type \p T into
1789  /// \p S.
1790  ///
1791  /// If \p Field is specified then record field names are also encoded.
1792  void getObjCEncodingForType(QualType Tstd::string &S,
1793                              const FieldDecl *Field=nullptr,
1794                              QualType *NotEncodedT=nullptrconst;
1795
1796  /// Emit the Objective-C property type encoding for the given
1797  /// type \p T into \p S.
1798  void getObjCEncodingForPropertyType(QualType Tstd::string &Sconst;
1799
1800  void getLegacyIntegralTypeEncoding(QualType &tconst;
1801
1802  /// Put the string version of the type qualifiers \p QT into \p S.
1803  void getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT,
1804                                       std::string &Sconst;
1805
1806  /// Emit the encoded type for the function \p Decl into \p S.
1807  ///
1808  /// This is in the same format as Objective-C method encodings.
1809  ///
1810  /// \returns true if an error occurred (e.g., because one of the parameter
1811  /// types is incomplete), false otherwise.
1812  std::string getObjCEncodingForFunctionDecl(const FunctionDecl *Declconst;
1813
1814  /// Emit the encoded type for the method declaration \p Decl into
1815  /// \p S.
1816  std::string getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl,
1817                                           bool Extended = falseconst;
1818
1819  /// Return the encoded type for this block declaration.
1820  std::string getObjCEncodingForBlock(const BlockExpr *blockExprconst;
1821
1822  /// getObjCEncodingForPropertyDecl - Return the encoded type for
1823  /// this method declaration. If non-NULL, Container must be either
1824  /// an ObjCCategoryImplDecl or ObjCImplementationDecl; it should
1825  /// only be NULL when getting encodings for protocol properties.
1826  std::string getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD,
1827                                             const Decl *Containerconst;
1828
1829  bool ProtocolCompatibleWithProtocol(ObjCProtocolDecl *lProto,
1830                                      ObjCProtocolDecl *rProtoconst;
1831
1832  ObjCPropertyImplDecl *getObjCPropertyImplDeclForPropertyDecl(
1833                                                  const ObjCPropertyDecl *PD,
1834                                                  const Decl *Containerconst;
1835
1836  /// Return the size of type \p T for Objective-C encoding purpose,
1837  /// in characters.
1838  CharUnits getObjCEncodingTypeSize(QualType Tconst;
1839
1840  /// Retrieve the typedef corresponding to the predefined \c id type
1841  /// in Objective-C.
1842  TypedefDecl *getObjCIdDecl() const;
1843
1844  /// Represents the Objective-CC \c id type.
1845  ///
1846  /// This is set up lazily, by Sema.  \c id is always a (typedef for a)
1847  /// pointer type, a pointer to a struct.
1848  QualType getObjCIdType() const {
1849    return getTypeDeclType(getObjCIdDecl());
1850  }
1851
1852  /// Retrieve the typedef corresponding to the predefined 'SEL' type
1853  /// in Objective-C.
1854  TypedefDecl *getObjCSelDecl() const;
1855
1856  /// Retrieve the type that corresponds to the predefined Objective-C
1857  /// 'SEL' type.
1858  QualType getObjCSelType() const {
1859    return getTypeDeclType(getObjCSelDecl());
1860  }
1861
1862  /// Retrieve the typedef declaration corresponding to the predefined
1863  /// Objective-C 'Class' type.
1864  TypedefDecl *getObjCClassDecl() const;
1865
1866  /// Represents the Objective-C \c Class type.
1867  ///
1868  /// This is set up lazily, by Sema.  \c Class is always a (typedef for a)
1869  /// pointer type, a pointer to a struct.
1870  QualType getObjCClassType() const {
1871    return getTypeDeclType(getObjCClassDecl());
1872  }
1873
1874  /// Retrieve the Objective-C class declaration corresponding to
1875  /// the predefined \c Protocol class.
1876  ObjCInterfaceDecl *getObjCProtocolDecl() const;
1877
1878  /// Retrieve declaration of 'BOOL' typedef
1879  TypedefDecl *getBOOLDecl() const {
1880    return BOOLDecl;
1881  }
1882
1883  /// Save declaration of 'BOOL' typedef
1884  void setBOOLDecl(TypedefDecl *TD) {
1885    BOOLDecl = TD;
1886  }
1887
1888  /// type of 'BOOL' type.
1889  QualType getBOOLType() const {
1890    return getTypeDeclType(getBOOLDecl());
1891  }
1892
1893  /// Retrieve the type of the Objective-C \c Protocol class.
1894  QualType getObjCProtoType() const {
1895    return getObjCInterfaceType(getObjCProtocolDecl());
1896  }
1897
1898  /// Retrieve the C type declaration corresponding to the predefined
1899  /// \c __builtin_va_list type.
1900  TypedefDecl *getBuiltinVaListDecl() const;
1901
1902  /// Retrieve the type of the \c __builtin_va_list type.
1903  QualType getBuiltinVaListType() const {
1904    return getTypeDeclType(getBuiltinVaListDecl());
1905  }
1906
1907  /// Retrieve the C type declaration corresponding to the predefined
1908  /// \c __va_list_tag type used to help define the \c __builtin_va_list type
1909  /// for some targets.
1910  Decl *getVaListTagDecl() const;
1911
1912  /// Retrieve the C type declaration corresponding to the predefined
1913  /// \c __builtin_ms_va_list type.
1914  TypedefDecl *getBuiltinMSVaListDecl() const;
1915
1916  /// Retrieve the type of the \c __builtin_ms_va_list type.
1917  QualType getBuiltinMSVaListType() const {
1918    return getTypeDeclType(getBuiltinMSVaListDecl());
1919  }
1920
1921  /// Return whether a declaration to a builtin is allowed to be
1922  /// overloaded/redeclared.
1923  bool canBuiltinBeRedeclared(const FunctionDecl *) const;
1924
1925  /// Return a type with additional \c const, \c volatile, or
1926  /// \c restrict qualifiers.
1927  QualType getCVRQualifiedType(QualType Tunsigned CVRconst {
1928    return getQualifiedType(TQualifiers::fromCVRMask(CVR));
1929  }
1930
1931  /// Un-split a SplitQualType.
1932  QualType getQualifiedType(SplitQualType splitconst {
1933    return getQualifiedType(split.Tysplit.Quals);
1934  }
1935
1936  /// Return a type with additional qualifiers.
1937  QualType getQualifiedType(QualType TQualifiers Qsconst {
1938    if (!Qs.hasNonFastQualifiers())
1939      return T.withFastQualifiers(Qs.getFastQualifiers());
1940    QualifierCollector Qc(Qs);
1941    const Type *Ptr = Qc.strip(T);
1942    return getExtQualType(PtrQc);
1943  }
1944
1945  /// Return a type with additional qualifiers.
1946  QualType getQualifiedType(const Type *TQualifiers Qsconst {
1947    if (!Qs.hasNonFastQualifiers())
1948      return QualType(TQs.getFastQualifiers());
1949    return getExtQualType(TQs);
1950  }
1951
1952  /// Return a type with the given lifetime qualifier.
1953  ///
1954  /// \pre Neither type.ObjCLifetime() nor \p lifetime may be \c OCL_None.
1955  QualType getLifetimeQualifiedType(QualType type,
1956                                    Qualifiers::ObjCLifetime lifetime) {
1957    assert(type.getObjCLifetime() == Qualifiers::OCL_None);
1958    assert(lifetime != Qualifiers::OCL_None);
1959
1960    Qualifiers qs;
1961    qs.addObjCLifetime(lifetime);
1962    return getQualifiedType(typeqs);
1963  }
1964
1965  /// getUnqualifiedObjCPointerType - Returns version of
1966  /// Objective-C pointer type with lifetime qualifier removed.
1967  QualType getUnqualifiedObjCPointerType(QualType typeconst {
1968    if (!type.getTypePtr()->isObjCObjectPointerType() ||
1969        !type.getQualifiers().hasObjCLifetime())
1970      return type;
1971    Qualifiers Qs = type.getQualifiers();
1972    Qs.removeObjCLifetime();
1973    return getQualifiedType(type.getUnqualifiedType(), Qs);
1974  }
1975
1976  unsigned char getFixedPointScale(QualType Tyconst;
1977  unsigned char getFixedPointIBits(QualType Tyconst;
1978  FixedPointSemantics getFixedPointSemantics(QualType Tyconst;
1979  APFixedPoint getFixedPointMax(QualType Tyconst;
1980  APFixedPoint getFixedPointMin(QualType Tyconst;
1981
1982  DeclarationNameInfo getNameForTemplate(TemplateName Name,
1983                                         SourceLocation NameLocconst;
1984
1985  TemplateName getOverloadedTemplateName(UnresolvedSetIterator Begin,
1986                                         UnresolvedSetIterator Endconst;
1987
1988  TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS,
1989                                        bool TemplateKeyword,
1990                                        TemplateDecl *Templateconst;
1991
1992  TemplateName getDependentTemplateName(NestedNameSpecifier *NNS,
1993                                        const IdentifierInfo *Nameconst;
1994  TemplateName getDependentTemplateName(NestedNameSpecifier *NNS,
1995                                        OverloadedOperatorKind Operatorconst;
1996  TemplateName getSubstTemplateTemplateParm(TemplateTemplateParmDecl *param,
1997                                            TemplateName replacementconst;
1998  TemplateName getSubstTemplateTemplateParmPack(TemplateTemplateParmDecl *Param,
1999                                        const TemplateArgument &ArgPackconst;
2000
2001  enum GetBuiltinTypeError {
2002    /// No error
2003    GE_None,
2004
2005    /// Missing a type
2006    GE_Missing_type,
2007
2008    /// Missing a type from <stdio.h>
2009    GE_Missing_stdio,
2010
2011    /// Missing a type from <setjmp.h>
2012    GE_Missing_setjmp,
2013
2014    /// Missing a type from <ucontext.h>
2015    GE_Missing_ucontext
2016  };
2017
2018  /// Return the type for the specified builtin.
2019  ///
2020  /// If \p IntegerConstantArgs is non-null, it is filled in with a bitmask of
2021  /// arguments to the builtin that are required to be integer constant
2022  /// expressions.
2023  QualType GetBuiltinType(unsigned IDGetBuiltinTypeError &Error,
2024                          unsigned *IntegerConstantArgs = nullptrconst;
2025
2026  /// Types and expressions required to build C++2a three-way comparisons
2027  /// using operator<=>, including the values return by builtin <=> operators.
2028  ComparisonCategories CompCategories;
2029
2030private:
2031  CanQualType getFromTargetType(unsigned Typeconst;
2032  TypeInfo getTypeInfoImpl(const Type *Tconst;
2033
2034  //===--------------------------------------------------------------------===//
2035  //                         Type Predicates.
2036  //===--------------------------------------------------------------------===//
2037
2038public:
2039  /// Return one of the GCNone, Weak or Strong Objective-C garbage
2040  /// collection attributes.
2041  Qualifiers::GC getObjCGCAttrKind(QualType Tyconst;
2042
2043  /// Return true if the given vector types are of the same unqualified
2044  /// type or if they are equivalent to the same GCC vector type.
2045  ///
2046  /// \note This ignores whether they are target-specific (AltiVec or Neon)
2047  /// types.
2048  bool areCompatibleVectorTypes(QualType FirstVecQualType SecondVec);
2049
2050  /// Return true if this is an \c NSObject object with its \c NSObject
2051  /// attribute set.
2052  static bool isObjCNSObjectType(QualType Ty) {
2053    return Ty->isObjCNSObjectType();
2054  }
2055
2056  //===--------------------------------------------------------------------===//
2057  //                         Type Sizing and Analysis
2058  //===--------------------------------------------------------------------===//
2059
2060  /// Return the APFloat 'semantics' for the specified scalar floating
2061  /// point type.
2062  const llvm::fltSemantics &getFloatTypeSemantics(QualType Tconst;
2063
2064  /// Get the size and alignment of the specified complete type in bits.
2065  TypeInfo getTypeInfo(const Type *Tconst;
2066  TypeInfo getTypeInfo(QualType Tconst { return getTypeInfo(T.getTypePtr()); }
2067
2068  /// Get default simd alignment of the specified complete type in bits.
2069  unsigned getOpenMPDefaultSimdAlign(QualType Tconst;
2070
2071  /// Return the size of the specified (complete) type \p T, in bits.
2072  uint64_t getTypeSize(QualType Tconst { return getTypeInfo(T).Width; }
2073  uint64_t getTypeSize(const Type *Tconst { return getTypeInfo(T).Width; }
2074
2075  /// Return the size of the character type, in bits.
2076  uint64_t getCharWidth() const {
2077    return getTypeSize(CharTy);
2078  }
2079
2080  /// Convert a size in bits to a size in characters.
2081  CharUnits toCharUnitsFromBits(int64_t BitSizeconst;
2082
2083  /// Convert a size in characters to a size in bits.
2084  int64_t toBits(CharUnits CharSizeconst;
2085
2086  /// Return the size of the specified (complete) type \p T, in
2087  /// characters.
2088  CharUnits getTypeSizeInChars(QualType Tconst;
2089  CharUnits getTypeSizeInChars(const Type *Tconst;
2090
2091  Optional<CharUnitsgetTypeSizeInCharsIfKnown(QualType Tyconst {
2092    if (Ty->isIncompleteType() || Ty->isDependentType())
2093      return None;
2094    return getTypeSizeInChars(Ty);
2095  }
2096
2097  Optional<CharUnitsgetTypeSizeInCharsIfKnown(const Type *Tyconst {
2098    return getTypeSizeInCharsIfKnown(QualType(Ty, 0));
2099  }
2100
2101  /// Return the ABI-specified alignment of a (complete) type \p T, in
2102  /// bits.
2103  unsigned getTypeAlign(QualType Tconst { return getTypeInfo(T).Align; }
2104  unsigned getTypeAlign(const Type *Tconst { return getTypeInfo(T).Align; }
2105
2106  /// Return the ABI-specified natural alignment of a (complete) type \p T,
2107  /// before alignment adjustments, in bits.
2108  ///
2109  /// This alignment is curently used only by ARM and AArch64 when passing
2110  /// arguments of a composite type.
2111  unsigned getTypeUnadjustedAlign(QualType Tconst {
2112    return getTypeUnadjustedAlign(T.getTypePtr());
2113  }
2114  unsigned getTypeUnadjustedAlign(const Type *Tconst;
2115
2116  /// Return the ABI-specified alignment of a type, in bits, or 0 if
2117  /// the type is incomplete and we cannot determine the alignment (for
2118  /// example, from alignment attributes).
2119  unsigned getTypeAlignIfKnown(QualType Tconst;
2120
2121  /// Return the ABI-specified alignment of a (complete) type \p T, in
2122  /// characters.
2123  CharUnits getTypeAlignInChars(QualType Tconst;
2124  CharUnits getTypeAlignInChars(const Type *Tconst;
2125
2126  /// getTypeUnadjustedAlignInChars - Return the ABI-specified alignment of a type,
2127  /// in characters, before alignment adjustments. This method does not work on
2128  /// incomplete types.
2129  CharUnits getTypeUnadjustedAlignInChars(QualType Tconst;
2130  CharUnits getTypeUnadjustedAlignInChars(const Type *Tconst;
2131
2132  // getTypeInfoDataSizeInChars - Return the size of a type, in chars. If the
2133  // type is a record, its data size is returned.
2134  std::pair<CharUnitsCharUnitsgetTypeInfoDataSizeInChars(QualType Tconst;
2135
2136  std::pair<CharUnitsCharUnitsgetTypeInfoInChars(const Type *Tconst;
2137  std::pair<CharUnitsCharUnitsgetTypeInfoInChars(QualType Tconst;
2138
2139  /// Determine if the alignment the type has was required using an
2140  /// alignment attribute.
2141  bool isAlignmentRequired(const Type *Tconst;
2142  bool isAlignmentRequired(QualType Tconst;
2143
2144  /// Return the "preferred" alignment of the specified type \p T for
2145  /// the current target, in bits.
2146  ///
2147  /// This can be different than the ABI alignment in cases where it is
2148  /// beneficial for performance to overalign a data type.
2149  unsigned getPreferredTypeAlign(const Type *Tconst;
2150
2151  /// Return the default alignment for __attribute__((aligned)) on
2152  /// this target, to be used if no alignment value is specified.
2153  unsigned getTargetDefaultAlignForAttributeAligned() const;
2154
2155  /// Return the alignment in bits that should be given to a
2156  /// global variable with type \p T.
2157  unsigned getAlignOfGlobalVar(QualType Tconst;
2158
2159  /// Return the alignment in characters that should be given to a
2160  /// global variable with type \p T.
2161  CharUnits getAlignOfGlobalVarInChars(QualType Tconst;
2162
2163  /// Return a conservative estimate of the alignment of the specified
2164  /// decl \p D.
2165  ///
2166  /// \pre \p D must not be a bitfield type, as bitfields do not have a valid
2167  /// alignment.
2168  ///
2169  /// If \p ForAlignof, references are treated like their underlying type
2170  /// and  large arrays don't get any special treatment. If not \p ForAlignof
2171  /// it computes the value expected by CodeGen: references are treated like
2172  /// pointers and large arrays get extra alignment.
2173  CharUnits getDeclAlign(const Decl *Dbool ForAlignof = falseconst;
2174
2175  /// Get or compute information about the layout of the specified
2176  /// record (struct/union/class) \p D, which indicates its size and field
2177  /// position information.
2178  const ASTRecordLayout &getASTRecordLayout(const RecordDecl *Dconst;
2179
2180  /// Get or compute information about the layout of the specified
2181  /// Objective-C interface.
2182  const ASTRecordLayout &getASTObjCInterfaceLayout(const ObjCInterfaceDecl *D)
2183    const;
2184
2185  void DumpRecordLayout(const RecordDecl *RDraw_ostream &OS,
2186                        bool Simple = falseconst;
2187
2188  /// Get or compute information about the layout of the specified
2189  /// Objective-C implementation.
2190  ///
2191  /// This may differ from the interface if synthesized ivars are present.
2192  const ASTRecordLayout &
2193  getASTObjCImplementationLayout(const ObjCImplementationDecl *Dconst;
2194
2195  /// Get our current best idea for the key function of the
2196  /// given record decl, or nullptr if there isn't one.
2197  ///
2198  /// The key function is, according to the Itanium C++ ABI section 5.2.3:
2199  ///   ...the first non-pure virtual function that is not inline at the
2200  ///   point of class definition.
2201  ///
2202  /// Other ABIs use the same idea.  However, the ARM C++ ABI ignores
2203  /// virtual functions that are defined 'inline', which means that
2204  /// the result of this computation can change.
2205  const CXXMethodDecl *getCurrentKeyFunction(const CXXRecordDecl *RD);
2206
2207  /// Observe that the given method cannot be a key function.
2208  /// Checks the key-function cache for the method's class and clears it
2209  /// if matches the given declaration.
2210  ///
2211  /// This is used in ABIs where out-of-line definitions marked
2212  /// inline are not considered to be key functions.
2213  ///
2214  /// \param method should be the declaration from the class definition
2215  void setNonKeyFunction(const CXXMethodDecl *method);
2216
2217  /// Loading virtual member pointers using the virtual inheritance model
2218  /// always results in an adjustment using the vbtable even if the index is
2219  /// zero.
2220  ///
2221  /// This is usually OK because the first slot in the vbtable points
2222  /// backwards to the top of the MDC.  However, the MDC might be reusing a
2223  /// vbptr from an nv-base.  In this case, the first slot in the vbtable
2224  /// points to the start of the nv-base which introduced the vbptr and *not*
2225  /// the MDC.  Modify the NonVirtualBaseAdjustment to account for this.
2226  CharUnits getOffsetOfBaseWithVBPtr(const CXXRecordDecl *RDconst;
2227
2228  /// Get the offset of a FieldDecl or IndirectFieldDecl, in bits.
2229  uint64_t getFieldOffset(const ValueDecl *FDconst;
2230
2231  /// Get the offset of an ObjCIvarDecl in bits.
2232  uint64_t lookupFieldBitOffset(const ObjCInterfaceDecl *OID,
2233                                const ObjCImplementationDecl *ID,
2234                                const ObjCIvarDecl *Ivarconst;
2235
2236  bool isNearlyEmpty(const CXXRecordDecl *RDconst;
2237
2238  VTableContextBase *getVTableContext();
2239
2240  /// If \p T is null pointer, assume the target in ASTContext.
2241  MangleContext *createMangleContext(const TargetInfo *T = nullptr);
2242
2243  void DeepCollectObjCIvars(const ObjCInterfaceDecl *OIbool leafClass,
2244                            SmallVectorImpl<const ObjCIvarDecl*> &Ivarsconst;
2245
2246  unsigned CountNonClassIvars(const ObjCInterfaceDecl *OIconst;
2247  void CollectInheritedProtocols(const Decl *CDecl,
2248                          llvm::SmallPtrSet<ObjCProtocolDecl*, 8> &Protocols);
2249
2250  /// Return true if the specified type has unique object representations
2251  /// according to (C++17 [meta.unary.prop]p9)
2252  bool hasUniqueObjectRepresentations(QualType Tyconst;
2253
2254  //===--------------------------------------------------------------------===//
2255  //                            Type Operators
2256  //===--------------------------------------------------------------------===//
2257
2258  /// Return the canonical (structural) type corresponding to the
2259  /// specified potentially non-canonical type \p T.
2260  ///
2261  /// The non-canonical version of a type may have many "decorated" versions of
2262  /// types.  Decorators can include typedefs, 'typeof' operators, etc. The
2263  /// returned type is guaranteed to be free of any of these, allowing two
2264  /// canonical types to be compared for exact equality with a simple pointer
2265  /// comparison.
2266  CanQualType getCanonicalType(QualType Tconst {
2267    return CanQualType::CreateUnsafe(T.getCanonicalType());
2268  }
2269
2270  const Type *getCanonicalType(const Type *Tconst {
2271    return T->getCanonicalTypeInternal().getTypePtr();
2272  }
2273
2274  /// Return the canonical parameter type corresponding to the specific
2275  /// potentially non-canonical one.
2276  ///
2277  /// Qualifiers are stripped off, functions are turned into function
2278  /// pointers, and arrays decay one level into pointers.
2279  CanQualType getCanonicalParamType(QualType Tconst;
2280
2281  /// Determine whether the given types \p T1 and \p T2 are equivalent.
2282  bool hasSameType(QualType T1QualType T2const {
2283    return getCanonicalType(T1) == getCanonicalType(T2);
2284  }
2285  bool hasSameType(const Type *T1const Type *T2const {
2286    return getCanonicalType(T1) == getCanonicalType(T2);
2287  }
2288
2289  /// Return this type as a completely-unqualified array type,
2290  /// capturing the qualifiers in \p Quals.
2291  ///
2292  /// This will remove the minimal amount of sugaring from the types, similar
2293  /// to the behavior of QualType::getUnqualifiedType().
2294  ///
2295  /// \param T is the qualified type, which may be an ArrayType
2296  ///
2297  /// \param Quals will receive the full set of qualifiers that were
2298  /// applied to the array.
2299  ///
2300  /// \returns if this is an array type, the completely unqualified array type
2301  /// that corresponds to it. Otherwise, returns T.getUnqualifiedType().
2302  QualType getUnqualifiedArrayType(QualType TQualifiers &Quals);
2303
2304  /// Determine whether the given types are equivalent after
2305  /// cvr-qualifiers have been removed.
2306  bool hasSameUnqualifiedType(QualType T1QualType T2const {
2307    return getCanonicalType(T1).getTypePtr() ==
2308           getCanonicalType(T2).getTypePtr();
2309  }
2310
2311  bool hasSameNullabilityTypeQualifier(QualType SubTQualType SuperT,
2312                                       bool IsParamconst {
2313    auto SubTnullability = SubT->getNullability(*this);
2314    auto SuperTnullability = SuperT->getNullability(*this);
2315    if (SubTnullability.hasValue() == SuperTnullability.hasValue()) {
2316      // Neither has nullability; return true
2317      if (!SubTnullability)
2318        return true;
2319      // Both have nullability qualifier.
2320      if (*SubTnullability == *SuperTnullability ||
2321          *SubTnullability == NullabilityKind::Unspecified ||
2322          *SuperTnullability == NullabilityKind::Unspecified)
2323        return true;
2324
2325      if (IsParam) {
2326        // Ok for the superclass method parameter to be "nonnull" and the subclass
2327        // method parameter to be "nullable"
2328        return (*SuperTnullability == NullabilityKind::NonNull &&
2329                *SubTnullability == NullabilityKind::Nullable);
2330      }
2331      else {
2332        // For the return type, it's okay for the superclass method to specify
2333        // "nullable" and the subclass method specify "nonnull"
2334        return (*SuperTnullability == NullabilityKind::Nullable &&
2335                *SubTnullability == NullabilityKind::NonNull);
2336      }
2337    }
2338    return true;
2339  }
2340
2341  bool ObjCMethodsAreEqual(const ObjCMethodDecl *MethodDecl,
2342                           const ObjCMethodDecl *MethodImp);
2343
2344  bool UnwrapSimilarTypes(QualType &T1QualType &T2);
2345  bool UnwrapSimilarArrayTypes(QualType &T1QualType &T2);
2346
2347  /// Determine if two types are similar, according to the C++ rules. That is,
2348  /// determine if they are the same other than qualifiers on the initial
2349  /// sequence of pointer / pointer-to-member / array (and in Clang, object
2350  /// pointer) types and their element types.
2351  ///
2352  /// Clang offers a number of qualifiers in addition to the C++ qualifiers;
2353  /// those qualifiers are also ignored in the 'similarity' check.
2354  bool hasSimilarType(QualType T1QualType T2);
2355
2356  /// Determine if two types are similar, ignoring only CVR qualifiers.
2357  bool hasCvrSimilarType(QualType T1QualType T2);
2358
2359  /// Retrieves the "canonical" nested name specifier for a
2360  /// given nested name specifier.
2361  ///
2362  /// The canonical nested name specifier is a nested name specifier
2363  /// that uniquely identifies a type or namespace within the type
2364  /// system. For example, given:
2365  ///
2366  /// \code
2367  /// namespace N {
2368  ///   struct S {
2369  ///     template<typename T> struct X { typename T* type; };
2370  ///   };
2371  /// }
2372  ///
2373  /// template<typename T> struct Y {
2374  ///   typename N::S::X<T>::type member;
2375  /// };
2376  /// \endcode
2377  ///
2378  /// Here, the nested-name-specifier for N::S::X<T>:: will be
2379  /// S::X<template-param-0-0>, since 'S' and 'X' are uniquely defined
2380  /// by declarations in the type system and the canonical type for
2381  /// the template type parameter 'T' is template-param-0-0.
2382  NestedNameSpecifier *
2383  getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNSconst;
2384
2385  /// Retrieves the default calling convention for the current target.
2386  CallingConv getDefaultCallingConvention(bool IsVariadic,
2387                                          bool IsCXXMethodconst;
2388
2389  /// Retrieves the "canonical" template name that refers to a
2390  /// given template.
2391  ///
2392  /// The canonical template name is the simplest expression that can
2393  /// be used to refer to a given template. For most templates, this
2394  /// expression is just the template declaration itself. For example,
2395  /// the template std::vector can be referred to via a variety of
2396  /// names---std::vector, \::std::vector, vector (if vector is in
2397  /// scope), etc.---but all of these names map down to the same
2398  /// TemplateDecl, which is used to form the canonical template name.
2399  ///
2400  /// Dependent template names are more interesting. Here, the
2401  /// template name could be something like T::template apply or
2402  /// std::allocator<T>::template rebind, where the nested name
2403  /// specifier itself is dependent. In this case, the canonical
2404  /// template name uses the shortest form of the dependent
2405  /// nested-name-specifier, which itself contains all canonical
2406  /// types, values, and templates.
2407  TemplateName getCanonicalTemplateName(TemplateName Nameconst;
2408
2409  /// Determine whether the given template names refer to the same
2410  /// template.
2411  bool hasSameTemplateName(TemplateName XTemplateName Y);
2412
2413  /// Retrieve the "canonical" template argument.
2414  ///
2415  /// The canonical template argument is the simplest template argument
2416  /// (which may be a type, value, expression, or declaration) that
2417  /// expresses the value of the argument.
2418  TemplateArgument getCanonicalTemplateArgument(const TemplateArgument &Arg)
2419    const;
2420
2421  /// Type Query functions.  If the type is an instance of the specified class,
2422  /// return the Type pointer for the underlying maximally pretty type.  This
2423  /// is a member of ASTContext because this may need to do some amount of
2424  /// canonicalization, e.g. to move type qualifiers into the element type.
2425  const ArrayType *getAsArrayType(QualType Tconst;
2426  const ConstantArrayType *getAsConstantArrayType(QualType Tconst {
2427    return dyn_cast_or_null<ConstantArrayType>(getAsArrayType(T));
2428  }
2429  const VariableArrayType *getAsVariableArrayType(QualType Tconst {
2430    return dyn_cast_or_null<VariableArrayType>(getAsArrayType(T));
2431  }
2432  const IncompleteArrayType *getAsIncompleteArrayType(QualType Tconst {
2433    return dyn_cast_or_null<IncompleteArrayType>(getAsArrayType(T));
2434  }
2435  const DependentSizedArrayType *getAsDependentSizedArrayType(QualType T)
2436    const {
2437    return dyn_cast_or_null<DependentSizedArrayType>(getAsArrayType(T));
2438  }
2439
2440  /// Return the innermost element type of an array type.
2441  ///
2442  /// For example, will return "int" for int[m][n]
2443  QualType getBaseElementType(const ArrayType *VATconst;
2444
2445  /// Return the innermost element type of a type (which needn't
2446  /// actually be an array type).
2447  QualType getBaseElementType(QualType QTconst;
2448
2449  /// Return number of constant array elements.
2450  uint64_t getConstantArrayElementCount(const ConstantArrayType *CAconst;
2451
2452  /// Perform adjustment on the parameter type of a function.
2453  ///
2454  /// This routine adjusts the given parameter type @p T to the actual
2455  /// parameter type used by semantic analysis (C99 6.7.5.3p[7,8],
2456  /// C++ [dcl.fct]p3). The adjusted parameter type is returned.
2457  QualType getAdjustedParameterType(QualType Tconst;
2458
2459  /// Retrieve the parameter type as adjusted for use in the signature
2460  /// of a function, decaying array and function types and removing top-level
2461  /// cv-qualifiers.
2462  QualType getSignatureParameterType(QualType Tconst;
2463
2464  QualType getExceptionObjectType(QualType Tconst;
2465
2466  /// Return the properly qualified result of decaying the specified
2467  /// array type to a pointer.
2468  ///
2469  /// This operation is non-trivial when handling typedefs etc.  The canonical
2470  /// type of \p T must be an array type, this returns a pointer to a properly
2471  /// qualified element of the array.
2472  ///
2473  /// See C99 6.7.5.3p7 and C99 6.3.2.1p3.
2474  QualType getArrayDecayedType(QualType Tconst;
2475
2476  /// Return the type that \p PromotableType will promote to: C99
2477  /// 6.3.1.1p2, assuming that \p PromotableType is a promotable integer type.
2478  QualType getPromotedIntegerType(QualType PromotableTypeconst;
2479
2480  /// Recurses in pointer/array types until it finds an Objective-C
2481  /// retainable type and returns its ownership.
2482  Qualifiers::ObjCLifetime getInnerObjCOwnership(QualType Tconst;
2483
2484  /// Whether this is a promotable bitfield reference according
2485  /// to C99 6.3.1.1p2, bullet 2 (and GCC extensions).
2486  ///
2487  /// \returns the type this bit-field will promote to, or NULL if no
2488  /// promotion occurs.
2489  QualType isPromotableBitField(Expr *Econst;
2490
2491  /// Return the highest ranked integer type, see C99 6.3.1.8p1.
2492  ///
2493  /// If \p LHS > \p RHS, returns 1.  If \p LHS == \p RHS, returns 0.  If
2494  /// \p LHS < \p RHS, return -1.
2495  int getIntegerTypeOrder(QualType LHSQualType RHSconst;
2496
2497  /// Compare the rank of the two specified floating point types,
2498  /// ignoring the domain of the type (i.e. 'double' == '_Complex double').
2499  ///
2500  /// If \p LHS > \p RHS, returns 1.  If \p LHS == \p RHS, returns 0.  If
2501  /// \p LHS < \p RHS, return -1.
2502  int getFloatingTypeOrder(QualType LHSQualType RHSconst;
2503
2504  /// Compare the rank of two floating point types as above, but compare equal
2505  /// if both types have the same floating-point semantics on the target (i.e.
2506  /// long double and double on AArch64 will return 0).
2507  int getFloatingTypeSemanticOrder(QualType LHSQualType RHSconst;
2508
2509  /// Return a real floating point or a complex type (based on
2510  /// \p typeDomain/\p typeSize).
2511  ///
2512  /// \param typeDomain a real floating point or complex type.
2513  /// \param typeSize a real floating point or complex type.
2514  QualType getFloatingTypeOfSizeWithinDomain(QualType typeSize,
2515                                             QualType typeDomainconst;
2516
2517  unsigned getTargetAddressSpace(QualType Tconst {
2518    return getTargetAddressSpace(T.getQualifiers());
2519  }
2520
2521  unsigned getTargetAddressSpace(Qualifiers Qconst {
2522    return getTargetAddressSpace(Q.getAddressSpace());
2523  }
2524
2525  unsigned getTargetAddressSpace(LangAS ASconst;
2526
2527  LangAS getLangASForBuiltinAddressSpace(unsigned ASconst;
2528
2529  /// Get target-dependent integer value for null pointer which is used for
2530  /// constant folding.
2531  uint64_t getTargetNullPointerValue(QualType QTconst;
2532
2533  bool addressSpaceMapManglingFor(LangAS ASconst {
2534    return AddrSpaceMapMangling || isTargetAddressSpace(AS);
2535  }
2536
2537private:
2538  // Helper for integer ordering
2539  unsigned getIntegerRank(const Type *Tconst;
2540
2541public:
2542  //===--------------------------------------------------------------------===//
2543  //                    Type Compatibility Predicates
2544  //===--------------------------------------------------------------------===//
2545
2546  /// Compatibility predicates used to check assignment expressions.
2547  bool typesAreCompatible(QualType T1QualType T2,
2548                          bool CompareUnqualified = false); // C99 6.2.7p1
2549
2550  bool propertyTypesAreCompatible(QualTypeQualType);
2551  bool typesAreBlockPointerCompatible(QualTypeQualType);
2552
2553  bool isObjCIdType(QualType Tconst {
2554    return T == getObjCIdType();
2555  }
2556
2557  bool isObjCClassType(QualType Tconst {
2558    return T == getObjCClassType();
2559  }
2560
2561  bool isObjCSelType(QualType Tconst {
2562    return T == getObjCSelType();
2563  }
2564
2565  bool ObjCQualifiedIdTypesAreCompatible(QualType LHSQualType RHS,
2566                                         bool ForCompare);
2567
2568  bool ObjCQualifiedClassTypesAreCompatible(QualType LHSQualType RHS);
2569
2570  // Check the safety of assignment from LHS to RHS
2571  bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT,
2572                               const ObjCObjectPointerType *RHSOPT);
2573  bool canAssignObjCInterfaces(const ObjCObjectType *LHS,
2574                               const ObjCObjectType *RHS);
2575  bool canAssignObjCInterfacesInBlockPointer(
2576                                          const ObjCObjectPointerType *LHSOPT,
2577                                          const ObjCObjectPointerType *RHSOPT,
2578                                          bool BlockReturnType);
2579  bool areComparableObjCPointerTypes(QualType LHSQualType RHS);
2580  QualType areCommonBaseCompatible(const ObjCObjectPointerType *LHSOPT,
2581                                   const ObjCObjectPointerType *RHSOPT);
2582  bool canBindObjCObjectType(QualType ToQualType From);
2583
2584  // Functions for calculating composite types
2585  QualType mergeTypes(QualTypeQualTypebool OfBlockPointer=false,
2586                      bool Unqualified = falsebool BlockReturnType = false);
2587  QualType mergeFunctionTypes(QualTypeQualTypebool OfBlockPointer=false,
2588                              bool Unqualified = false);
2589  QualType mergeFunctionParameterTypes(QualTypeQualType,
2590                                       bool OfBlockPointer = false,
2591                                       bool Unqualified = false);
2592  QualType mergeTransparentUnionType(QualTypeQualType,
2593                                     bool OfBlockPointer=false,
2594                                     bool Unqualified = false);
2595
2596  QualType mergeObjCGCQualifiers(QualTypeQualType);
2597
2598  /// This function merges the ExtParameterInfo lists of two functions. It
2599  /// returns true if the lists are compatible. The merged list is returned in
2600  /// NewParamInfos.
2601  ///
2602  /// \param FirstFnType The type of the first function.
2603  ///
2604  /// \param SecondFnType The type of the second function.
2605  ///
2606  /// \param CanUseFirst This flag is set to true if the first function's
2607  /// ExtParameterInfo list can be used as the composite list of
2608  /// ExtParameterInfo.
2609  ///
2610  /// \param CanUseSecond This flag is set to true if the second function's
2611  /// ExtParameterInfo list can be used as the composite list of
2612  /// ExtParameterInfo.
2613  ///
2614  /// \param NewParamInfos The composite list of ExtParameterInfo. The list is
2615  /// empty if none of the flags are set.
2616  ///
2617  bool mergeExtParameterInfo(
2618      const FunctionProtoType *FirstFnType,
2619      const FunctionProtoType *SecondFnType,
2620      bool &CanUseFirstbool &CanUseSecond,
2621      SmallVectorImpl<FunctionProtoType::ExtParameterInfo> &NewParamInfos);
2622
2623  void ResetObjCLayout(const ObjCContainerDecl *CD);
2624
2625  //===--------------------------------------------------------------------===//
2626  //                    Integer Predicates
2627  //===--------------------------------------------------------------------===//
2628
2629  // The width of an integer, as defined in C99 6.2.6.2. This is the number
2630  // of bits in an integer type excluding any padding bits.
2631  unsigned getIntWidth(QualType Tconst;
2632
2633  // Per C99 6.2.5p6, for every signed integer type, there is a corresponding
2634  // unsigned integer type.  This method takes a signed type, and returns the
2635  // corresponding unsigned integer type.
2636  // With the introduction of fixed point types in ISO N1169, this method also
2637  // accepts fixed point types and returns the corresponding unsigned type for
2638  // a given fixed point type.
2639  QualType getCorrespondingUnsignedType(QualType Tconst;
2640
2641  // Per ISO N1169, this method accepts fixed point types and returns the
2642  // corresponding saturated type for a given fixed point type.
2643  QualType getCorrespondingSaturatedType(QualType Tyconst;
2644
2645  // This method accepts fixed point types and returns the corresponding signed
2646  // type. Unlike getCorrespondingUnsignedType(), this only accepts unsigned
2647  // fixed point types because there are unsigned integer types like bool and
2648  // char8_t that don't have signed equivalents.
2649  QualType getCorrespondingSignedFixedPointType(QualType Tyconst;
2650
2651  //===--------------------------------------------------------------------===//
2652  //                    Integer Values
2653  //===--------------------------------------------------------------------===//
2654
2655  /// Make an APSInt of the appropriate width and signedness for the
2656  /// given \p Value and integer \p Type.
2657  llvm::APSInt MakeIntValue(uint64_t ValueQualType Typeconst {
2658    // If Type is a signed integer type larger than 64 bits, we need to be sure
2659    // to sign extend Res appropriately.
2660    llvm::APSInt Res(64, !Type->isSignedIntegerOrEnumerationType());
2661    Res = Value;
2662    unsigned Width = getIntWidth(Type);
2663    if (Width != Res.getBitWidth())
2664      return Res.extOrTrunc(Width);
2665    return Res;
2666  }
2667
2668  bool isSentinelNullExpr(const Expr *E);
2669
2670  /// Get the implementation of the ObjCInterfaceDecl \p D, or nullptr if
2671  /// none exists.
2672  ObjCImplementationDecl *getObjCImplementation(ObjCInterfaceDecl *D);
2673
2674  /// Get the implementation of the ObjCCategoryDecl \p D, or nullptr if
2675  /// none exists.
2676  ObjCCategoryImplDecl *getObjCImplementation(ObjCCategoryDecl *D);
2677
2678  /// Return true if there is at least one \@implementation in the TU.
2679  bool AnyObjCImplementation() {
2680    return !ObjCImpls.empty();
2681  }
2682
2683  /// Set the implementation of ObjCInterfaceDecl.
2684  void setObjCImplementation(ObjCInterfaceDecl *IFaceD,
2685                             ObjCImplementationDecl *ImplD);
2686
2687  /// Set the implementation of ObjCCategoryDecl.
2688  void setObjCImplementation(ObjCCategoryDecl *CatD,
2689                             ObjCCategoryImplDecl *ImplD);
2690
2691  /// Get the duplicate declaration of a ObjCMethod in the same
2692  /// interface, or null if none exists.
2693  const ObjCMethodDecl *
2694  getObjCMethodRedeclaration(const ObjCMethodDecl *MDconst;
2695
2696  void setObjCMethodRedeclaration(const ObjCMethodDecl *MD,
2697                                  const ObjCMethodDecl *Redecl);
2698
2699  /// Returns the Objective-C interface that \p ND belongs to if it is
2700  /// an Objective-C method/property/ivar etc. that is part of an interface,
2701  /// otherwise returns null.
2702  const ObjCInterfaceDecl *getObjContainingInterface(const NamedDecl *NDconst;
2703
2704  /// Set the copy inialization expression of a block var decl. \p CanThrow
2705  /// indicates whether the copy expression can throw or not.
2706  void setBlockVarCopyInit(const VarDeclVDExpr *CopyExprbool CanThrow);
2707
2708  /// Get the copy initialization expression of the VarDecl \p VD, or
2709  /// nullptr if none exists.
2710  BlockVarCopyInit getBlockVarCopyInit(const VarDeclVDconst;
2711
2712  /// Allocate an uninitialized TypeSourceInfo.
2713  ///
2714  /// The caller should initialize the memory held by TypeSourceInfo using
2715  /// the TypeLoc wrappers.
2716  ///
2717  /// \param T the type that will be the basis for type source info. This type
2718  /// should refer to how the declarator was written in source code, not to
2719  /// what type semantic analysis resolved the declarator to.
2720  ///
2721  /// \param Size the size of the type info to create, or 0 if the size
2722  /// should be calculated based on the type.
2723  TypeSourceInfo *CreateTypeSourceInfo(QualType Tunsigned Size = 0const;
2724
2725  /// Allocate a TypeSourceInfo where all locations have been
2726  /// initialized to a given location, which defaults to the empty
2727  /// location.
2728  TypeSourceInfo *
2729  getTrivialTypeSourceInfo(QualType T,
2730                           SourceLocation Loc = SourceLocation()) const;
2731
2732  /// Add a deallocation callback that will be invoked when the
2733  /// ASTContext is destroyed.
2734  ///
2735  /// \param Callback A callback function that will be invoked on destruction.
2736  ///
2737  /// \param Data Pointer data that will be provided to the callback function
2738  /// when it is called.
2739  void AddDeallocation(void (*Callback)(void*), void *Data);
2740
2741  /// If T isn't trivially destructible, calls AddDeallocation to register it
2742  /// for destruction.
2743  template <typename T>
2744  void addDestruction(T *Ptr) {
2745    if (!std::is_trivially_destructible<T>::value) {
2746      auto DestroyPtr = [](void *V) { static_cast<T *>(V)->~T(); };
2747      AddDeallocation(DestroyPtrPtr);
2748    }
2749  }
2750
2751  GVALinkage GetGVALinkageForFunction(const FunctionDecl *FDconst;
2752  GVALinkage GetGVALinkageForVariable(const VarDecl *VD);
2753
2754  /// Determines if the decl can be CodeGen'ed or deserialized from PCH
2755  /// lazily, only when used; this is only relevant for function or file scoped
2756  /// var definitions.
2757  ///
2758  /// \returns true if the function/var must be CodeGen'ed/deserialized even if
2759  /// it is not used.
2760  bool DeclMustBeEmitted(const Decl *D);
2761
2762  /// Visits all versions of a multiversioned function with the passed
2763  /// predicate.
2764  void forEachMultiversionedFunctionVersion(
2765      const FunctionDecl *FD,
2766      llvm::function_ref<void(FunctionDecl *)> Predconst;
2767
2768  const CXXConstructorDecl *
2769  getCopyConstructorForExceptionObject(CXXRecordDecl *RD);
2770
2771  void addCopyConstructorForExceptionObject(CXXRecordDecl *RD,
2772                                            CXXConstructorDecl *CD);
2773
2774  void addTypedefNameForUnnamedTagDecl(TagDecl *TDTypedefNameDecl *TND);
2775
2776  TypedefNameDecl *getTypedefNameForUnnamedTagDecl(const TagDecl *TD);
2777
2778  void addDeclaratorForUnnamedTagDecl(TagDecl *TDDeclaratorDecl *DD);
2779
2780  DeclaratorDecl *getDeclaratorForUnnamedTagDecl(const TagDecl *TD);
2781
2782  void setManglingNumber(const NamedDecl *NDunsigned Number);
2783  unsigned getManglingNumber(const NamedDecl *NDconst;
2784
2785  void setStaticLocalNumber(const VarDecl *VDunsigned Number);
2786  unsigned getStaticLocalNumber(const VarDecl *VDconst;
2787
2788  /// Retrieve the context for computing mangling numbers in the given
2789  /// DeclContext.
2790  MangleNumberingContext &getManglingNumberContext(const DeclContext *DC);
2791
2792  std::unique_ptr<MangleNumberingContextcreateMangleNumberingContext() const;
2793
2794  /// Used by ParmVarDecl to store on the side the
2795  /// index of the parameter when it exceeds the size of the normal bitfield.
2796  void setParameterIndex(const ParmVarDecl *Dunsigned index);
2797
2798  /// Used by ParmVarDecl to retrieve on the side the
2799  /// index of the parameter when it exceeds the size of the normal bitfield.
2800  unsigned getParameterIndex(const ParmVarDecl *Dconst;
2801
2802  /// Get the storage for the constant value of a materialized temporary
2803  /// of static storage duration.
2804  APValue *getMaterializedTemporaryValue(const MaterializeTemporaryExpr *E,
2805                                         bool MayCreate);
2806
2807  //===--------------------------------------------------------------------===//
2808  //                    Statistics
2809  //===--------------------------------------------------------------------===//
2810
2811  /// The number of implicitly-declared default constructors.
2812  unsigned NumImplicitDefaultConstructors = 0;
2813
2814  /// The number of implicitly-declared default constructors for
2815  /// which declarations were built.
2816  unsigned NumImplicitDefaultConstructorsDeclared = 0;
2817
2818  /// The number of implicitly-declared copy constructors.
2819  unsigned NumImplicitCopyConstructors = 0;
2820
2821  /// The number of implicitly-declared copy constructors for
2822  /// which declarations were built.
2823  unsigned NumImplicitCopyConstructorsDeclared = 0;
2824
2825  /// The number of implicitly-declared move constructors.
2826  unsigned NumImplicitMoveConstructors = 0;
2827
2828  /// The number of implicitly-declared move constructors for
2829  /// which declarations were built.
2830  unsigned NumImplicitMoveConstructorsDeclared = 0;
2831
2832  /// The number of implicitly-declared copy assignment operators.
2833  unsigned NumImplicitCopyAssignmentOperators = 0;
2834
2835  /// The number of implicitly-declared copy assignment operators for
2836  /// which declarations were built.
2837  unsigned NumImplicitCopyAssignmentOperatorsDeclared = 0;
2838
2839  /// The number of implicitly-declared move assignment operators.
2840  unsigned NumImplicitMoveAssignmentOperators = 0;
2841
2842  /// The number of implicitly-declared move assignment operators for
2843  /// which declarations were built.
2844  unsigned NumImplicitMoveAssignmentOperatorsDeclared = 0;
2845
2846  /// The number of implicitly-declared destructors.
2847  unsigned NumImplicitDestructors = 0;
2848
2849  /// The number of implicitly-declared destructors for which
2850  /// declarations were built.
2851  unsigned NumImplicitDestructorsDeclared = 0;
2852
2853public:
2854  /// Initialize built-in types.
2855  ///
2856  /// This routine may only be invoked once for a given ASTContext object.
2857  /// It is normally invoked after ASTContext construction.
2858  ///
2859  /// \param Target The target
2860  void InitBuiltinTypes(const TargetInfo &Target,
2861                        const TargetInfo *AuxTarget = nullptr);
2862
2863private:
2864  void InitBuiltinType(CanQualType &RBuiltinType::Kind K);
2865
2866  // Return the Objective-C type encoding for a given type.
2867  void getObjCEncodingForTypeImpl(QualType tstd::string &S,
2868                                  bool ExpandPointedToStructures,
2869                                  bool ExpandStructures,
2870                                  const FieldDecl *Field,
2871                                  bool OutermostType = false,
2872                                  bool EncodingProperty = false,
2873                                  bool StructField = false,
2874                                  bool EncodeBlockParameters = false,
2875                                  bool EncodeClassNames = false,
2876                                  bool EncodePointerToObjCTypedef = false,
2877                                  QualType *NotEncodedT=nullptrconst;
2878
2879  // Adds the encoding of the structure's members.
2880  void getObjCEncodingForStructureImpl(RecordDecl *RDstd::string &S,
2881                                       const FieldDecl *Field,
2882                                       bool includeVBases = true,
2883                                       QualType *NotEncodedT=nullptrconst;
2884
2885public:
2886  // Adds the encoding of a method parameter or return type.
2887  void getObjCEncodingForMethodParameter(Decl::ObjCDeclQualifier QT,
2888                                         QualType Tstd::stringS,
2889                                         bool Extendedconst;
2890
2891  /// Returns true if this is an inline-initialized static data member
2892  /// which is treated as a definition for MSVC compatibility.
2893  bool isMSStaticDataMemberInlineDefinition(const VarDecl *VDconst;
2894
2895  enum class InlineVariableDefinitionKind {
2896    /// Not an inline variable.
2897    None,
2898
2899    /// Weak definition of inline variable.
2900    Weak,
2901
2902    /// Weak for now, might become strong later in this TU.
2903    WeakUnknown,
2904
2905    /// Strong definition.
2906    Strong
2907  };
2908
2909  /// Determine whether a definition of this inline variable should
2910  /// be treated as a weak or strong definition. For compatibility with
2911  /// C++14 and before, for a constexpr static data member, if there is an
2912  /// out-of-line declaration of the member, we may promote it from weak to
2913  /// strong.
2914  InlineVariableDefinitionKind
2915  getInlineVariableDefinitionKind(const VarDecl *VDconst;
2916
2917private:
2918  friend class DeclarationNameTable;
2919  friend class DeclContext;
2920
2921  const ASTRecordLayout &
2922  getObjCLayout(const ObjCInterfaceDecl *D,
2923                const ObjCImplementationDecl *Implconst;
2924
2925  /// A set of deallocations that should be performed when the
2926  /// ASTContext is destroyed.
2927  // FIXME: We really should have a better mechanism in the ASTContext to
2928  // manage running destructors for types which do variable sized allocation
2929  // within the AST. In some places we thread the AST bump pointer allocator
2930  // into the datastructures which avoids this mess during deallocation but is
2931  // wasteful of memory, and here we require a lot of error prone book keeping
2932  // in order to track and run destructors while we're tearing things down.
2933  using DeallocationFunctionsAndArguments =
2934      llvm::SmallVector<std::pair<void (*)(void *), void *>, 16>;
2935  DeallocationFunctionsAndArguments Deallocations;
2936
2937  // FIXME: This currently contains the set of StoredDeclMaps used
2938  // by DeclContext objects.  This probably should not be in ASTContext,
2939  // but we include it here so that ASTContext can quickly deallocate them.
2940  llvm::PointerIntPair<StoredDeclsMap *, 1LastSDM;
2941
2942  std::vector<Decl *> TraversalScope;
2943  class ParentMap;
2944  std::unique_ptr<ParentMapParents;
2945
2946  std::unique_ptr<VTableContextBaseVTContext;
2947
2948  void ReleaseDeclContextMaps();
2949
2950public:
2951  enum PragmaSectionFlag : unsigned {
2952    PSF_None = 0,
2953    PSF_Read = 0x1,
2954    PSF_Write = 0x2,
2955    PSF_Execute = 0x4,
2956    PSF_Implicit = 0x8,
2957    PSF_Invalid = 0x80000000U,
2958  };
2959
2960  struct SectionInfo {
2961    DeclaratorDecl *Decl;
2962    SourceLocation PragmaSectionLocation;
2963    int SectionFlags;
2964
2965    SectionInfo() = default;
2966    SectionInfo(DeclaratorDecl *Decl,
2967                SourceLocation PragmaSectionLocation,
2968                int SectionFlags)
2969        : Decl(Decl), PragmaSectionLocation(PragmaSectionLocation),
2970          SectionFlags(SectionFlags) {}
2971  };
2972
2973  llvm::StringMap<SectionInfo> SectionInfos;
2974};
2975
2976/// Utility function for constructing a nullary selector.
2977inline Selector GetNullarySelector(StringRef nameASTContext &Ctx) {
2978  IdentifierInfoII = &Ctx.Idents.get(name);
2979  return Ctx.Selectors.getSelector(0, &II);
2980}
2981
2982/// Utility function for constructing an unary selector.
2983inline Selector GetUnarySelector(StringRef nameASTContext &Ctx) {
2984  IdentifierInfoII = &Ctx.Idents.get(name);
2985  return Ctx.Selectors.getSelector(1, &II);
2986}
2987
2988// namespace clang
2989
2990// operator new and delete aren't allowed inside namespaces.
2991
2992/// Placement new for using the ASTContext's allocator.
2993///
2994/// This placement form of operator new uses the ASTContext's allocator for
2995/// obtaining memory.
2996///
2997/// IMPORTANT: These are also declared in clang/AST/ASTContextAllocate.h!
2998/// Any changes here need to also be made there.
2999///
3000/// We intentionally avoid using a nothrow specification here so that the calls
3001/// to this operator will not perform a null check on the result -- the
3002/// underlying allocator never returns null pointers.
3003///
3004/// Usage looks like this (assuming there's an ASTContext 'Context' in scope):
3005/// @code
3006/// // Default alignment (8)
3007/// IntegerLiteral *Ex = new (Context) IntegerLiteral(arguments);
3008/// // Specific alignment
3009/// IntegerLiteral *Ex2 = new (Context, 4) IntegerLiteral(arguments);
3010/// @endcode
3011/// Memory allocated through this placement new operator does not need to be
3012/// explicitly freed, as ASTContext will free all of this memory when it gets
3013/// destroyed. Please note that you cannot use delete on the pointer.
3014///
3015/// @param Bytes The number of bytes to allocate. Calculated by the compiler.
3016/// @param C The ASTContext that provides the allocator.
3017/// @param Alignment The alignment of the allocated memory (if the underlying
3018///                  allocator supports it).
3019/// @return The allocated memory. Could be nullptr.
3020inline void *operator new(size_t Bytesconst clang::ASTContext &C,
3021                          size_t Alignment /* = 8 */) {
3022  return C.Allocate(Bytes, Alignment);
3023}
3024
3025/// Placement delete companion to the new above.
3026///
3027/// This operator is just a companion to the new above. There is no way of
3028/// invoking it directly; see the new operator for more details. This operator
3029/// is called implicitly by the compiler if a placement new expression using
3030/// the ASTContext throws in the object constructor.
3031inline void operator delete(void *Ptrconst clang::ASTContext &C, size_t) {
3032  C.Deallocate(Ptr);
3033}
3034
3035/// This placement form of operator new[] uses the ASTContext's allocator for
3036/// obtaining memory.
3037///
3038/// We intentionally avoid using a nothrow specification here so that the calls
3039/// to this operator will not perform a null check on the result -- the
3040/// underlying allocator never returns null pointers.
3041///
3042/// Usage looks like this (assuming there's an ASTContext 'Context' in scope):
3043/// @code
3044/// // Default alignment (8)
3045/// char *data = new (Context) char[10];
3046/// // Specific alignment
3047/// char *data = new (Context, 4) char[10];
3048/// @endcode
3049/// Memory allocated through this placement new[] operator does not need to be
3050/// explicitly freed, as ASTContext will free all of this memory when it gets
3051/// destroyed. Please note that you cannot use delete on the pointer.
3052///
3053/// @param Bytes The number of bytes to allocate. Calculated by the compiler.
3054/// @param C The ASTContext that provides the allocator.
3055/// @param Alignment The alignment of the allocated memory (if the underlying
3056///                  allocator supports it).
3057/// @return The allocated memory. Could be nullptr.
3058inline void *operator new[](size_t Bytesconst clang::ASTContextC,
3059                            size_t Alignment /* = 8 */) {
3060  return C.Allocate(Bytes, Alignment);
3061}
3062
3063/// Placement delete[] companion to the new[] above.
3064///
3065/// This operator is just a companion to the new[] above. There is no way of
3066/// invoking it directly; see the new[] operator for more details. This operator
3067/// is called implicitly by the compiler if a placement new[] expression using
3068/// the ASTContext throws in the object constructor.
3069inline void operator delete[](void *Ptrconst clang::ASTContext &C, size_t) {
3070  C.Deallocate(Ptr);
3071}
3072
3073/// Create the representation of a LazyGenerationalUpdatePtr.
3074template <typename Owner, typename T,
3075          void (clang::ExternalASTSource::*Update)(Owner)>
3076typename clang::LazyGenerationalUpdatePtr<Owner, T, Update>::ValueType
3077    clang::LazyGenerationalUpdatePtr<Owner, T, Update>::makeValue(
3078        const clang::ASTContext &Ctx, T Value) {
3079  // Note, this is implemented here so that ExternalASTSource.h doesn't need to
3080  // include ASTContext.h. We explicitly instantiate it for all relevant types
3081  // in ASTContext.cpp.
3082  if (auto *Source = Ctx.getExternalSource())
3083    return new (CtxLazyData(SourceValue);
3084  return Value;
3085}
3086
3087#endif // LLVM_CLANG_AST_ASTCONTEXT_H
3088
clang::TypeInfo::Width
clang::TypeInfo::Align
clang::TypeInfo::AlignIsRequired
clang::ASTContext::BlockVarCopyInit
clang::ASTContext::BlockVarCopyInit::setExprAndFlag
clang::ASTContext::BlockVarCopyInit::getCopyExpr
clang::ASTContext::BlockVarCopyInit::canThrow
clang::ASTContext::BlockVarCopyInit::ExprAndFlag
clang::ASTContext::Types
clang::ASTContext::ExtQualNodes
clang::ASTContext::ComplexTypes
clang::ASTContext::PointerTypes
clang::ASTContext::AdjustedTypes
clang::ASTContext::BlockPointerTypes
clang::ASTContext::LValueReferenceTypes
clang::ASTContext::RValueReferenceTypes
clang::ASTContext::MemberPointerTypes
clang::ASTContext::ConstantArrayTypes
clang::ASTContext::IncompleteArrayTypes
clang::ASTContext::VariableArrayTypes
clang::ASTContext::DependentSizedArrayTypes
clang::ASTContext::DependentSizedExtVectorTypes
clang::ASTContext::DependentAddressSpaceTypes
clang::ASTContext::VectorTypes
clang::ASTContext::DependentVectorTypes
clang::ASTContext::FunctionNoProtoTypes
clang::ASTContext::FunctionProtoTypes
clang::ASTContext::DependentTypeOfExprTypes
clang::ASTContext::DependentDecltypeTypes
clang::ASTContext::TemplateTypeParmTypes
clang::ASTContext::ObjCTypeParamTypes
clang::ASTContext::SubstTemplateTypeParmTypes
clang::ASTContext::SubstTemplateTypeParmPackTypes
clang::ASTContext::TemplateSpecializationTypes
clang::ASTContext::ParenTypes
clang::ASTContext::ElaboratedTypes
clang::ASTContext::DependentNameTypes
clang::ASTContext::DependentTemplateSpecializationTypes
clang::ASTContext::PackExpansionTypes
clang::ASTContext::ObjCObjectTypes
clang::ASTContext::ObjCObjectPointerTypes
clang::ASTContext::DependentUnaryTransformTypes
clang::ASTContext::AutoTypes
clang::ASTContext::DeducedTemplateSpecializationTypes
clang::ASTContext::AtomicTypes
clang::ASTContext::AttributedTypes
clang::ASTContext::PipeTypes
clang::ASTContext::QualifiedTemplateNames
clang::ASTContext::DependentTemplateNames
clang::ASTContext::SubstTemplateTemplateParms
clang::ASTContext::SubstTemplateTemplateParmPacks
clang::ASTContext::NestedNameSpecifiers
clang::ASTContext::GlobalNestedNameSpecifier
clang::ASTContext::ASTRecordLayouts
clang::ASTContext::ObjCLayouts
clang::ASTContext::MemoizedTypeInfo
clang::ASTContext::MemoizedUnadjustedAlign
clang::ASTContext::KeyFunctions
clang::ASTContext::ObjCImpls
clang::ASTContext::ObjCMethodRedecls
clang::ASTContext::BlockVarCopyInits
clang::ASTContext::ClassScopeSpecializationPattern
clang::ASTContext::MaterializedTemporaryValues
clang::ASTContext::CanonicalTemplateTemplateParm
clang::ASTContext::CanonicalTemplateTemplateParm::Parm
clang::ASTContext::CanonicalTemplateTemplateParm::getParam
clang::ASTContext::CanonicalTemplateTemplateParm::Profile
clang::ASTContext::CanonicalTemplateTemplateParm::Profile
clang::ASTContext::CanonTemplateTemplateParms
clang::ASTContext::getCanonicalTemplateTemplateParmDecl
clang::ASTContext::Int128Decl
clang::ASTContext::UInt128Decl
clang::ASTContext::BuiltinVaListDecl
clang::ASTContext::BuiltinMSVaListDecl
clang::ASTContext::ObjCIdDecl
clang::ASTContext::ObjCSelDecl
clang::ASTContext::ObjCClassDecl
clang::ASTContext::ObjCProtocolClassDecl
clang::ASTContext::BOOLDecl
clang::ASTContext::ObjCIdRedefinitionType
clang::ASTContext::ObjCClassRedefinitionType
clang::ASTContext::ObjCSelRedefinitionType
clang::ASTContext::BoolName
clang::ASTContext::NSObjectName
clang::ASTContext::NSCopyingName
clang::ASTContext::MakeIntegerSeqName
clang::ASTContext::TypePackElementName
clang::ASTContext::ObjCConstantStringType
clang::ASTContext::CFConstantStringTagDecl
clang::ASTContext::CFConstantStringTypeDecl
clang::ASTContext::ObjCSuperType
clang::ASTContext::ObjCNSStringType
clang::ASTContext::ObjCInstanceTypeDecl
clang::ASTContext::FILEDecl
clang::ASTContext::jmp_bufDecl
clang::ASTContext::sigjmp_bufDecl
clang::ASTContext::ucontext_tDecl
clang::ASTContext::BlockDescriptorType
clang::ASTContext::BlockDescriptorExtendedType
clang::ASTContext::cudaConfigureCallDecl
clang::ASTContext::DeclAttrs
clang::ASTContext::MergedDecls
clang::ASTContext::PerModuleInitializers
clang::ASTContext::PerModuleInitializers::Initializers
clang::ASTContext::PerModuleInitializers::LazyInitializers
clang::ASTContext::PerModuleInitializers::resolve
clang::ASTContext::ModuleInitializers
clang::ASTContext::this_
clang::ASTContext::TemplateOrInstantiation
clang::ASTContext::InstantiatedFromUsingDecl
clang::ASTContext::InstantiatedFromUsingShadowDecl
clang::ASTContext::InstantiatedFromUnnamedFieldDecl
clang::ASTContext::OverriddenMethods
clang::ASTContext::MangleNumberingContexts
clang::ASTContext::MangleNumbers
clang::ASTContext::StaticLocalNumbers
clang::ASTContext::ParamIndices
clang::ASTContext::FirstLocalImport
clang::ASTContext::LastLocalImport
clang::ASTContext::TUDecl
clang::ASTContext::ExternCContext
clang::ASTContext::MakeIntegerSeqDecl
clang::ASTContext::TypePackElementDecl
clang::ASTContext::SourceMgr
clang::ASTContext::LangOpts
clang::ASTContext::SanitizerBL
clang::ASTContext::XRayFilter
clang::ASTContext::BumpAlloc
clang::ASTContext::DiagAllocator
clang::ASTContext::ABI
clang::ASTContext::createCXXABI
clang::ASTContext::AddrSpaceMap
clang::ASTContext::AddrSpaceMapMangling
clang::ASTContext::Target
clang::ASTContext::AuxTarget
clang::ASTContext::PrintingPolicy
clang::ASTContext::Idents
clang::ASTContext::Selectors
clang::ASTContext::BuiltinInfo
clang::ASTContext::DeclarationNames
clang::ASTContext::ExternalSource
clang::ASTContext::Listener
clang::ASTContext::DynTypedNodeList
clang::ASTContext::DynTypedNodeList::Storage
clang::ASTContext::DynTypedNodeList::IsSingleNode
clang::ASTContext::DynTypedNodeList::begin
clang::ASTContext::DynTypedNodeList::end
clang::ASTContext::DynTypedNodeList::size
clang::ASTContext::DynTypedNodeList::empty
clang::ASTContext::getTraversalScope
clang::ASTContext::setTraversalScope
clang::ASTContext::getParents
clang::ASTContext::getParents
clang::ASTContext::getPrintingPolicy
clang::ASTContext::setPrintingPolicy
clang::ASTContext::getSourceManager
clang::ASTContext::getSourceManager
clang::ASTContext::getAllocator
clang::ASTContext::Allocate
clang::ASTContext::Allocate
clang::ASTContext::Deallocate
clang::ASTContext::getASTAllocatedMemory
clang::ASTContext::getSideTableAllocatedMemory
clang::ASTContext::getDiagAllocator
clang::ASTContext::getTargetInfo
clang::ASTContext::getAuxTargetInfo
clang::ASTContext::getIntTypeForBitwidth
clang::ASTContext::getRealTypeForBitwidth
clang::ASTContext::AtomicUsesUnsupportedLibcall
clang::ASTContext::getLangOpts
clang::ASTContext::getSanitizerBlacklist
clang::ASTContext::getXRayFilter
clang::ASTContext::getDiagnostics
clang::ASTContext::getFullLoc
clang::ASTContext::Comments
clang::ASTContext::CommentsLoaded
clang::ASTContext::RawCommentAndCacheFlags
clang::ASTContext::RawCommentAndCacheFlags::Kind
clang::ASTContext::RawCommentAndCacheFlags::getKind
clang::ASTContext::RawCommentAndCacheFlags::OriginalDecl
clang::ASTContext::RedeclComments
clang::ASTContext::ParsedComments
clang::ASTContext::getRawCommentForDeclNoCache
clang::ASTContext::getRawCommentList
clang::ASTContext::addComment
clang::ASTContext::getRawCommentForAnyRedecl
clang::ASTContext::getCommentForDecl
clang::ASTContext::getLocalCommentForDeclUncached
clang::ASTContext::cloneFullComment
clang::ASTContext::CommentCommandTraits
clang::ASTContext::import_iterator
clang::ASTContext::import_iterator::Import
clang::ASTContext::getCommentCommandTraits
clang::ASTContext::getDeclAttrs
clang::ASTContext::eraseDeclAttrs
clang::ASTContext::getInstantiatedFromStaticDataMember
clang::ASTContext::getTemplateOrSpecializationInfo
clang::ASTContext::getClassScopeSpecializationPattern
clang::ASTContext::setClassScopeSpecializationPattern
clang::ASTContext::setInstantiatedFromStaticDataMember
clang::ASTContext::setTemplateOrSpecializationInfo
clang::ASTContext::getInstantiatedFromUsingDecl
clang::ASTContext::setInstantiatedFromUsingDecl
clang::ASTContext::setInstantiatedFromUsingShadowDecl
clang::ASTContext::getInstantiatedFromUsingShadowDecl
clang::ASTContext::getInstantiatedFromUnnamedFieldDecl
clang::ASTContext::setInstantiatedFromUnnamedFieldDecl
clang::ASTContext::overridden_methods_begin
clang::ASTContext::overridden_methods_end
clang::ASTContext::overridden_methods_size
clang::ASTContext::overridden_methods
clang::ASTContext::addOverriddenMethod
clang::ASTContext::getOverriddenMethods
clang::ASTContext::addedLocalImportDecl
clang::ASTContext::getNextLocalImport
clang::ASTContext::local_imports
clang::ASTContext::getPrimaryMergedDecl
clang::ASTContext::setPrimaryMergedDecl
clang::ASTContext::mergeDefinitionIntoModule
clang::ASTContext::deduplicateMergedDefinitonsFor
clang::ASTContext::getModulesWithMergedDefinition
clang::ASTContext::addModuleInitializer
clang::ASTContext::addLazyModuleInitializers
clang::ASTContext::getModuleInitializers
clang::ASTContext::getTranslationUnitDecl
clang::ASTContext::getExternCContextDecl
clang::ASTContext::getMakeIntegerSeqDecl
clang::ASTContext::getTypePackElementDecl
clang::ASTContext::VoidTy
clang::ASTContext::BoolTy
clang::ASTContext::CharTy
clang::ASTContext::WCharTy
clang::ASTContext::WideCharTy
clang::ASTContext::WIntTy
clang::ASTContext::Char8Ty
clang::ASTContext::Char16Ty
clang::ASTContext::Char32Ty
clang::ASTContext::SignedCharTy
clang::ASTContext::ShortTy
clang::ASTContext::IntTy
clang::ASTContext::LongTy
clang::ASTContext::LongLongTy
clang::ASTContext::Int128Ty
clang::ASTContext::UnsignedCharTy
clang::ASTContext::UnsignedShortTy
clang::ASTContext::UnsignedIntTy
clang::ASTContext::UnsignedLongTy
clang::ASTContext::UnsignedLongLongTy
clang::ASTContext::UnsignedInt128Ty
clang::ASTContext::FloatTy
clang::ASTContext::DoubleTy
clang::ASTContext::LongDoubleTy
clang::ASTContext::Float128Ty
clang::ASTContext::ShortAccumTy
clang::ASTContext::AccumTy
clang::ASTContext::LongAccumTy
clang::ASTContext::UnsignedShortAccumTy
clang::ASTContext::UnsignedAccumTy
clang::ASTContext::UnsignedLongAccumTy
clang::ASTContext::ShortFractTy
clang::ASTContext::FractTy
clang::ASTContext::LongFractTy
clang::ASTContext::UnsignedShortFractTy
clang::ASTContext::UnsignedFractTy
clang::ASTContext::UnsignedLongFractTy
clang::ASTContext::SatShortAccumTy
clang::ASTContext::SatAccumTy
clang::ASTContext::SatLongAccumTy
clang::ASTContext::SatUnsignedShortAccumTy
clang::ASTContext::SatUnsignedAccumTy
clang::ASTContext::SatUnsignedLongAccumTy
clang::ASTContext::SatShortFractTy
clang::ASTContext::SatFractTy
clang::ASTContext::SatLongFractTy
clang::ASTContext::SatUnsignedShortFractTy
clang::ASTContext::SatUnsignedFractTy
clang::ASTContext::SatUnsignedLongFractTy
clang::ASTContext::HalfTy
clang::ASTContext::Float16Ty
clang::ASTContext::FloatComplexTy
clang::ASTContext::DoubleComplexTy
clang::ASTContext::LongDoubleComplexTy
clang::ASTContext::Float128ComplexTy
clang::ASTContext::VoidPtrTy
clang::ASTContext::NullPtrTy
clang::ASTContext::DependentTy
clang::ASTContext::OverloadTy
clang::ASTContext::BoundMemberTy
clang::ASTContext::UnknownAnyTy
clang::ASTContext::BuiltinFnTy
clang::ASTContext::PseudoObjectTy
clang::ASTContext::ARCUnbridgedCastTy
clang::ASTContext::ObjCBuiltinIdTy
clang::ASTContext::ObjCBuiltinClassTy
clang::ASTContext::ObjCBuiltinSelTy
clang::ASTContext::ObjCBuiltinBoolTy
clang::ASTContext::OCLSamplerTy
clang::ASTContext::OCLEventTy
clang::ASTContext::OCLClkEventTy
clang::ASTContext::OCLQueueTy
clang::ASTContext::OCLReserveIDTy
clang::ASTContext::OMPArraySectionTy
clang::ASTContext::AutoDeductTy
clang::ASTContext::AutoRRefDeductTy
clang::ASTContext::VaListTagDecl
clang::ASTContext::setExternalSource
clang::ASTContext::getExternalSource
clang::ASTContext::setASTMutationListener
clang::ASTContext::getASTMutationListener
clang::ASTContext::PrintStats
clang::ASTContext::getTypes
clang::ASTContext::buildBuiltinTemplateDecl
clang::ASTContext::buildImplicitRecord
clang::ASTContext::buildImplicitTypedef
clang::ASTContext::getInt128Decl
clang::ASTContext::getUInt128Decl
clang::ASTContext::getExtQualType
clang::ASTContext::getTypeDeclTypeSlow
clang::ASTContext::getPipeType
clang::ASTContext::getAddrSpaceQualType
clang::ASTContext::removeAddrSpaceQualType
clang::ASTContext::applyObjCProtocolQualifiers
clang::ASTContext::getObjCGCQualType
clang::ASTContext::getRestrictType
clang::ASTContext::getVolatileType
clang::ASTContext::getConstType
clang::ASTContext::adjustFunctionType
clang::ASTContext::getCanonicalFunctionResultType
clang::ASTContext::adjustDeducedFunctionResultType
clang::ASTContext::getFunctionTypeWithExceptionSpec
clang::ASTContext::hasSameFunctionTypeIgnoringExceptionSpec
clang::ASTContext::adjustExceptionSpec
clang::ASTContext::getComplexType
clang::ASTContext::getComplexType
clang::ASTContext::getPointerType
clang::ASTContext::getPointerType
clang::ASTContext::getAdjustedType
clang::ASTContext::getAdjustedType
clang::ASTContext::getDecayedType
clang::ASTContext::getDecayedType
clang::ASTContext::getAtomicType
clang::ASTContext::getBlockPointerType
clang::ASTContext::getBlockDescriptorType
clang::ASTContext::getReadPipeType
clang::ASTContext::getWritePipeType
clang::ASTContext::getBlockDescriptorExtendedType
clang::ASTContext::getOpenCLTypeKind
clang::ASTContext::getOpenCLTypeAddrSpace
clang::ASTContext::setcudaConfigureCallDecl
clang::ASTContext::getcudaConfigureCallDecl
clang::ASTContext::BlockRequiresCopying
clang::ASTContext::getByrefLifetime
clang::ASTContext::getLValueReferenceType
clang::ASTContext::getRValueReferenceType
clang::ASTContext::getMemberPointerType
clang::ASTContext::getVariableArrayType
clang::ASTContext::getDependentSizedArrayType
clang::ASTContext::getIncompleteArrayType
clang::ASTContext::getConstantArrayType
clang::ASTContext::getVariableArrayDecayedType
clang::ASTContext::getVectorType
clang::ASTContext::getDependentVectorType
clang::ASTContext::getExtVectorType
clang::ASTContext::getDependentSizedExtVectorType
clang::ASTContext::getDependentAddressSpaceType
clang::ASTContext::getFunctionNoProtoType
clang::ASTContext::getFunctionNoProtoType
clang::ASTContext::getFunctionType
clang::ASTContext::adjustStringLiteralBaseType
clang::ASTContext::getFunctionTypeInternal
clang::ASTContext::getTypeDeclType
clang::ASTContext::getTypedefType
clang::ASTContext::getRecordType
clang::ASTContext::getEnumType
clang::ASTContext::getInjectedClassNameType
clang::ASTContext::getAttributedType
clang::ASTContext::getSubstTemplateTypeParmType
clang::ASTContext::getSubstTemplateTypeParmPackType
clang::ASTContext::getTemplateTypeParmType
clang::ASTContext::getTemplateSpecializationType
clang::ASTContext::getCanonicalTemplateSpecializationType
clang::ASTContext::getTemplateSpecializationType
clang::ASTContext::getTemplateSpecializationTypeInfo
clang::ASTContext::getParenType
clang::ASTContext::getElaboratedType
clang::ASTContext::getDependentNameType
clang::ASTContext::getDependentTemplateSpecializationType
clang::ASTContext::getDependentTemplateSpecializationType
clang::ASTContext::getInjectedTemplateArg
clang::ASTContext::getInjectedTemplateArgs
clang::ASTContext::getPackExpansionType
clang::ASTContext::getObjCInterfaceType
clang::ASTContext::getObjCObjectType
clang::ASTContext::getObjCObjectType
clang::ASTContext::getObjCTypeParamType
clang::ASTContext::ObjCObjectAdoptsQTypeProtocols
clang::ASTContext::QIdProtocolsAdoptObjCObjectProtocols
clang::ASTContext::getObjCObjectPointerType
clang::ASTContext::getTypeOfExprType
clang::ASTContext::getTypeOfType
clang::ASTContext::getDecltypeType
clang::ASTContext::getUnaryTransformType
clang::ASTContext::getAutoType
clang::ASTContext::getAutoDeductType
clang::ASTContext::getAutoRRefDeductType
clang::ASTContext::getDeducedTemplateSpecializationType
clang::ASTContext::getTagDeclType
clang::ASTContext::getSizeType
clang::ASTContext::getSignedSizeType
clang::ASTContext::getIntMaxType
clang::ASTContext::getUIntMaxType
clang::ASTContext::getWCharType
clang::ASTContext::getWideCharType
clang::ASTContext::getSignedWCharType
clang::ASTContext::getUnsignedWCharType
clang::ASTContext::getWIntType
clang::ASTContext::getIntPtrType
clang::ASTContext::getUIntPtrType
clang::ASTContext::getPointerDiffType
clang::ASTContext::getUnsignedPointerDiffType
clang::ASTContext::getProcessIDType
clang::ASTContext::getCFConstantStringType
clang::ASTContext::getObjCSuperType
clang::ASTContext::setObjCSuperType
clang::ASTContext::getRawCFConstantStringType
clang::ASTContext::setCFConstantStringType
clang::ASTContext::getCFConstantStringDecl
clang::ASTContext::getCFConstantStringTagDecl
clang::ASTContext::setObjCConstantStringInterface
clang::ASTContext::getObjCConstantStringInterface
clang::ASTContext::getObjCNSStringType
clang::ASTContext::setObjCNSStringType
clang::ASTContext::getObjCIdRedefinitionType
clang::ASTContext::setObjCIdRedefinitionType
clang::ASTContext::getObjCClassRedefinitionType
clang::ASTContext::setObjCClassRedefinitionType
clang::ASTContext::getObjCSelRedefinitionType
clang::ASTContext::setObjCSelRedefinitionType
clang::ASTContext::getNSObjectName
clang::ASTContext::getNSCopyingName
clang::ASTContext::getNSUIntegerType
clang::ASTContext::getNSIntegerType
clang::ASTContext::getBoolName
clang::ASTContext::getMakeIntegerSeqName
clang::ASTContext::getTypePackElementName
clang::ASTContext::getObjCInstanceType
clang::ASTContext::getObjCInstanceTypeDecl
clang::ASTContext::setFILEDecl
clang::ASTContext::getFILEType
clang::ASTContext::setjmp_bufDecl
clang::ASTContext::getjmp_bufType
clang::ASTContext::setsigjmp_bufDecl
clang::ASTContext::getsigjmp_bufType
clang::ASTContext::setucontext_tDecl
clang::ASTContext::getucontext_tType
clang::ASTContext::getLogicalOperationType
clang::ASTContext::getObjCEncodingForType
clang::ASTContext::getObjCEncodingForPropertyType
clang::ASTContext::getLegacyIntegralTypeEncoding
clang::ASTContext::getObjCEncodingForTypeQualifier
clang::ASTContext::getObjCEncodingForFunctionDecl
clang::ASTContext::getObjCEncodingForMethodDecl
clang::ASTContext::getObjCEncodingForBlock
clang::ASTContext::getObjCEncodingForPropertyDecl
clang::ASTContext::ProtocolCompatibleWithProtocol
clang::ASTContext::getObjCPropertyImplDeclForPropertyDecl
clang::ASTContext::getObjCEncodingTypeSize
clang::ASTContext::getObjCIdDecl
clang::ASTContext::getObjCIdType
clang::ASTContext::getObjCSelDecl
clang::ASTContext::getObjCSelType
clang::ASTContext::getObjCClassDecl
clang::ASTContext::getObjCClassType
clang::ASTContext::getObjCProtocolDecl
clang::ASTContext::getBOOLDecl
clang::ASTContext::setBOOLDecl
clang::ASTContext::getBOOLType
clang::ASTContext::getObjCProtoType
clang::ASTContext::getBuiltinVaListDecl
clang::ASTContext::getBuiltinVaListType
clang::ASTContext::getVaListTagDecl
clang::ASTContext::getBuiltinMSVaListDecl
clang::ASTContext::getBuiltinMSVaListType
clang::ASTContext::canBuiltinBeRedeclared
clang::ASTContext::getCVRQualifiedType
clang::ASTContext::getQualifiedType
clang::ASTContext::getQualifiedType
clang::ASTContext::getQualifiedType
clang::ASTContext::getLifetimeQualifiedType
clang::ASTContext::getUnqualifiedObjCPointerType
clang::ASTContext::getFixedPointScale
clang::ASTContext::getFixedPointIBits
clang::ASTContext::getFixedPointSemantics
clang::ASTContext::getFixedPointMax
clang::ASTContext::getFixedPointMin
clang::ASTContext::getNameForTemplate
clang::ASTContext::getOverloadedTemplateName
clang::ASTContext::getQualifiedTemplateName
clang::ASTContext::getDependentTemplateName
clang::ASTContext::getDependentTemplateName
clang::ASTContext::getSubstTemplateTemplateParm
clang::ASTContext::getSubstTemplateTemplateParmPack
clang::ASTContext::GetBuiltinTypeError
clang::ASTContext::GetBuiltinType
clang::ASTContext::CompCategories
clang::ASTContext::getFromTargetType
clang::ASTContext::getTypeInfoImpl
clang::ASTContext::getObjCGCAttrKind
clang::ASTContext::areCompatibleVectorTypes
clang::ASTContext::isObjCNSObjectType
clang::ASTContext::getFloatTypeSemantics
clang::ASTContext::getTypeInfo
clang::ASTContext::getTypeInfo
clang::ASTContext::getOpenMPDefaultSimdAlign
clang::ASTContext::getTypeSize
clang::ASTContext::getTypeSize
clang::ASTContext::getCharWidth
clang::ASTContext::toCharUnitsFromBits
clang::ASTContext::toBits
clang::ASTContext::getTypeSizeInChars
clang::ASTContext::getTypeSizeInChars
clang::ASTContext::getTypeSizeInCharsIfKnown
clang::ASTContext::getTypeSizeInCharsIfKnown
clang::ASTContext::getTypeAlign
clang::ASTContext::getTypeAlign
clang::ASTContext::getTypeUnadjustedAlign
clang::ASTContext::getTypeUnadjustedAlign
clang::ASTContext::getTypeAlignIfKnown
clang::ASTContext::getTypeAlignInChars
clang::ASTContext::getTypeAlignInChars
clang::ASTContext::getTypeUnadjustedAlignInChars
clang::ASTContext::getTypeUnadjustedAlignInChars
clang::ASTContext::getTypeInfoDataSizeInChars
clang::ASTContext::getTypeInfoInChars
clang::ASTContext::getTypeInfoInChars
clang::ASTContext::isAlignmentRequired
clang::ASTContext::isAlignmentRequired
clang::ASTContext::getPreferredTypeAlign
clang::ASTContext::getTargetDefaultAlignForAttributeAligned
clang::ASTContext::getAlignOfGlobalVar
clang::ASTContext::getAlignOfGlobalVarInChars
clang::ASTContext::getDeclAlign
clang::ASTContext::getASTRecordLayout
clang::ASTContext::getASTObjCInterfaceLayout
clang::ASTContext::DumpRecordLayout
clang::ASTContext::getASTObjCImplementationLayout
clang::ASTContext::getCurrentKeyFunction
clang::ASTContext::setNonKeyFunction
clang::ASTContext::getOffsetOfBaseWithVBPtr
clang::ASTContext::getFieldOffset
clang::ASTContext::lookupFieldBitOffset
clang::ASTContext::isNearlyEmpty
clang::ASTContext::getVTableContext
clang::ASTContext::createMangleContext
clang::ASTContext::DeepCollectObjCIvars
clang::ASTContext::CountNonClassIvars
clang::ASTContext::CollectInheritedProtocols
clang::ASTContext::hasUniqueObjectRepresentations
clang::ASTContext::getCanonicalType
clang::ASTContext::getCanonicalType
clang::ASTContext::getCanonicalParamType
clang::ASTContext::hasSameType
clang::ASTContext::hasSameType
clang::ASTContext::getUnqualifiedArrayType
clang::ASTContext::hasSameUnqualifiedType
clang::ASTContext::hasSameNullabilityTypeQualifier
clang::ASTContext::ObjCMethodsAreEqual
clang::ASTContext::UnwrapSimilarTypes
clang::ASTContext::UnwrapSimilarArrayTypes
clang::ASTContext::hasSimilarType
clang::ASTContext::hasCvrSimilarType
clang::ASTContext::getCanonicalNestedNameSpecifier
clang::ASTContext::getDefaultCallingConvention
clang::ASTContext::getCanonicalTemplateName
clang::ASTContext::hasSameTemplateName
clang::ASTContext::getCanonicalTemplateArgument
clang::ASTContext::getAsArrayType
clang::ASTContext::getAsConstantArrayType
clang::ASTContext::getAsVariableArrayType
clang::ASTContext::getAsIncompleteArrayType
clang::ASTContext::getAsDependentSizedArrayType
clang::ASTContext::getBaseElementType
clang::ASTContext::getBaseElementType
clang::ASTContext::getConstantArrayElementCount
clang::ASTContext::getAdjustedParameterType
clang::ASTContext::getSignatureParameterType
clang::ASTContext::getExceptionObjectType
clang::ASTContext::getArrayDecayedType
clang::ASTContext::getPromotedIntegerType
clang::ASTContext::getInnerObjCOwnership
clang::ASTContext::isPromotableBitField
clang::ASTContext::getIntegerTypeOrder
clang::ASTContext::getFloatingTypeOrder
clang::ASTContext::getFloatingTypeSemanticOrder
clang::ASTContext::getFloatingTypeOfSizeWithinDomain
clang::ASTContext::getTargetAddressSpace
clang::ASTContext::getTargetAddressSpace
clang::ASTContext::getTargetAddressSpace
clang::ASTContext::getLangASForBuiltinAddressSpace
clang::ASTContext::getTargetNullPointerValue
clang::ASTContext::addressSpaceMapManglingFor
clang::ASTContext::getIntegerRank
clang::ASTContext::typesAreCompatible
clang::ASTContext::propertyTypesAreCompatible
clang::ASTContext::typesAreBlockPointerCompatible
clang::ASTContext::isObjCIdType
clang::ASTContext::isObjCClassType
clang::ASTContext::isObjCSelType
clang::ASTContext::ObjCQualifiedIdTypesAreCompatible
clang::ASTContext::ObjCQualifiedClassTypesAreCompatible
clang::ASTContext::canAssignObjCInterfaces
clang::ASTContext::canAssignObjCInterfaces
clang::ASTContext::canAssignObjCInterfacesInBlockPointer
clang::ASTContext::areComparableObjCPointerTypes
clang::ASTContext::areCommonBaseCompatible
clang::ASTContext::canBindObjCObjectType
clang::ASTContext::mergeTypes
clang::ASTContext::mergeFunctionTypes
clang::ASTContext::mergeFunctionParameterTypes
clang::ASTContext::mergeTransparentUnionType
clang::ASTContext::mergeObjCGCQualifiers
clang::ASTContext::mergeExtParameterInfo
clang::ASTContext::ResetObjCLayout
clang::ASTContext::getIntWidth
clang::ASTContext::getCorrespondingUnsignedType
clang::ASTContext::getCorrespondingSaturatedType
clang::ASTContext::getCorrespondingSignedFixedPointType
clang::ASTContext::MakeIntValue
clang::ASTContext::isSentinelNullExpr
clang::ASTContext::getObjCImplementation
clang::ASTContext::getObjCImplementation
clang::ASTContext::AnyObjCImplementation
clang::ASTContext::setObjCImplementation
clang::ASTContext::setObjCImplementation
clang::ASTContext::getObjCMethodRedeclaration
clang::ASTContext::setObjCMethodRedeclaration
clang::ASTContext::getObjContainingInterface
clang::ASTContext::setBlockVarCopyInit
clang::ASTContext::getBlockVarCopyInit
clang::ASTContext::CreateTypeSourceInfo
clang::ASTContext::getTrivialTypeSourceInfo
clang::ASTContext::AddDeallocation
clang::ASTContext::addDestruction
clang::ASTContext::GetGVALinkageForFunction
clang::ASTContext::GetGVALinkageForVariable
clang::ASTContext::DeclMustBeEmitted
clang::ASTContext::forEachMultiversionedFunctionVersion
clang::ASTContext::getCopyConstructorForExceptionObject
clang::ASTContext::addCopyConstructorForExceptionObject
clang::ASTContext::addTypedefNameForUnnamedTagDecl
clang::ASTContext::getTypedefNameForUnnamedTagDecl
clang::ASTContext::addDeclaratorForUnnamedTagDecl
clang::ASTContext::getDeclaratorForUnnamedTagDecl
clang::ASTContext::setManglingNumber
clang::ASTContext::getManglingNumber
clang::ASTContext::setStaticLocalNumber
clang::ASTContext::getStaticLocalNumber
clang::ASTContext::getManglingNumberContext
clang::ASTContext::createMangleNumberingContext
clang::ASTContext::setParameterIndex
clang::ASTContext::getParameterIndex
clang::ASTContext::getMaterializedTemporaryValue
clang::ASTContext::NumImplicitDefaultConstructors
clang::ASTContext::NumImplicitDefaultConstructorsDeclared
clang::ASTContext::NumImplicitCopyConstructors
clang::ASTContext::NumImplicitCopyConstructorsDeclared
clang::ASTContext::NumImplicitMoveConstructors
clang::ASTContext::NumImplicitMoveConstructorsDeclared
clang::ASTContext::NumImplicitCopyAssignmentOperators
clang::ASTContext::NumImplicitCopyAssignmentOperatorsDeclared
clang::ASTContext::NumImplicitMoveAssignmentOperators
clang::ASTContext::NumImplicitMoveAssignmentOperatorsDeclared
clang::ASTContext::NumImplicitDestructors
clang::ASTContext::NumImplicitDestructorsDeclared
clang::ASTContext::InitBuiltinTypes
clang::ASTContext::InitBuiltinType
clang::ASTContext::getObjCEncodingForTypeImpl
clang::ASTContext::getObjCEncodingForStructureImpl
clang::ASTContext::getObjCEncodingForMethodParameter
clang::ASTContext::isMSStaticDataMemberInlineDefinition
clang::ASTContext::InlineVariableDefinitionKind
clang::ASTContext::getInlineVariableDefinitionKind
clang::ASTContext::getObjCLayout
clang::ASTContext::Deallocations
clang::ASTContext::LastSDM
clang::ASTContext::TraversalScope
clang::ASTContext::Parents
clang::ASTContext::VTContext
clang::ASTContext::ReleaseDeclContextMaps
clang::ASTContext::PragmaSectionFlag
clang::ASTContext::SectionInfo
clang::ASTContext::SectionInfo::Decl
clang::ASTContext::SectionInfo::PragmaSectionLocation
clang::ASTContext::SectionInfo::SectionFlags
clang::ASTContext::SectionInfos
clang::LazyGenerationalUpdatePtr::makeValue
clang::ASTContext::getConstantArrayType