clang  3.7.0
ASTContext.h
Go to the documentation of this file.
1 //===--- ASTContext.h - Context to hold long-lived AST nodes ----*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// \brief Defines the clang::ASTContext interface.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_CLANG_AST_ASTCONTEXT_H
16 #define LLVM_CLANG_AST_ASTCONTEXT_H
17 
21 #include "clang/AST/Decl.h"
26 #include "clang/AST/TemplateName.h"
27 #include "clang/AST/Type.h"
35 #include "llvm/ADT/DenseMap.h"
36 #include "llvm/ADT/FoldingSet.h"
37 #include "llvm/ADT/IntrusiveRefCntPtr.h"
38 #include "llvm/ADT/SmallPtrSet.h"
39 #include "llvm/ADT/TinyPtrVector.h"
40 #include "llvm/Support/Allocator.h"
41 #include <memory>
42 #include <vector>
43 
44 namespace llvm {
45  struct fltSemantics;
46 }
47 
48 namespace clang {
49  class FileManager;
50  class AtomicExpr;
51  class ASTRecordLayout;
52  class BlockExpr;
53  class CharUnits;
54  class DiagnosticsEngine;
55  class Expr;
56  class ASTMutationListener;
57  class IdentifierTable;
58  class MaterializeTemporaryExpr;
59  class SelectorTable;
60  class TargetInfo;
61  class CXXABI;
62  class MangleNumberingContext;
63  // Decls
64  class MangleContext;
65  class ObjCIvarDecl;
66  class ObjCPropertyDecl;
67  class UnresolvedSetIterator;
68  class UsingDecl;
69  class UsingShadowDecl;
70  class VTableContextBase;
71 
72  namespace Builtin { class Context; }
73 
74  namespace comments {
75  class FullComment;
76  }
77 
78  struct TypeInfo {
79  uint64_t Width;
80  unsigned Align;
81  bool AlignIsRequired : 1;
83  TypeInfo(uint64_t Width, unsigned Align, bool AlignIsRequired)
84  : Width(Width), Align(Align), AlignIsRequired(AlignIsRequired) {}
85  };
86 
87 /// \brief Holds long-lived AST nodes (such as types and decls) that can be
88 /// referred to throughout the semantic analysis of a file.
89 class ASTContext : public RefCountedBase<ASTContext> {
90  ASTContext &this_() { return *this; }
91 
92  mutable SmallVector<Type *, 0> Types;
93  mutable llvm::FoldingSet<ExtQuals> ExtQualNodes;
94  mutable llvm::FoldingSet<ComplexType> ComplexTypes;
95  mutable llvm::FoldingSet<PointerType> PointerTypes;
96  mutable llvm::FoldingSet<AdjustedType> AdjustedTypes;
97  mutable llvm::FoldingSet<BlockPointerType> BlockPointerTypes;
98  mutable llvm::FoldingSet<LValueReferenceType> LValueReferenceTypes;
99  mutable llvm::FoldingSet<RValueReferenceType> RValueReferenceTypes;
100  mutable llvm::FoldingSet<MemberPointerType> MemberPointerTypes;
101  mutable llvm::FoldingSet<ConstantArrayType> ConstantArrayTypes;
102  mutable llvm::FoldingSet<IncompleteArrayType> IncompleteArrayTypes;
103  mutable std::vector<VariableArrayType*> VariableArrayTypes;
104  mutable llvm::FoldingSet<DependentSizedArrayType> DependentSizedArrayTypes;
105  mutable llvm::FoldingSet<DependentSizedExtVectorType>
106  DependentSizedExtVectorTypes;
107  mutable llvm::FoldingSet<VectorType> VectorTypes;
108  mutable llvm::FoldingSet<FunctionNoProtoType> FunctionNoProtoTypes;
109  mutable llvm::ContextualFoldingSet<FunctionProtoType, ASTContext&>
110  FunctionProtoTypes;
111  mutable llvm::FoldingSet<DependentTypeOfExprType> DependentTypeOfExprTypes;
112  mutable llvm::FoldingSet<DependentDecltypeType> DependentDecltypeTypes;
113  mutable llvm::FoldingSet<TemplateTypeParmType> TemplateTypeParmTypes;
114  mutable llvm::FoldingSet<SubstTemplateTypeParmType>
115  SubstTemplateTypeParmTypes;
116  mutable llvm::FoldingSet<SubstTemplateTypeParmPackType>
117  SubstTemplateTypeParmPackTypes;
118  mutable llvm::ContextualFoldingSet<TemplateSpecializationType, ASTContext&>
119  TemplateSpecializationTypes;
120  mutable llvm::FoldingSet<ParenType> ParenTypes;
121  mutable llvm::FoldingSet<ElaboratedType> ElaboratedTypes;
122  mutable llvm::FoldingSet<DependentNameType> DependentNameTypes;
123  mutable llvm::ContextualFoldingSet<DependentTemplateSpecializationType,
124  ASTContext&>
125  DependentTemplateSpecializationTypes;
126  llvm::FoldingSet<PackExpansionType> PackExpansionTypes;
127  mutable llvm::FoldingSet<ObjCObjectTypeImpl> ObjCObjectTypes;
128  mutable llvm::FoldingSet<ObjCObjectPointerType> ObjCObjectPointerTypes;
129  mutable llvm::FoldingSet<AutoType> AutoTypes;
130  mutable llvm::FoldingSet<AtomicType> AtomicTypes;
131  llvm::FoldingSet<AttributedType> AttributedTypes;
132 
133  mutable llvm::FoldingSet<QualifiedTemplateName> QualifiedTemplateNames;
134  mutable llvm::FoldingSet<DependentTemplateName> DependentTemplateNames;
135  mutable llvm::FoldingSet<SubstTemplateTemplateParmStorage>
136  SubstTemplateTemplateParms;
137  mutable llvm::ContextualFoldingSet<SubstTemplateTemplateParmPackStorage,
138  ASTContext&>
139  SubstTemplateTemplateParmPacks;
140 
141  /// \brief The set of nested name specifiers.
142  ///
143  /// This set is managed by the NestedNameSpecifier class.
144  mutable llvm::FoldingSet<NestedNameSpecifier> NestedNameSpecifiers;
145  mutable NestedNameSpecifier *GlobalNestedNameSpecifier;
146  friend class NestedNameSpecifier;
147 
148  /// \brief A cache mapping from RecordDecls to ASTRecordLayouts.
149  ///
150  /// This is lazily created. This is intentionally not serialized.
151  mutable llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>
152  ASTRecordLayouts;
153  mutable llvm::DenseMap<const ObjCContainerDecl*, const ASTRecordLayout*>
154  ObjCLayouts;
155 
156  /// \brief A cache from types to size and alignment information.
157  typedef llvm::DenseMap<const Type *, struct TypeInfo> TypeInfoMap;
158  mutable TypeInfoMap MemoizedTypeInfo;
159 
160  /// \brief A cache mapping from CXXRecordDecls to key functions.
161  llvm::DenseMap<const CXXRecordDecl*, LazyDeclPtr> KeyFunctions;
162 
163  /// \brief Mapping from ObjCContainers to their ObjCImplementations.
164  llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*> ObjCImpls;
165 
166  /// \brief Mapping from ObjCMethod to its duplicate declaration in the same
167  /// interface.
168  llvm::DenseMap<const ObjCMethodDecl*,const ObjCMethodDecl*> ObjCMethodRedecls;
169 
170  /// \brief Mapping from __block VarDecls to their copy initialization expr.
171  llvm::DenseMap<const VarDecl*, Expr*> BlockVarCopyInits;
172 
173  /// \brief Mapping from class scope functions specialization to their
174  /// template patterns.
175  llvm::DenseMap<const FunctionDecl*, FunctionDecl*>
176  ClassScopeSpecializationPattern;
177 
178  /// \brief Mapping from materialized temporaries with static storage duration
179  /// that appear in constant initializers to their evaluated values.
180  llvm::DenseMap<const MaterializeTemporaryExpr*, APValue>
181  MaterializedTemporaryValues;
182 
183  /// \brief Representation of a "canonical" template template parameter that
184  /// is used in canonical template names.
185  class CanonicalTemplateTemplateParm : public llvm::FoldingSetNode {
187 
188  public:
189  CanonicalTemplateTemplateParm(TemplateTemplateParmDecl *Parm)
190  : Parm(Parm) { }
191 
192  TemplateTemplateParmDecl *getParam() const { return Parm; }
193 
194  void Profile(llvm::FoldingSetNodeID &ID) { Profile(ID, Parm); }
195 
196  static void Profile(llvm::FoldingSetNodeID &ID,
197  TemplateTemplateParmDecl *Parm);
198  };
199  mutable llvm::FoldingSet<CanonicalTemplateTemplateParm>
200  CanonTemplateTemplateParms;
201 
202  TemplateTemplateParmDecl *
203  getCanonicalTemplateTemplateParmDecl(TemplateTemplateParmDecl *TTP) const;
204 
205  /// \brief The typedef for the __int128_t type.
206  mutable TypedefDecl *Int128Decl;
207 
208  /// \brief The typedef for the __uint128_t type.
209  mutable TypedefDecl *UInt128Decl;
210 
211  /// \brief The typedef for the __float128 stub type.
212  mutable TypeDecl *Float128StubDecl;
213 
214  /// \brief The typedef for the target specific predefined
215  /// __builtin_va_list type.
216  mutable TypedefDecl *BuiltinVaListDecl;
217 
218  /// \brief The typedef for the predefined \c id type.
219  mutable TypedefDecl *ObjCIdDecl;
220 
221  /// \brief The typedef for the predefined \c SEL type.
222  mutable TypedefDecl *ObjCSelDecl;
223 
224  /// \brief The typedef for the predefined \c Class type.
225  mutable TypedefDecl *ObjCClassDecl;
226 
227  /// \brief The typedef for the predefined \c Protocol class in Objective-C.
228  mutable ObjCInterfaceDecl *ObjCProtocolClassDecl;
229 
230  /// \brief The typedef for the predefined 'BOOL' type.
231  mutable TypedefDecl *BOOLDecl;
232 
233  // Typedefs which may be provided defining the structure of Objective-C
234  // pseudo-builtins
235  QualType ObjCIdRedefinitionType;
236  QualType ObjCClassRedefinitionType;
237  QualType ObjCSelRedefinitionType;
238 
239  /// The identifier 'NSObject'.
240  IdentifierInfo *NSObjectName = nullptr;
241 
242  /// The identifier 'NSCopying'.
243  IdentifierInfo *NSCopyingName = nullptr;
244 
245  QualType ObjCConstantStringType;
246  mutable RecordDecl *CFConstantStringTypeDecl;
247 
248  mutable QualType ObjCSuperType;
249 
250  QualType ObjCNSStringType;
251 
252  /// \brief The typedef declaration for the Objective-C "instancetype" type.
253  TypedefDecl *ObjCInstanceTypeDecl;
254 
255  /// \brief The type for the C FILE type.
256  TypeDecl *FILEDecl;
257 
258  /// \brief The type for the C jmp_buf type.
259  TypeDecl *jmp_bufDecl;
260 
261  /// \brief The type for the C sigjmp_buf type.
262  TypeDecl *sigjmp_bufDecl;
263 
264  /// \brief The type for the C ucontext_t type.
265  TypeDecl *ucontext_tDecl;
266 
267  /// \brief Type for the Block descriptor for Blocks CodeGen.
268  ///
269  /// Since this is only used for generation of debug info, it is not
270  /// serialized.
271  mutable RecordDecl *BlockDescriptorType;
272 
273  /// \brief Type for the Block descriptor for Blocks CodeGen.
274  ///
275  /// Since this is only used for generation of debug info, it is not
276  /// serialized.
277  mutable RecordDecl *BlockDescriptorExtendedType;
278 
279  /// \brief Declaration for the CUDA cudaConfigureCall function.
280  FunctionDecl *cudaConfigureCallDecl;
281 
282  /// \brief Keeps track of all declaration attributes.
283  ///
284  /// Since so few decls have attrs, we keep them in a hash map instead of
285  /// wasting space in the Decl class.
286  llvm::DenseMap<const Decl*, AttrVec*> DeclAttrs;
287 
288  /// \brief A mapping from non-redeclarable declarations in modules that were
289  /// merged with other declarations to the canonical declaration that they were
290  /// merged into.
291  llvm::DenseMap<Decl*, Decl*> MergedDecls;
292 
293  /// \brief A mapping from a defining declaration to a list of modules (other
294  /// than the owning module of the declaration) that contain merged
295  /// definitions of that entity.
296  llvm::DenseMap<NamedDecl*, llvm::TinyPtrVector<Module*>> MergedDefModules;
297 
298 public:
299  /// \brief A type synonym for the TemplateOrInstantiation mapping.
300  typedef llvm::PointerUnion<VarTemplateDecl *, MemberSpecializationInfo *>
302 
303 private:
304 
305  /// \brief A mapping to contain the template or declaration that
306  /// a variable declaration describes or was instantiated from,
307  /// respectively.
308  ///
309  /// For non-templates, this value will be NULL. For variable
310  /// declarations that describe a variable template, this will be a
311  /// pointer to a VarTemplateDecl. For static data members
312  /// of class template specializations, this will be the
313  /// MemberSpecializationInfo referring to the member variable that was
314  /// instantiated or specialized. Thus, the mapping will keep track of
315  /// the static data member templates from which static data members of
316  /// class template specializations were instantiated.
317  ///
318  /// Given the following example:
319  ///
320  /// \code
321  /// template<typename T>
322  /// struct X {
323  /// static T value;
324  /// };
325  ///
326  /// template<typename T>
327  /// T X<T>::value = T(17);
328  ///
329  /// int *x = &X<int>::value;
330  /// \endcode
331  ///
332  /// This mapping will contain an entry that maps from the VarDecl for
333  /// X<int>::value to the corresponding VarDecl for X<T>::value (within the
334  /// class template X) and will be marked TSK_ImplicitInstantiation.
335  llvm::DenseMap<const VarDecl *, TemplateOrSpecializationInfo>
336  TemplateOrInstantiation;
337 
338  /// \brief Keeps track of the declaration from which a UsingDecl was
339  /// created during instantiation.
340  ///
341  /// The source declaration is always a UsingDecl, an UnresolvedUsingValueDecl,
342  /// or an UnresolvedUsingTypenameDecl.
343  ///
344  /// For example:
345  /// \code
346  /// template<typename T>
347  /// struct A {
348  /// void f();
349  /// };
350  ///
351  /// template<typename T>
352  /// struct B : A<T> {
353  /// using A<T>::f;
354  /// };
355  ///
356  /// template struct B<int>;
357  /// \endcode
358  ///
359  /// This mapping will contain an entry that maps from the UsingDecl in
360  /// B<int> to the UnresolvedUsingDecl in B<T>.
361  llvm::DenseMap<UsingDecl *, NamedDecl *> InstantiatedFromUsingDecl;
362 
363  llvm::DenseMap<UsingShadowDecl*, UsingShadowDecl*>
364  InstantiatedFromUsingShadowDecl;
365 
366  llvm::DenseMap<FieldDecl *, FieldDecl *> InstantiatedFromUnnamedFieldDecl;
367 
368  /// \brief Mapping that stores the methods overridden by a given C++
369  /// member function.
370  ///
371  /// Since most C++ member functions aren't virtual and therefore
372  /// don't override anything, we store the overridden functions in
373  /// this map on the side rather than within the CXXMethodDecl structure.
374  typedef llvm::TinyPtrVector<const CXXMethodDecl*> CXXMethodVector;
375  llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector> OverriddenMethods;
376 
377  /// \brief Mapping from each declaration context to its corresponding
378  /// mangling numbering context (used for constructs like lambdas which
379  /// need to be consistently numbered for the mangler).
380  llvm::DenseMap<const DeclContext *, MangleNumberingContext *>
381  MangleNumberingContexts;
382 
383  /// \brief Side-table of mangling numbers for declarations which rarely
384  /// need them (like static local vars).
385  llvm::DenseMap<const NamedDecl *, unsigned> MangleNumbers;
386  llvm::DenseMap<const VarDecl *, unsigned> StaticLocalNumbers;
387 
388  /// \brief Mapping that stores parameterIndex values for ParmVarDecls when
389  /// that value exceeds the bitfield size of ParmVarDeclBits.ParameterIndex.
390  typedef llvm::DenseMap<const VarDecl *, unsigned> ParameterIndexTable;
391  ParameterIndexTable ParamIndices;
392 
393  ImportDecl *FirstLocalImport;
394  ImportDecl *LastLocalImport;
395 
396  TranslationUnitDecl *TUDecl;
397  mutable ExternCContextDecl *ExternCContext;
398 
399  /// \brief The associated SourceManager object.a
400  SourceManager &SourceMgr;
401 
402  /// \brief The language options used to create the AST associated with
403  /// this ASTContext object.
404  LangOptions &LangOpts;
405 
406  /// \brief Blacklist object that is used by sanitizers to decide which
407  /// entities should not be instrumented.
408  std::unique_ptr<SanitizerBlacklist> SanitizerBL;
409 
410  /// \brief The allocator used to create AST objects.
411  ///
412  /// AST objects are never destructed; rather, all memory associated with the
413  /// AST objects will be released when the ASTContext itself is destroyed.
414  mutable llvm::BumpPtrAllocator BumpAlloc;
415 
416  /// \brief Allocator for partial diagnostics.
418 
419  /// \brief The current C++ ABI.
420  std::unique_ptr<CXXABI> ABI;
421  CXXABI *createCXXABI(const TargetInfo &T);
422 
423  /// \brief The logical -> physical address space map.
424  const LangAS::Map *AddrSpaceMap;
425 
426  /// \brief Address space map mangling must be used with language specific
427  /// address spaces (e.g. OpenCL/CUDA)
428  bool AddrSpaceMapMangling;
429 
430  friend class ASTDeclReader;
431  friend class ASTReader;
432  friend class ASTWriter;
433  friend class CXXRecordDecl;
434 
435  const TargetInfo *Target;
437 
438 public:
445 
446  /// \brief Contains parents of a node.
448 
449  /// \brief Maps from a node to its parents.
450  typedef llvm::DenseMap<const void *,
451  llvm::PointerUnion<ast_type_traits::DynTypedNode *,
453 
454  /// \brief Returns the parents of the given node.
455  ///
456  /// Note that this will lazily compute the parents of all nodes
457  /// and store them for later retrieval. Thus, the first call is O(n)
458  /// in the number of AST nodes.
459  ///
460  /// Caveats and FIXMEs:
461  /// Calculating the parent map over all AST nodes will need to load the
462  /// full AST. This can be undesirable in the case where the full AST is
463  /// expensive to create (for example, when using precompiled header
464  /// preambles). Thus, there are good opportunities for optimization here.
465  /// One idea is to walk the given node downwards, looking for references
466  /// to declaration contexts - once a declaration context is found, compute
467  /// the parent map for the declaration context; if that can satisfy the
468  /// request, loading the whole AST can be avoided. Note that this is made
469  /// more complex by statements in templates having multiple parents - those
470  /// problems can be solved by building closure over the templated parts of
471  /// the AST, which also avoids touching large parts of the AST.
472  /// Additionally, we will want to add an interface to already give a hint
473  /// where to search for the parents, for example when looking at a statement
474  /// inside a certain function.
475  ///
476  /// 'NodeT' can be one of Decl, Stmt, Type, TypeLoc,
477  /// NestedNameSpecifier or NestedNameSpecifierLoc.
478  template <typename NodeT>
481  }
482 
485 
487  return PrintingPolicy;
488  }
489 
491  PrintingPolicy = Policy;
492  }
493 
495  const SourceManager& getSourceManager() const { return SourceMgr; }
496 
497  llvm::BumpPtrAllocator &getAllocator() const {
498  return BumpAlloc;
499  }
500 
501  void *Allocate(size_t Size, unsigned Align = 8) const {
502  return BumpAlloc.Allocate(Size, Align);
503  }
504  void Deallocate(void *Ptr) const { }
505 
506  /// Return the total amount of physical memory allocated for representing
507  /// AST nodes and type information.
508  size_t getASTAllocatedMemory() const {
509  return BumpAlloc.getTotalMemory();
510  }
511  /// Return the total memory used for various side tables.
512  size_t getSideTableAllocatedMemory() const;
513 
515  return DiagAllocator;
516  }
517 
518  const TargetInfo &getTargetInfo() const { return *Target; }
519 
520  /// getIntTypeForBitwidth -
521  /// sets integer QualTy according to specified details:
522  /// bitwidth, signed/unsigned.
523  /// Returns empty type if there is no appropriate target types.
524  QualType getIntTypeForBitwidth(unsigned DestWidth,
525  unsigned Signed) const;
526  /// getRealTypeForBitwidth -
527  /// sets floating point QualTy according to specified bitwidth.
528  /// Returns empty type if there is no appropriate target types.
529  QualType getRealTypeForBitwidth(unsigned DestWidth) const;
530 
531  bool AtomicUsesUnsupportedLibcall(const AtomicExpr *E) const;
532 
533  const LangOptions& getLangOpts() const { return LangOpts; }
534 
536  return *SanitizerBL;
537  }
538 
540 
542  return FullSourceLoc(Loc,SourceMgr);
543  }
544 
545  /// \brief All comments in this translation unit.
547 
548  /// \brief True if comments are already loaded from ExternalASTSource.
549  mutable bool CommentsLoaded;
550 
552  public:
553  enum Kind {
554  /// We searched for a comment attached to the particular declaration, but
555  /// didn't find any.
556  ///
557  /// getRaw() == 0.
559 
560  /// We have found a comment attached to this particular declaration.
561  ///
562  /// getRaw() != 0.
564 
565  /// This declaration does not have an attached comment, and we have
566  /// searched the redeclaration chain.
567  ///
568  /// If getRaw() == 0, the whole redeclaration chain does not have any
569  /// comments.
570  ///
571  /// If getRaw() != 0, it is a comment propagated from other
572  /// redeclaration.
574  };
575 
576  Kind getKind() const LLVM_READONLY {
577  return Data.getInt();
578  }
579 
580  void setKind(Kind K) {
581  Data.setInt(K);
582  }
583 
584  const RawComment *getRaw() const LLVM_READONLY {
585  return Data.getPointer();
586  }
587 
588  void setRaw(const RawComment *RC) {
589  Data.setPointer(RC);
590  }
591 
592  const Decl *getOriginalDecl() const LLVM_READONLY {
593  return OriginalDecl;
594  }
595 
596  void setOriginalDecl(const Decl *Orig) {
597  OriginalDecl = Orig;
598  }
599 
600  private:
601  llvm::PointerIntPair<const RawComment *, 2, Kind> Data;
602  const Decl *OriginalDecl;
603  };
604 
605  /// \brief Mapping from declarations to comments attached to any
606  /// redeclaration.
607  ///
608  /// Raw comments are owned by Comments list. This mapping is populated
609  /// lazily.
610  mutable llvm::DenseMap<const Decl *, RawCommentAndCacheFlags> RedeclComments;
611 
612  /// \brief Mapping from declarations to parsed comments attached to any
613  /// redeclaration.
614  mutable llvm::DenseMap<const Decl *, comments::FullComment *> ParsedComments;
615 
616  /// \brief Return the documentation comment attached to a given declaration,
617  /// without looking into cache.
619 
620 public:
622  return Comments;
623  }
624 
625  void addComment(const RawComment &RC) {
626  assert(LangOpts.RetainCommentsFromSystemHeaders ||
627  !SourceMgr.isInSystemHeader(RC.getSourceRange().getBegin()));
628  Comments.addComment(RC, BumpAlloc);
629  }
630 
631  /// \brief Return the documentation comment attached to a given declaration.
632  /// Returns NULL if no comment is attached.
633  ///
634  /// \param OriginalDecl if not NULL, is set to declaration AST node that had
635  /// the comment, if the comment we found comes from a redeclaration.
636  const RawComment *
638  const Decl **OriginalDecl = nullptr) const;
639 
640  /// Return parsed documentation comment attached to a given declaration.
641  /// Returns NULL if no comment is attached.
642  ///
643  /// \param PP the Preprocessor used with this TU. Could be NULL if
644  /// preprocessor is not available.
646  const Preprocessor *PP) const;
647 
648  /// Return parsed documentation comment attached to a given declaration.
649  /// Returns NULL if no comment is attached. Does not look at any
650  /// redeclarations of the declaration.
652 
654  const Decl *D) const;
655 
656 private:
657  mutable comments::CommandTraits CommentCommandTraits;
658 
659  /// \brief Iterator that visits import declarations.
660  class import_iterator {
661  ImportDecl *Import;
662 
663  public:
664  typedef ImportDecl *value_type;
665  typedef ImportDecl *reference;
666  typedef ImportDecl *pointer;
667  typedef int difference_type;
668  typedef std::forward_iterator_tag iterator_category;
669 
670  import_iterator() : Import() {}
671  explicit import_iterator(ImportDecl *Import) : Import(Import) {}
672 
673  reference operator*() const { return Import; }
674  pointer operator->() const { return Import; }
675 
676  import_iterator &operator++() {
677  Import = ASTContext::getNextLocalImport(Import);
678  return *this;
679  }
680 
681  import_iterator operator++(int) {
682  import_iterator Other(*this);
683  ++(*this);
684  return Other;
685  }
686 
687  friend bool operator==(import_iterator X, import_iterator Y) {
688  return X.Import == Y.Import;
689  }
690 
691  friend bool operator!=(import_iterator X, import_iterator Y) {
692  return X.Import != Y.Import;
693  }
694  };
695 
696 public:
698  return CommentCommandTraits;
699  }
700 
701  /// \brief Retrieve the attributes for the given declaration.
702  AttrVec& getDeclAttrs(const Decl *D);
703 
704  /// \brief Erase the attributes corresponding to the given declaration.
705  void eraseDeclAttrs(const Decl *D);
706 
707  /// \brief If this variable is an instantiated static data member of a
708  /// class template specialization, returns the templated static data member
709  /// from which it was instantiated.
710  // FIXME: Remove ?
712  const VarDecl *Var);
713 
716 
718 
720  FunctionDecl *Pattern);
721 
722  /// \brief Note that the static data member \p Inst is an instantiation of
723  /// the static data member template \p Tmpl of a class template.
726  SourceLocation PointOfInstantiation = SourceLocation());
727 
730 
731  /// \brief If the given using decl \p Inst is an instantiation of a
732  /// (possibly unresolved) using decl from a template instantiation,
733  /// return it.
735 
736  /// \brief Remember that the using decl \p Inst is an instantiation
737  /// of the using decl \p Pattern of a class template.
738  void setInstantiatedFromUsingDecl(UsingDecl *Inst, NamedDecl *Pattern);
739 
741  UsingShadowDecl *Pattern);
743 
745 
747 
748  // Access to the set of methods overridden by the given C++ method.
749  typedef CXXMethodVector::const_iterator overridden_cxx_method_iterator;
751  overridden_methods_begin(const CXXMethodDecl *Method) const;
752 
754  overridden_methods_end(const CXXMethodDecl *Method) const;
755 
756  unsigned overridden_methods_size(const CXXMethodDecl *Method) const;
757 
758  /// \brief Note that the given C++ \p Method overrides the given \p
759  /// Overridden method.
760  void addOverriddenMethod(const CXXMethodDecl *Method,
761  const CXXMethodDecl *Overridden);
762 
763  /// \brief Return C++ or ObjC overridden methods for the given \p Method.
764  ///
765  /// An ObjC method is considered to override any method in the class's
766  /// base classes, its protocols, or its categories' protocols, that has
767  /// the same selector and is of the same kind (class or instance).
768  /// A method in an implementation is not considered as overriding the same
769  /// method in the interface or its categories.
771  const NamedDecl *Method,
772  SmallVectorImpl<const NamedDecl *> &Overridden) const;
773 
774  /// \brief Notify the AST context that a new import declaration has been
775  /// parsed or implicitly created within this translation unit.
776  void addedLocalImportDecl(ImportDecl *Import);
777 
779  return Import->NextLocalImport;
780  }
781 
782  typedef llvm::iterator_range<import_iterator> import_range;
784  return import_range(import_iterator(FirstLocalImport), import_iterator());
785  }
786 
788  Decl *Result = MergedDecls.lookup(D);
789  return Result ? Result : D;
790  }
791  void setPrimaryMergedDecl(Decl *D, Decl *Primary) {
792  MergedDecls[D] = Primary;
793  }
794 
795  /// \brief Note that the definition \p ND has been merged into module \p M,
796  /// and should be visible whenever \p M is visible.
798  bool NotifyListeners = true);
799  /// \brief Clean up the merged definition list. Call this if you might have
800  /// added duplicates into the list.
802 
803  /// \brief Get the additional modules in which the definition \p Def has
804  /// been merged.
806  auto MergedIt = MergedDefModules.find(Def);
807  if (MergedIt == MergedDefModules.end())
808  return None;
809  return MergedIt->second;
810  }
811 
812  TranslationUnitDecl *getTranslationUnitDecl() const { return TUDecl; }
813 
815 
816  // Builtin Types.
820  CanQualType WCharTy; // [C++ 3.9.1p5].
821  CanQualType WideCharTy; // Same as WCharTy in C++, integer type in C99.
822  CanQualType WIntTy; // [C99 7.24.1], integer type unchanged by default promotions.
823  CanQualType Char16Ty; // [C++0x 3.9.1p5], integer type in C99.
824  CanQualType Char32Ty; // [C++0x 3.9.1p5], integer type in C99.
829  CanQualType HalfTy; // [OpenCL 6.1.1.1], ARM NEON
841 
842  // Types for deductions in C++0x [stmt.ranged]'s desugaring. Built on demand.
843  mutable QualType AutoDeductTy; // Deduction against 'auto'.
844  mutable QualType AutoRRefDeductTy; // Deduction against 'auto &&'.
845 
846  // Type used to help define __builtin_va_list for some targets.
847  // The type is built when constructing 'BuiltinVaListDecl'.
849 
851  SelectorTable &sels, Builtin::Context &builtins);
852 
853  ~ASTContext();
854 
855  /// \brief Attach an external AST source to the AST context.
856  ///
857  /// The external AST source provides the ability to load parts of
858  /// the abstract syntax tree as needed from some external storage,
859  /// e.g., a precompiled header.
861 
862  /// \brief Retrieve a pointer to the external AST source associated
863  /// with this AST context, if any.
865  return ExternalSource.get();
866  }
867 
868  /// \brief Attach an AST mutation listener to the AST context.
869  ///
870  /// The AST mutation listener provides the ability to track modifications to
871  /// the abstract syntax tree entities committed after they were initially
872  /// created.
874  this->Listener = Listener;
875  }
876 
877  /// \brief Retrieve a pointer to the AST mutation listener associated
878  /// with this AST context, if any.
880 
881  void PrintStats() const;
882  const SmallVectorImpl<Type *>& getTypes() const { return Types; }
883 
884  /// \brief Create a new implicit TU-level CXXRecordDecl or RecordDecl
885  /// declaration.
886  RecordDecl *buildImplicitRecord(StringRef Name,
887  RecordDecl::TagKind TK = TTK_Struct) const;
888 
889  /// \brief Create a new implicit TU-level typedef declaration.
890  TypedefDecl *buildImplicitTypedef(QualType T, StringRef Name) const;
891 
892  /// \brief Retrieve the declaration for the 128-bit signed integer type.
893  TypedefDecl *getInt128Decl() const;
894 
895  /// \brief Retrieve the declaration for the 128-bit unsigned integer type.
896  TypedefDecl *getUInt128Decl() const;
897 
898  /// \brief Retrieve the declaration for a 128-bit float stub type.
899  TypeDecl *getFloat128StubType() const;
900 
901  //===--------------------------------------------------------------------===//
902  // Type Constructors
903  //===--------------------------------------------------------------------===//
904 
905 private:
906  /// \brief Return a type with extended qualifiers.
907  QualType getExtQualType(const Type *Base, Qualifiers Quals) const;
908 
909  QualType getTypeDeclTypeSlow(const TypeDecl *Decl) const;
910 
911 public:
912  /// \brief Return the uniqued reference to the type for an address space
913  /// qualified type with the specified type and address space.
914  ///
915  /// The resulting type has a union of the qualifiers from T and the address
916  /// space. If T already has an address space specifier, it is silently
917  /// replaced.
918  QualType getAddrSpaceQualType(QualType T, unsigned AddressSpace) const;
919 
920  /// \brief Return the uniqued reference to the type for an Objective-C
921  /// gc-qualified type.
922  ///
923  /// The retulting type has a union of the qualifiers from T and the gc
924  /// attribute.
926 
927  /// \brief Return the uniqued reference to the type for a \c restrict
928  /// qualified type.
929  ///
930  /// The resulting type has a union of the qualifiers from \p T and
931  /// \c restrict.
934  }
935 
936  /// \brief Return the uniqued reference to the type for a \c volatile
937  /// qualified type.
938  ///
939  /// The resulting type has a union of the qualifiers from \p T and
940  /// \c volatile.
943  }
944 
945  /// \brief Return the uniqued reference to the type for a \c const
946  /// qualified type.
947  ///
948  /// The resulting type has a union of the qualifiers from \p T and \c const.
949  ///
950  /// It can be reasonably expected that this will always be equivalent to
951  /// calling T.withConst().
952  QualType getConstType(QualType T) const { return T.withConst(); }
953 
954  /// \brief Change the ExtInfo on a function type.
956  FunctionType::ExtInfo EInfo);
957 
958  /// \brief Change the result type of a function type once it is deduced.
960 
961  /// \brief Change the exception specification on a function once it is
962  /// delay-parsed, instantiated, or computed.
965  bool AsWritten = false);
966 
967  /// \brief Return the uniqued reference to the type for a complex
968  /// number with the specified element type.
972  }
973 
974  /// \brief Return the uniqued reference to the type for a pointer to
975  /// the specified type.
979  }
980 
981  /// \brief Return the uniqued reference to a type adjusted from the original
982  /// type to a new type.
983  QualType getAdjustedType(QualType Orig, QualType New) const;
986  getAdjustedType((QualType)Orig, (QualType)New));
987  }
988 
989  /// \brief Return the uniqued reference to the decayed version of the given
990  /// type. Can only be called on array and function types which decay to
991  /// pointer types.
995  }
996 
997  /// \brief Return the uniqued reference to the atomic type for the specified
998  /// type.
1000 
1001  /// \brief Return the uniqued reference to the type for a block of the
1002  /// specified type.
1004 
1005  /// Gets the struct used to keep track of the descriptor for pointer to
1006  /// blocks.
1008 
1009  /// Gets the struct used to keep track of the extended descriptor for
1010  /// pointer to blocks.
1012 
1014  cudaConfigureCallDecl = FD;
1015  }
1017  return cudaConfigureCallDecl;
1018  }
1019 
1020  /// Returns true iff we need copy/dispose helpers for the given type.
1021  bool BlockRequiresCopying(QualType Ty, const VarDecl *D);
1022 
1023 
1024  /// Returns true, if given type has a known lifetime. HasByrefExtendedLayout is set
1025  /// to false in this case. If HasByrefExtendedLayout returns true, byref variable
1026  /// has extended lifetime.
1027  bool getByrefLifetime(QualType Ty,
1028  Qualifiers::ObjCLifetime &Lifetime,
1029  bool &HasByrefExtendedLayout) const;
1030 
1031  /// \brief Return the uniqued reference to the type for an lvalue reference
1032  /// to the specified type.
1033  QualType getLValueReferenceType(QualType T, bool SpelledAsLValue = true)
1034  const;
1035 
1036  /// \brief Return the uniqued reference to the type for an rvalue reference
1037  /// to the specified type.
1039 
1040  /// \brief Return the uniqued reference to the type for a member pointer to
1041  /// the specified type in the specified class.
1042  ///
1043  /// The class \p Cls is a \c Type because it could be a dependent name.
1044  QualType getMemberPointerType(QualType T, const Type *Cls) const;
1045 
1046  /// \brief Return a non-unique reference to the type for a variable array of
1047  /// the specified element type.
1048  QualType getVariableArrayType(QualType EltTy, Expr *NumElts,
1050  unsigned IndexTypeQuals,
1051  SourceRange Brackets) const;
1052 
1053  /// \brief Return a non-unique reference to the type for a dependently-sized
1054  /// array of the specified element type.
1055  ///
1056  /// FIXME: We will need these to be uniqued, or at least comparable, at some
1057  /// point.
1060  unsigned IndexTypeQuals,
1061  SourceRange Brackets) const;
1062 
1063  /// \brief Return a unique reference to the type for an incomplete array of
1064  /// the specified element type.
1067  unsigned IndexTypeQuals) const;
1068 
1069  /// \brief Return the unique reference to the type for a constant array of
1070  /// the specified element type.
1071  QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize,
1073  unsigned IndexTypeQuals) const;
1074 
1075  /// \brief Returns a vla type where known sizes are replaced with [*].
1077 
1078  /// \brief Return the unique reference to a vector type of the specified
1079  /// element type and size.
1080  ///
1081  /// \pre \p VectorType must be a built-in type.
1082  QualType getVectorType(QualType VectorType, unsigned NumElts,
1083  VectorType::VectorKind VecKind) const;
1084 
1085  /// \brief Return the unique reference to an extended vector type
1086  /// of the specified element type and size.
1087  ///
1088  /// \pre \p VectorType must be a built-in type.
1089  QualType getExtVectorType(QualType VectorType, unsigned NumElts) const;
1090 
1091  /// \pre Return a non-unique reference to the type for a dependently-sized
1092  /// vector of the specified element type.
1093  ///
1094  /// FIXME: We will need these to be uniqued, or at least comparable, at some
1095  /// point.
1097  Expr *SizeExpr,
1098  SourceLocation AttrLoc) const;
1099 
1100  /// \brief Return a K&R style C function type like 'int()'.
1102  const FunctionType::ExtInfo &Info) const;
1103 
1105  return getFunctionNoProtoType(ResultTy, FunctionType::ExtInfo());
1106  }
1107 
1108  /// \brief Return a normal function type with a typed argument list.
1110  const FunctionProtoType::ExtProtoInfo &EPI) const;
1111 
1112  /// \brief Return the unique reference to the type for the specified type
1113  /// declaration.
1115  const TypeDecl *PrevDecl = nullptr) const {
1116  assert(Decl && "Passed null for Decl param");
1117  if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0);
1118 
1119  if (PrevDecl) {
1120  assert(PrevDecl->TypeForDecl && "previous decl has no TypeForDecl");
1121  Decl->TypeForDecl = PrevDecl->TypeForDecl;
1122  return QualType(PrevDecl->TypeForDecl, 0);
1123  }
1124 
1125  return getTypeDeclTypeSlow(Decl);
1126  }
1127 
1128  /// \brief Return the unique reference to the type for the specified
1129  /// typedef-name decl.
1131  QualType Canon = QualType()) const;
1132 
1133  QualType getRecordType(const RecordDecl *Decl) const;
1134 
1135  QualType getEnumType(const EnumDecl *Decl) const;
1136 
1138 
1140  QualType modifiedType,
1141  QualType equivalentType);
1142 
1144  QualType Replacement) const;
1146  const TemplateTypeParmType *Replaced,
1147  const TemplateArgument &ArgPack);
1148 
1149  QualType
1150  getTemplateTypeParmType(unsigned Depth, unsigned Index,
1151  bool ParameterPack,
1152  TemplateTypeParmDecl *ParmDecl = nullptr) const;
1153 
1155  const TemplateArgument *Args,
1156  unsigned NumArgs,
1157  QualType Canon = QualType()) const;
1158 
1160  const TemplateArgument *Args,
1161  unsigned NumArgs) const;
1162 
1164  const TemplateArgumentListInfo &Args,
1165  QualType Canon = QualType()) const;
1166 
1167  TypeSourceInfo *
1169  const TemplateArgumentListInfo &Args,
1170  QualType Canon = QualType()) const;
1171 
1172  QualType getParenType(QualType NamedType) const;
1173 
1175  NestedNameSpecifier *NNS,
1176  QualType NamedType) const;
1178  NestedNameSpecifier *NNS,
1179  const IdentifierInfo *Name,
1180  QualType Canon = QualType()) const;
1181 
1183  NestedNameSpecifier *NNS,
1184  const IdentifierInfo *Name,
1185  const TemplateArgumentListInfo &Args) const;
1187  NestedNameSpecifier *NNS,
1188  const IdentifierInfo *Name,
1189  unsigned NumArgs,
1190  const TemplateArgument *Args) const;
1191 
1193  Optional<unsigned> NumExpansions);
1194 
1196  ObjCInterfaceDecl *PrevDecl = nullptr) const;
1197 
1198  /// Legacy interface: cannot provide type arguments or __kindof.
1200  ObjCProtocolDecl * const *Protocols,
1201  unsigned NumProtocols) const;
1202 
1204  ArrayRef<QualType> typeArgs,
1205  ArrayRef<ObjCProtocolDecl *> protocols,
1206  bool isKindOf) const;
1207 
1209  /// QIdProtocolsAdoptObjCObjectProtocols - Checks that protocols in
1210  /// QT's qualified-id protocol list adopt all protocols in IDecl's list
1211  /// of protocols.
1213  ObjCInterfaceDecl *IDecl);
1214 
1215  /// \brief Return a ObjCObjectPointerType type for the given ObjCObjectType.
1217 
1218  /// \brief GCC extension.
1219  QualType getTypeOfExprType(Expr *e) const;
1220  QualType getTypeOfType(QualType t) const;
1221 
1222  /// \brief C++11 decltype.
1223  QualType getDecltypeType(Expr *e, QualType UnderlyingType) const;
1224 
1225  /// \brief Unary type transforms
1226  QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType,
1227  UnaryTransformType::UTTKind UKind) const;
1228 
1229  /// \brief C++11 deduced auto type.
1230  QualType getAutoType(QualType DeducedType, bool IsDecltypeAuto,
1231  bool IsDependent) const;
1232 
1233  /// \brief C++11 deduction pattern for 'auto' type.
1234  QualType getAutoDeductType() const;
1235 
1236  /// \brief C++11 deduction pattern for 'auto &&' type.
1238 
1239  /// \brief Return the unique reference to the type for the specified TagDecl
1240  /// (struct/union/class/enum) decl.
1241  QualType getTagDeclType(const TagDecl *Decl) const;
1242 
1243  /// \brief Return the unique type for "size_t" (C99 7.17), defined in
1244  /// <stddef.h>.
1245  ///
1246  /// The sizeof operator requires this (C99 6.5.3.4p4).
1247  CanQualType getSizeType() const;
1248 
1249  /// \brief Return the unique type for "intmax_t" (C99 7.18.1.5), defined in
1250  /// <stdint.h>.
1251  CanQualType getIntMaxType() const;
1252 
1253  /// \brief Return the unique type for "uintmax_t" (C99 7.18.1.5), defined in
1254  /// <stdint.h>.
1255  CanQualType getUIntMaxType() const;
1256 
1257  /// \brief Return the unique wchar_t type available in C++ (and available as
1258  /// __wchar_t as a Microsoft extension).
1259  QualType getWCharType() const { return WCharTy; }
1260 
1261  /// \brief Return the type of wide characters. In C++, this returns the
1262  /// unique wchar_t type. In C99, this returns a type compatible with the type
1263  /// defined in <stddef.h> as defined by the target.
1265 
1266  /// \brief Return the type of "signed wchar_t".
1267  ///
1268  /// Used when in C++, as a GCC extension.
1269  QualType getSignedWCharType() const;
1270 
1271  /// \brief Return the type of "unsigned wchar_t".
1272  ///
1273  /// Used when in C++, as a GCC extension.
1275 
1276  /// \brief In C99, this returns a type compatible with the type
1277  /// defined in <stddef.h> as defined by the target.
1278  QualType getWIntType() const { return WIntTy; }
1279 
1280  /// \brief Return a type compatible with "intptr_t" (C99 7.18.1.4),
1281  /// as defined by the target.
1282  QualType getIntPtrType() const;
1283 
1284  /// \brief Return a type compatible with "uintptr_t" (C99 7.18.1.4),
1285  /// as defined by the target.
1286  QualType getUIntPtrType() const;
1287 
1288  /// \brief Return the unique type for "ptrdiff_t" (C99 7.17) defined in
1289  /// <stddef.h>. Pointer - pointer requires this (C99 6.5.6p9).
1290  QualType getPointerDiffType() const;
1291 
1292  /// \brief Return the unique type for "pid_t" defined in
1293  /// <sys/types.h>. We need this to compute the correct type for vfork().
1294  QualType getProcessIDType() const;
1295 
1296  /// \brief Return the C structure type used to represent constant CFStrings.
1298 
1299  /// \brief Returns the C struct type for objc_super
1300  QualType getObjCSuperType() const;
1301  void setObjCSuperType(QualType ST) { ObjCSuperType = ST; }
1302 
1303  /// Get the structure type used to representation CFStrings, or NULL
1304  /// if it hasn't yet been built.
1306  if (CFConstantStringTypeDecl)
1307  return getTagDeclType(CFConstantStringTypeDecl);
1308  return QualType();
1309  }
1311 
1312  // This setter/getter represents the ObjC type for an NSConstantString.
1315  return ObjCConstantStringType;
1316  }
1317 
1319  return ObjCNSStringType;
1320  }
1321 
1323  ObjCNSStringType = T;
1324  }
1325 
1326  /// \brief Retrieve the type that \c id has been defined to, which may be
1327  /// different from the built-in \c id if \c id has been typedef'd.
1329  if (ObjCIdRedefinitionType.isNull())
1330  return getObjCIdType();
1331  return ObjCIdRedefinitionType;
1332  }
1333 
1334  /// \brief Set the user-written type that redefines \c id.
1336  ObjCIdRedefinitionType = RedefType;
1337  }
1338 
1339  /// \brief Retrieve the type that \c Class has been defined to, which may be
1340  /// different from the built-in \c Class if \c Class has been typedef'd.
1342  if (ObjCClassRedefinitionType.isNull())
1343  return getObjCClassType();
1344  return ObjCClassRedefinitionType;
1345  }
1346 
1347  /// \brief Set the user-written type that redefines 'SEL'.
1349  ObjCClassRedefinitionType = RedefType;
1350  }
1351 
1352  /// \brief Retrieve the type that 'SEL' has been defined to, which may be
1353  /// different from the built-in 'SEL' if 'SEL' has been typedef'd.
1355  if (ObjCSelRedefinitionType.isNull())
1356  return getObjCSelType();
1357  return ObjCSelRedefinitionType;
1358  }
1359 
1360 
1361  /// \brief Set the user-written type that redefines 'SEL'.
1363  ObjCSelRedefinitionType = RedefType;
1364  }
1365 
1366  /// Retrieve the identifier 'NSObject'.
1368  if (!NSObjectName) {
1369  NSObjectName = &Idents.get("NSObject");
1370  }
1371 
1372  return NSObjectName;
1373  }
1374 
1375  /// Retrieve the identifier 'NSCopying'.
1377  if (!NSCopyingName) {
1378  NSCopyingName = &Idents.get("NSCopying");
1379  }
1380 
1381  return NSCopyingName;
1382  }
1383 
1384  /// \brief Retrieve the Objective-C "instancetype" type, if already known;
1385  /// otherwise, returns a NULL type;
1388  }
1389 
1390  /// \brief Retrieve the typedef declaration corresponding to the Objective-C
1391  /// "instancetype" type.
1393 
1394  /// \brief Set the type for the C FILE type.
1395  void setFILEDecl(TypeDecl *FILEDecl) { this->FILEDecl = FILEDecl; }
1396 
1397  /// \brief Retrieve the C FILE type.
1399  if (FILEDecl)
1400  return getTypeDeclType(FILEDecl);
1401  return QualType();
1402  }
1403 
1404  /// \brief Set the type for the C jmp_buf type.
1405  void setjmp_bufDecl(TypeDecl *jmp_bufDecl) {
1406  this->jmp_bufDecl = jmp_bufDecl;
1407  }
1408 
1409  /// \brief Retrieve the C jmp_buf type.
1411  if (jmp_bufDecl)
1412  return getTypeDeclType(jmp_bufDecl);
1413  return QualType();
1414  }
1415 
1416  /// \brief Set the type for the C sigjmp_buf type.
1417  void setsigjmp_bufDecl(TypeDecl *sigjmp_bufDecl) {
1418  this->sigjmp_bufDecl = sigjmp_bufDecl;
1419  }
1420 
1421  /// \brief Retrieve the C sigjmp_buf type.
1423  if (sigjmp_bufDecl)
1424  return getTypeDeclType(sigjmp_bufDecl);
1425  return QualType();
1426  }
1427 
1428  /// \brief Set the type for the C ucontext_t type.
1429  void setucontext_tDecl(TypeDecl *ucontext_tDecl) {
1430  this->ucontext_tDecl = ucontext_tDecl;
1431  }
1432 
1433  /// \brief Retrieve the C ucontext_t type.
1435  if (ucontext_tDecl)
1436  return getTypeDeclType(ucontext_tDecl);
1437  return QualType();
1438  }
1439 
1440  /// \brief The result type of logical operations, '<', '>', '!=', etc.
1442  return getLangOpts().CPlusPlus ? BoolTy : IntTy;
1443  }
1444 
1445  /// \brief Emit the Objective-CC type encoding for the given type \p T into
1446  /// \p S.
1447  ///
1448  /// If \p Field is specified then record field names are also encoded.
1449  void getObjCEncodingForType(QualType T, std::string &S,
1450  const FieldDecl *Field=nullptr,
1451  QualType *NotEncodedT=nullptr) const;
1452 
1453  /// \brief Emit the Objective-C property type encoding for the given
1454  /// type \p T into \p S.
1455  void getObjCEncodingForPropertyType(QualType T, std::string &S) const;
1456 
1457  void getLegacyIntegralTypeEncoding(QualType &t) const;
1458 
1459  /// \brief Put the string version of the type qualifiers \p QT into \p S.
1461  std::string &S) const;
1462 
1463  /// \brief Emit the encoded type for the function \p Decl into \p S.
1464  ///
1465  /// This is in the same format as Objective-C method encodings.
1466  ///
1467  /// \returns true if an error occurred (e.g., because one of the parameter
1468  /// types is incomplete), false otherwise.
1469  bool getObjCEncodingForFunctionDecl(const FunctionDecl *Decl, std::string& S);
1470 
1471  /// \brief Emit the encoded type for the method declaration \p Decl into
1472  /// \p S.
1473  ///
1474  /// \returns true if an error occurred (e.g., because one of the parameter
1475  /// types is incomplete), false otherwise.
1476  bool getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl, std::string &S,
1477  bool Extended = false)
1478  const;
1479 
1480  /// \brief Return the encoded type for this block declaration.
1481  std::string getObjCEncodingForBlock(const BlockExpr *blockExpr) const;
1482 
1483  /// getObjCEncodingForPropertyDecl - Return the encoded type for
1484  /// this method declaration. If non-NULL, Container must be either
1485  /// an ObjCCategoryImplDecl or ObjCImplementationDecl; it should
1486  /// only be NULL when getting encodings for protocol properties.
1488  const Decl *Container,
1489  std::string &S) const;
1490 
1492  ObjCProtocolDecl *rProto) const;
1493 
1495  const ObjCPropertyDecl *PD,
1496  const Decl *Container) const;
1497 
1498  /// \brief Return the size of type \p T for Objective-C encoding purpose,
1499  /// in characters.
1501 
1502  /// \brief Retrieve the typedef corresponding to the predefined \c id type
1503  /// in Objective-C.
1504  TypedefDecl *getObjCIdDecl() const;
1505 
1506  /// \brief Represents the Objective-CC \c id type.
1507  ///
1508  /// This is set up lazily, by Sema. \c id is always a (typedef for a)
1509  /// pointer type, a pointer to a struct.
1511  return getTypeDeclType(getObjCIdDecl());
1512  }
1513 
1514  /// \brief Retrieve the typedef corresponding to the predefined 'SEL' type
1515  /// in Objective-C.
1516  TypedefDecl *getObjCSelDecl() const;
1517 
1518  /// \brief Retrieve the type that corresponds to the predefined Objective-C
1519  /// 'SEL' type.
1521  return getTypeDeclType(getObjCSelDecl());
1522  }
1523 
1524  /// \brief Retrieve the typedef declaration corresponding to the predefined
1525  /// Objective-C 'Class' type.
1526  TypedefDecl *getObjCClassDecl() const;
1527 
1528  /// \brief Represents the Objective-C \c Class type.
1529  ///
1530  /// This is set up lazily, by Sema. \c Class is always a (typedef for a)
1531  /// pointer type, a pointer to a struct.
1534  }
1535 
1536  /// \brief Retrieve the Objective-C class declaration corresponding to
1537  /// the predefined \c Protocol class.
1539 
1540  /// \brief Retrieve declaration of 'BOOL' typedef
1542  return BOOLDecl;
1543  }
1544 
1545  /// \brief Save declaration of 'BOOL' typedef
1547  BOOLDecl = TD;
1548  }
1549 
1550  /// \brief type of 'BOOL' type.
1552  return getTypeDeclType(getBOOLDecl());
1553  }
1554 
1555  /// \brief Retrieve the type of the Objective-C \c Protocol class.
1558  }
1559 
1560  /// \brief Retrieve the C type declaration corresponding to the predefined
1561  /// \c __builtin_va_list type.
1563 
1564  /// \brief Retrieve the type of the \c __builtin_va_list type.
1567  }
1568 
1569  /// \brief Retrieve the C type declaration corresponding to the predefined
1570  /// \c __va_list_tag type used to help define the \c __builtin_va_list type
1571  /// for some targets.
1572  QualType getVaListTagType() const;
1573 
1574  /// \brief Return a type with additional \c const, \c volatile, or
1575  /// \c restrict qualifiers.
1576  QualType getCVRQualifiedType(QualType T, unsigned CVR) const {
1577  return getQualifiedType(T, Qualifiers::fromCVRMask(CVR));
1578  }
1579 
1580  /// \brief Un-split a SplitQualType.
1582  return getQualifiedType(split.Ty, split.Quals);
1583  }
1584 
1585  /// \brief Return a type with additional qualifiers.
1587  if (!Qs.hasNonFastQualifiers())
1588  return T.withFastQualifiers(Qs.getFastQualifiers());
1589  QualifierCollector Qc(Qs);
1590  const Type *Ptr = Qc.strip(T);
1591  return getExtQualType(Ptr, Qc);
1592  }
1593 
1594  /// \brief Return a type with additional qualifiers.
1596  if (!Qs.hasNonFastQualifiers())
1597  return QualType(T, Qs.getFastQualifiers());
1598  return getExtQualType(T, Qs);
1599  }
1600 
1601  /// \brief Return a type with the given lifetime qualifier.
1602  ///
1603  /// \pre Neither type.ObjCLifetime() nor \p lifetime may be \c OCL_None.
1605  Qualifiers::ObjCLifetime lifetime) {
1606  assert(type.getObjCLifetime() == Qualifiers::OCL_None);
1607  assert(lifetime != Qualifiers::OCL_None);
1608 
1609  Qualifiers qs;
1610  qs.addObjCLifetime(lifetime);
1611  return getQualifiedType(type, qs);
1612  }
1613 
1614  /// getUnqualifiedObjCPointerType - Returns version of
1615  /// Objective-C pointer type with lifetime qualifier removed.
1617  if (!type.getTypePtr()->isObjCObjectPointerType() ||
1618  !type.getQualifiers().hasObjCLifetime())
1619  return type;
1620  Qualifiers Qs = type.getQualifiers();
1621  Qs.removeObjCLifetime();
1622  return getQualifiedType(type.getUnqualifiedType(), Qs);
1623  }
1624 
1626  SourceLocation NameLoc) const;
1627 
1629  UnresolvedSetIterator End) const;
1630 
1632  bool TemplateKeyword,
1633  TemplateDecl *Template) const;
1634 
1636  const IdentifierInfo *Name) const;
1638  OverloadedOperatorKind Operator) const;
1640  TemplateName replacement) const;
1642  const TemplateArgument &ArgPack) const;
1643 
1645  GE_None, ///< No error
1646  GE_Missing_stdio, ///< Missing a type from <stdio.h>
1647  GE_Missing_setjmp, ///< Missing a type from <setjmp.h>
1648  GE_Missing_ucontext ///< Missing a type from <ucontext.h>
1649  };
1650 
1651  /// \brief Return the type for the specified builtin.
1652  ///
1653  /// If \p IntegerConstantArgs is non-null, it is filled in with a bitmask of
1654  /// arguments to the builtin that are required to be integer constant
1655  /// expressions.
1657  unsigned *IntegerConstantArgs = nullptr) const;
1658 
1659 private:
1660  CanQualType getFromTargetType(unsigned Type) const;
1661  TypeInfo getTypeInfoImpl(const Type *T) const;
1662 
1663  //===--------------------------------------------------------------------===//
1664  // Type Predicates.
1665  //===--------------------------------------------------------------------===//
1666 
1667 public:
1668  /// \brief Return one of the GCNone, Weak or Strong Objective-C garbage
1669  /// collection attributes.
1671 
1672  /// \brief Return true if the given vector types are of the same unqualified
1673  /// type or if they are equivalent to the same GCC vector type.
1674  ///
1675  /// \note This ignores whether they are target-specific (AltiVec or Neon)
1676  /// types.
1677  bool areCompatibleVectorTypes(QualType FirstVec, QualType SecondVec);
1678 
1679  /// \brief Return true if this is an \c NSObject object with its \c NSObject
1680  /// attribute set.
1681  static bool isObjCNSObjectType(QualType Ty) {
1682  return Ty->isObjCNSObjectType();
1683  }
1684 
1685  //===--------------------------------------------------------------------===//
1686  // Type Sizing and Analysis
1687  //===--------------------------------------------------------------------===//
1688 
1689  /// \brief Return the APFloat 'semantics' for the specified scalar floating
1690  /// point type.
1691  const llvm::fltSemantics &getFloatTypeSemantics(QualType T) const;
1692 
1693  /// \brief Get the size and alignment of the specified complete type in bits.
1694  TypeInfo getTypeInfo(const Type *T) const;
1696 
1697  /// \brief Get default simd alignment of the specified complete type in bits.
1698  unsigned getOpenMPDefaultSimdAlign(QualType T) const;
1699 
1700  /// \brief Return the size of the specified (complete) type \p T, in bits.
1701  uint64_t getTypeSize(QualType T) const { return getTypeInfo(T).Width; }
1702  uint64_t getTypeSize(const Type *T) const { return getTypeInfo(T).Width; }
1703 
1704  /// \brief Return the size of the character type, in bits.
1705  uint64_t getCharWidth() const {
1706  return getTypeSize(CharTy);
1707  }
1708 
1709  /// \brief Convert a size in bits to a size in characters.
1710  CharUnits toCharUnitsFromBits(int64_t BitSize) const;
1711 
1712  /// \brief Convert a size in characters to a size in bits.
1713  int64_t toBits(CharUnits CharSize) const;
1714 
1715  /// \brief Return the size of the specified (complete) type \p T, in
1716  /// characters.
1718  CharUnits getTypeSizeInChars(const Type *T) const;
1719 
1720  /// \brief Return the ABI-specified alignment of a (complete) type \p T, in
1721  /// bits.
1722  unsigned getTypeAlign(QualType T) const { return getTypeInfo(T).Align; }
1723  unsigned getTypeAlign(const Type *T) const { return getTypeInfo(T).Align; }
1724 
1725  /// \brief Return the ABI-specified alignment of a (complete) type \p T, in
1726  /// characters.
1728  CharUnits getTypeAlignInChars(const Type *T) const;
1729 
1730  // getTypeInfoDataSizeInChars - Return the size of a type, in chars. If the
1731  // type is a record, its data size is returned.
1732  std::pair<CharUnits, CharUnits> getTypeInfoDataSizeInChars(QualType T) const;
1733 
1734  std::pair<CharUnits, CharUnits> getTypeInfoInChars(const Type *T) const;
1735  std::pair<CharUnits, CharUnits> getTypeInfoInChars(QualType T) const;
1736 
1737  /// \brief Determine if the alignment the type has was required using an
1738  /// alignment attribute.
1739  bool isAlignmentRequired(const Type *T) const;
1740  bool isAlignmentRequired(QualType T) const;
1741 
1742  /// \brief Return the "preferred" alignment of the specified type \p T for
1743  /// the current target, in bits.
1744  ///
1745  /// This can be different than the ABI alignment in cases where it is
1746  /// beneficial for performance to overalign a data type.
1747  unsigned getPreferredTypeAlign(const Type *T) const;
1748 
1749  /// \brief Return the default alignment for __attribute__((aligned)) on
1750  /// this target, to be used if no alignment value is specified.
1751  unsigned getTargetDefaultAlignForAttributeAligned(void) const;
1752 
1753  /// \brief Return the alignment in bits that should be given to a
1754  /// global variable with type \p T.
1755  unsigned getAlignOfGlobalVar(QualType T) const;
1756 
1757  /// \brief Return the alignment in characters that should be given to a
1758  /// global variable with type \p T.
1760 
1761  /// \brief Return a conservative estimate of the alignment of the specified
1762  /// decl \p D.
1763  ///
1764  /// \pre \p D must not be a bitfield type, as bitfields do not have a valid
1765  /// alignment.
1766  ///
1767  /// If \p ForAlignof, references are treated like their underlying type
1768  /// and large arrays don't get any special treatment. If not \p ForAlignof
1769  /// it computes the value expected by CodeGen: references are treated like
1770  /// pointers and large arrays get extra alignment.
1771  CharUnits getDeclAlign(const Decl *D, bool ForAlignof = false) const;
1772 
1773  /// \brief Get or compute information about the layout of the specified
1774  /// record (struct/union/class) \p D, which indicates its size and field
1775  /// position information.
1776  const ASTRecordLayout &getASTRecordLayout(const RecordDecl *D) const;
1778 
1779  /// \brief Get or compute information about the layout of the specified
1780  /// Objective-C interface.
1782  const;
1783 
1784  void DumpRecordLayout(const RecordDecl *RD, raw_ostream &OS,
1785  bool Simple = false) const;
1786 
1787  /// \brief Get or compute information about the layout of the specified
1788  /// Objective-C implementation.
1789  ///
1790  /// This may differ from the interface if synthesized ivars are present.
1791  const ASTRecordLayout &
1793 
1794  /// \brief Get our current best idea for the key function of the
1795  /// given record decl, or NULL if there isn't one.
1796  ///
1797  /// The key function is, according to the Itanium C++ ABI section 5.2.3:
1798  /// ...the first non-pure virtual function that is not inline at the
1799  /// point of class definition.
1800  ///
1801  /// Other ABIs use the same idea. However, the ARM C++ ABI ignores
1802  /// virtual functions that are defined 'inline', which means that
1803  /// the result of this computation can change.
1805 
1806  /// \brief Observe that the given method cannot be a key function.
1807  /// Checks the key-function cache for the method's class and clears it
1808  /// if matches the given declaration.
1809  ///
1810  /// This is used in ABIs where out-of-line definitions marked
1811  /// inline are not considered to be key functions.
1812  ///
1813  /// \param method should be the declaration from the class definition
1814  void setNonKeyFunction(const CXXMethodDecl *method);
1815 
1816  /// Loading virtual member pointers using the virtual inheritance model
1817  /// always results in an adjustment using the vbtable even if the index is
1818  /// zero.
1819  ///
1820  /// This is usually OK because the first slot in the vbtable points
1821  /// backwards to the top of the MDC. However, the MDC might be reusing a
1822  /// vbptr from an nv-base. In this case, the first slot in the vbtable
1823  /// points to the start of the nv-base which introduced the vbptr and *not*
1824  /// the MDC. Modify the NonVirtualBaseAdjustment to account for this.
1826 
1827  /// Get the offset of a FieldDecl or IndirectFieldDecl, in bits.
1828  uint64_t getFieldOffset(const ValueDecl *FD) const;
1829 
1830  bool isNearlyEmpty(const CXXRecordDecl *RD) const;
1831 
1833 
1835 
1836  void DeepCollectObjCIvars(const ObjCInterfaceDecl *OI, bool leafClass,
1838 
1839  unsigned CountNonClassIvars(const ObjCInterfaceDecl *OI) const;
1840  void CollectInheritedProtocols(const Decl *CDecl,
1841  llvm::SmallPtrSet<ObjCProtocolDecl*, 8> &Protocols);
1842 
1843  //===--------------------------------------------------------------------===//
1844  // Type Operators
1845  //===--------------------------------------------------------------------===//
1846 
1847  /// \brief Return the canonical (structural) type corresponding to the
1848  /// specified potentially non-canonical type \p T.
1849  ///
1850  /// The non-canonical version of a type may have many "decorated" versions of
1851  /// types. Decorators can include typedefs, 'typeof' operators, etc. The
1852  /// returned type is guaranteed to be free of any of these, allowing two
1853  /// canonical types to be compared for exact equality with a simple pointer
1854  /// comparison.
1857  }
1858 
1859  const Type *getCanonicalType(const Type *T) const {
1860  return T->getCanonicalTypeInternal().getTypePtr();
1861  }
1862 
1863  /// \brief Return the canonical parameter type corresponding to the specific
1864  /// potentially non-canonical one.
1865  ///
1866  /// Qualifiers are stripped off, functions are turned into function
1867  /// pointers, and arrays decay one level into pointers.
1869 
1870  /// \brief Determine whether the given types \p T1 and \p T2 are equivalent.
1871  bool hasSameType(QualType T1, QualType T2) const {
1872  return getCanonicalType(T1) == getCanonicalType(T2);
1873  }
1874 
1875  bool hasSameType(const Type *T1, const Type *T2) const {
1876  return getCanonicalType(T1) == getCanonicalType(T2);
1877  }
1878 
1879  /// \brief Return this type as a completely-unqualified array type,
1880  /// capturing the qualifiers in \p Quals.
1881  ///
1882  /// This will remove the minimal amount of sugaring from the types, similar
1883  /// to the behavior of QualType::getUnqualifiedType().
1884  ///
1885  /// \param T is the qualified type, which may be an ArrayType
1886  ///
1887  /// \param Quals will receive the full set of qualifiers that were
1888  /// applied to the array.
1889  ///
1890  /// \returns if this is an array type, the completely unqualified array type
1891  /// that corresponds to it. Otherwise, returns T.getUnqualifiedType().
1893 
1894  /// \brief Determine whether the given types are equivalent after
1895  /// cvr-qualifiers have been removed.
1897  return getCanonicalType(T1).getTypePtr() ==
1899  }
1900 
1902  bool IsParam) const {
1903  auto SubTnullability = SubT->getNullability(*this);
1904  auto SuperTnullability = SuperT->getNullability(*this);
1905  if (SubTnullability.hasValue() == SuperTnullability.hasValue()) {
1906  // Neither has nullability; return true
1907  if (!SubTnullability)
1908  return true;
1909  // Both have nullability qualifier.
1910  if (*SubTnullability == *SuperTnullability ||
1911  *SubTnullability == NullabilityKind::Unspecified ||
1912  *SuperTnullability == NullabilityKind::Unspecified)
1913  return true;
1914 
1915  if (IsParam) {
1916  // Ok for the superclass method parameter to be "nonnull" and the subclass
1917  // method parameter to be "nullable"
1918  return (*SuperTnullability == NullabilityKind::NonNull &&
1919  *SubTnullability == NullabilityKind::Nullable);
1920  }
1921  else {
1922  // For the return type, it's okay for the superclass method to specify
1923  // "nullable" and the subclass method specify "nonnull"
1924  return (*SuperTnullability == NullabilityKind::Nullable &&
1925  *SubTnullability == NullabilityKind::NonNull);
1926  }
1927  }
1928  return true;
1929  }
1930 
1931  bool ObjCMethodsAreEqual(const ObjCMethodDecl *MethodDecl,
1932  const ObjCMethodDecl *MethodImp);
1933 
1935 
1936  /// \brief Retrieves the "canonical" nested name specifier for a
1937  /// given nested name specifier.
1938  ///
1939  /// The canonical nested name specifier is a nested name specifier
1940  /// that uniquely identifies a type or namespace within the type
1941  /// system. For example, given:
1942  ///
1943  /// \code
1944  /// namespace N {
1945  /// struct S {
1946  /// template<typename T> struct X { typename T* type; };
1947  /// };
1948  /// }
1949  ///
1950  /// template<typename T> struct Y {
1951  /// typename N::S::X<T>::type member;
1952  /// };
1953  /// \endcode
1954  ///
1955  /// Here, the nested-name-specifier for N::S::X<T>:: will be
1956  /// S::X<template-param-0-0>, since 'S' and 'X' are uniquely defined
1957  /// by declarations in the type system and the canonical type for
1958  /// the template type parameter 'T' is template-param-0-0.
1961 
1962  /// \brief Retrieves the default calling convention for the current target.
1963  CallingConv getDefaultCallingConvention(bool isVariadic,
1964  bool IsCXXMethod) const;
1965 
1966  /// \brief Retrieves the "canonical" template name that refers to a
1967  /// given template.
1968  ///
1969  /// The canonical template name is the simplest expression that can
1970  /// be used to refer to a given template. For most templates, this
1971  /// expression is just the template declaration itself. For example,
1972  /// the template std::vector can be referred to via a variety of
1973  /// names---std::vector, \::std::vector, vector (if vector is in
1974  /// scope), etc.---but all of these names map down to the same
1975  /// TemplateDecl, which is used to form the canonical template name.
1976  ///
1977  /// Dependent template names are more interesting. Here, the
1978  /// template name could be something like T::template apply or
1979  /// std::allocator<T>::template rebind, where the nested name
1980  /// specifier itself is dependent. In this case, the canonical
1981  /// template name uses the shortest form of the dependent
1982  /// nested-name-specifier, which itself contains all canonical
1983  /// types, values, and templates.
1985 
1986  /// \brief Determine whether the given template names refer to the same
1987  /// template.
1989 
1990  /// \brief Retrieve the "canonical" template argument.
1991  ///
1992  /// The canonical template argument is the simplest template argument
1993  /// (which may be a type, value, expression, or declaration) that
1994  /// expresses the value of the argument.
1996  const;
1997 
1998  /// Type Query functions. If the type is an instance of the specified class,
1999  /// return the Type pointer for the underlying maximally pretty type. This
2000  /// is a member of ASTContext because this may need to do some amount of
2001  /// canonicalization, e.g. to move type qualifiers into the element type.
2002  const ArrayType *getAsArrayType(QualType T) const;
2004  return dyn_cast_or_null<ConstantArrayType>(getAsArrayType(T));
2005  }
2007  return dyn_cast_or_null<VariableArrayType>(getAsArrayType(T));
2008  }
2010  return dyn_cast_or_null<IncompleteArrayType>(getAsArrayType(T));
2011  }
2013  const {
2014  return dyn_cast_or_null<DependentSizedArrayType>(getAsArrayType(T));
2015  }
2016 
2017  /// \brief Return the innermost element type of an array type.
2018  ///
2019  /// For example, will return "int" for int[m][n]
2020  QualType getBaseElementType(const ArrayType *VAT) const;
2021 
2022  /// \brief Return the innermost element type of a type (which needn't
2023  /// actually be an array type).
2025 
2026  /// \brief Return number of constant array elements.
2027  uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const;
2028 
2029  /// \brief Perform adjustment on the parameter type of a function.
2030  ///
2031  /// This routine adjusts the given parameter type @p T to the actual
2032  /// parameter type used by semantic analysis (C99 6.7.5.3p[7,8],
2033  /// C++ [dcl.fct]p3). The adjusted parameter type is returned.
2035 
2036  /// \brief Retrieve the parameter type as adjusted for use in the signature
2037  /// of a function, decaying array and function types and removing top-level
2038  /// cv-qualifiers.
2040 
2042 
2043  /// \brief Return the properly qualified result of decaying the specified
2044  /// array type to a pointer.
2045  ///
2046  /// This operation is non-trivial when handling typedefs etc. The canonical
2047  /// type of \p T must be an array type, this returns a pointer to a properly
2048  /// qualified element of the array.
2049  ///
2050  /// See C99 6.7.5.3p7 and C99 6.3.2.1p3.
2052 
2053  /// \brief Return the type that \p PromotableType will promote to: C99
2054  /// 6.3.1.1p2, assuming that \p PromotableType is a promotable integer type.
2055  QualType getPromotedIntegerType(QualType PromotableType) const;
2056 
2057  /// \brief Recurses in pointer/array types until it finds an Objective-C
2058  /// retainable type and returns its ownership.
2060 
2061  /// \brief Whether this is a promotable bitfield reference according
2062  /// to C99 6.3.1.1p2, bullet 2 (and GCC extensions).
2063  ///
2064  /// \returns the type this bit-field will promote to, or NULL if no
2065  /// promotion occurs.
2067 
2068  /// \brief Return the highest ranked integer type, see C99 6.3.1.8p1.
2069  ///
2070  /// If \p LHS > \p RHS, returns 1. If \p LHS == \p RHS, returns 0. If
2071  /// \p LHS < \p RHS, return -1.
2072  int getIntegerTypeOrder(QualType LHS, QualType RHS) const;
2073 
2074  /// \brief Compare the rank of the two specified floating point types,
2075  /// ignoring the domain of the type (i.e. 'double' == '_Complex double').
2076  ///
2077  /// If \p LHS > \p RHS, returns 1. If \p LHS == \p RHS, returns 0. If
2078  /// \p LHS < \p RHS, return -1.
2079  int getFloatingTypeOrder(QualType LHS, QualType RHS) const;
2080 
2081  /// \brief Return a real floating point or a complex type (based on
2082  /// \p typeDomain/\p typeSize).
2083  ///
2084  /// \param typeDomain a real floating point or complex type.
2085  /// \param typeSize a real floating point or complex type.
2087  QualType typeDomain) const;
2088 
2089  unsigned getTargetAddressSpace(QualType T) const {
2091  }
2092 
2093  unsigned getTargetAddressSpace(Qualifiers Q) const {
2095  }
2096 
2097  unsigned getTargetAddressSpace(unsigned AS) const {
2098  if (AS < LangAS::Offset || AS >= LangAS::Offset + LangAS::Count)
2099  return AS;
2100  else
2101  return (*AddrSpaceMap)[AS - LangAS::Offset];
2102  }
2103 
2104  bool addressSpaceMapManglingFor(unsigned AS) const {
2105  return AddrSpaceMapMangling ||
2106  AS < LangAS::Offset ||
2107  AS >= LangAS::Offset + LangAS::Count;
2108  }
2109 
2110 private:
2111  // Helper for integer ordering
2112  unsigned getIntegerRank(const Type *T) const;
2113 
2114 public:
2115 
2116  //===--------------------------------------------------------------------===//
2117  // Type Compatibility Predicates
2118  //===--------------------------------------------------------------------===//
2119 
2120  /// Compatibility predicates used to check assignment expressions.
2121  bool typesAreCompatible(QualType T1, QualType T2,
2122  bool CompareUnqualified = false); // C99 6.2.7p1
2123 
2126 
2127  bool isObjCIdType(QualType T) const {
2128  return T == getObjCIdType();
2129  }
2130  bool isObjCClassType(QualType T) const {
2131  return T == getObjCClassType();
2132  }
2133  bool isObjCSelType(QualType T) const {
2134  return T == getObjCSelType();
2135  }
2137  bool ForCompare);
2138 
2140 
2141  // Check the safety of assignment from LHS to RHS
2143  const ObjCObjectPointerType *RHSOPT);
2144  bool canAssignObjCInterfaces(const ObjCObjectType *LHS,
2145  const ObjCObjectType *RHS);
2147  const ObjCObjectPointerType *LHSOPT,
2148  const ObjCObjectPointerType *RHSOPT,
2149  bool BlockReturnType);
2152  const ObjCObjectPointerType *RHSOPT);
2153  bool canBindObjCObjectType(QualType To, QualType From);
2154 
2155  // Functions for calculating composite types
2156  QualType mergeTypes(QualType, QualType, bool OfBlockPointer=false,
2157  bool Unqualified = false, bool BlockReturnType = false);
2158  QualType mergeFunctionTypes(QualType, QualType, bool OfBlockPointer=false,
2159  bool Unqualified = false);
2161  bool OfBlockPointer = false,
2162  bool Unqualified = false);
2164  bool OfBlockPointer=false,
2165  bool Unqualified = false);
2166 
2168 
2170  const FunctionProtoType *FromFunctionType,
2171  const FunctionProtoType *ToFunctionType);
2172 
2174  ObjCLayouts[CD] = nullptr;
2175  }
2176 
2177  //===--------------------------------------------------------------------===//
2178  // Integer Predicates
2179  //===--------------------------------------------------------------------===//
2180 
2181  // The width of an integer, as defined in C99 6.2.6.2. This is the number
2182  // of bits in an integer type excluding any padding bits.
2183  unsigned getIntWidth(QualType T) const;
2184 
2185  // Per C99 6.2.5p6, for every signed integer type, there is a corresponding
2186  // unsigned integer type. This method takes a signed type, and returns the
2187  // corresponding unsigned integer type.
2189 
2190  //===--------------------------------------------------------------------===//
2191  // Type Iterators.
2192  //===--------------------------------------------------------------------===//
2193  typedef llvm::iterator_range<SmallVectorImpl<Type *>::const_iterator>
2195 
2197  return type_const_range(Types.begin(), Types.end());
2198  }
2199 
2200  //===--------------------------------------------------------------------===//
2201  // Integer Values
2202  //===--------------------------------------------------------------------===//
2203 
2204  /// \brief Make an APSInt of the appropriate width and signedness for the
2205  /// given \p Value and integer \p Type.
2206  llvm::APSInt MakeIntValue(uint64_t Value, QualType Type) const {
2207  llvm::APSInt Res(getIntWidth(Type),
2209  Res = Value;
2210  return Res;
2211  }
2212 
2213  bool isSentinelNullExpr(const Expr *E);
2214 
2215  /// \brief Get the implementation of the ObjCInterfaceDecl \p D, or NULL if
2216  /// none exists.
2218  /// \brief Get the implementation of the ObjCCategoryDecl \p D, or NULL if
2219  /// none exists.
2221 
2222  /// \brief Return true if there is at least one \@implementation in the TU.
2224  return !ObjCImpls.empty();
2225  }
2226 
2227  /// \brief Set the implementation of ObjCInterfaceDecl.
2229  ObjCImplementationDecl *ImplD);
2230  /// \brief Set the implementation of ObjCCategoryDecl.
2232  ObjCCategoryImplDecl *ImplD);
2233 
2234  /// \brief Get the duplicate declaration of a ObjCMethod in the same
2235  /// interface, or null if none exists.
2237  const ObjCMethodDecl *MD) const {
2238  return ObjCMethodRedecls.lookup(MD);
2239  }
2240 
2242  const ObjCMethodDecl *Redecl) {
2243  assert(!getObjCMethodRedeclaration(MD) && "MD already has a redeclaration");
2244  ObjCMethodRedecls[MD] = Redecl;
2245  }
2246 
2247  /// \brief Returns the Objective-C interface that \p ND belongs to if it is
2248  /// an Objective-C method/property/ivar etc. that is part of an interface,
2249  /// otherwise returns null.
2250  const ObjCInterfaceDecl *getObjContainingInterface(const NamedDecl *ND) const;
2251 
2252  /// \brief Set the copy inialization expression of a block var decl.
2253  void setBlockVarCopyInits(VarDecl*VD, Expr* Init);
2254  /// \brief Get the copy initialization expression of the VarDecl \p VD, or
2255  /// NULL if none exists.
2256  Expr *getBlockVarCopyInits(const VarDecl* VD);
2257 
2258  /// \brief Allocate an uninitialized TypeSourceInfo.
2259  ///
2260  /// The caller should initialize the memory held by TypeSourceInfo using
2261  /// the TypeLoc wrappers.
2262  ///
2263  /// \param T the type that will be the basis for type source info. This type
2264  /// should refer to how the declarator was written in source code, not to
2265  /// what type semantic analysis resolved the declarator to.
2266  ///
2267  /// \param Size the size of the type info to create, or 0 if the size
2268  /// should be calculated based on the type.
2269  TypeSourceInfo *CreateTypeSourceInfo(QualType T, unsigned Size = 0) const;
2270 
2271  /// \brief Allocate a TypeSourceInfo where all locations have been
2272  /// initialized to a given location, which defaults to the empty
2273  /// location.
2274  TypeSourceInfo *
2276  SourceLocation Loc = SourceLocation()) const;
2277 
2278  /// \brief Add a deallocation callback that will be invoked when the
2279  /// ASTContext is destroyed.
2280  ///
2281  /// \param Callback A callback function that will be invoked on destruction.
2282  ///
2283  /// \param Data Pointer data that will be provided to the callback function
2284  /// when it is called.
2285  void AddDeallocation(void (*Callback)(void*), void *Data);
2286 
2289 
2290  /// \brief Determines if the decl can be CodeGen'ed or deserialized from PCH
2291  /// lazily, only when used; this is only relevant for function or file scoped
2292  /// var definitions.
2293  ///
2294  /// \returns true if the function/var must be CodeGen'ed/deserialized even if
2295  /// it is not used.
2296  bool DeclMustBeEmitted(const Decl *D);
2297 
2298  const CXXConstructorDecl *
2300 
2302  CXXConstructorDecl *CD);
2303 
2305  unsigned ParmIdx, Expr *DAE);
2306 
2308  unsigned ParmIdx);
2309 
2310  void setManglingNumber(const NamedDecl *ND, unsigned Number);
2311  unsigned getManglingNumber(const NamedDecl *ND) const;
2312 
2313  void setStaticLocalNumber(const VarDecl *VD, unsigned Number);
2314  unsigned getStaticLocalNumber(const VarDecl *VD) const;
2315 
2316  /// \brief Retrieve the context for computing mangling numbers in the given
2317  /// DeclContext.
2319 
2321 
2322  /// \brief Used by ParmVarDecl to store on the side the
2323  /// index of the parameter when it exceeds the size of the normal bitfield.
2324  void setParameterIndex(const ParmVarDecl *D, unsigned index);
2325 
2326  /// \brief Used by ParmVarDecl to retrieve on the side the
2327  /// index of the parameter when it exceeds the size of the normal bitfield.
2328  unsigned getParameterIndex(const ParmVarDecl *D) const;
2329 
2330  /// \brief Get the storage for the constant value of a materialized temporary
2331  /// of static storage duration.
2333  bool MayCreate);
2334 
2335  //===--------------------------------------------------------------------===//
2336  // Statistics
2337  //===--------------------------------------------------------------------===//
2338 
2339  /// \brief The number of implicitly-declared default constructors.
2341 
2342  /// \brief The number of implicitly-declared default constructors for
2343  /// which declarations were built.
2345 
2346  /// \brief The number of implicitly-declared copy constructors.
2348 
2349  /// \brief The number of implicitly-declared copy constructors for
2350  /// which declarations were built.
2352 
2353  /// \brief The number of implicitly-declared move constructors.
2355 
2356  /// \brief The number of implicitly-declared move constructors for
2357  /// which declarations were built.
2359 
2360  /// \brief The number of implicitly-declared copy assignment operators.
2362 
2363  /// \brief The number of implicitly-declared copy assignment operators for
2364  /// which declarations were built.
2366 
2367  /// \brief The number of implicitly-declared move assignment operators.
2369 
2370  /// \brief The number of implicitly-declared move assignment operators for
2371  /// which declarations were built.
2373 
2374  /// \brief The number of implicitly-declared destructors.
2375  static unsigned NumImplicitDestructors;
2376 
2377  /// \brief The number of implicitly-declared destructors for which
2378  /// declarations were built.
2380 
2381 private:
2382  ASTContext(const ASTContext &) = delete;
2383  void operator=(const ASTContext &) = delete;
2384 
2385 public:
2386  /// \brief Initialize built-in types.
2387  ///
2388  /// This routine may only be invoked once for a given ASTContext object.
2389  /// It is normally invoked after ASTContext construction.
2390  ///
2391  /// \param Target The target
2392  void InitBuiltinTypes(const TargetInfo &Target);
2393 
2394 private:
2395  void InitBuiltinType(CanQualType &R, BuiltinType::Kind K);
2396 
2397  // Return the Objective-C type encoding for a given type.
2398  void getObjCEncodingForTypeImpl(QualType t, std::string &S,
2399  bool ExpandPointedToStructures,
2400  bool ExpandStructures,
2401  const FieldDecl *Field,
2402  bool OutermostType = false,
2403  bool EncodingProperty = false,
2404  bool StructField = false,
2405  bool EncodeBlockParameters = false,
2406  bool EncodeClassNames = false,
2407  bool EncodePointerToObjCTypedef = false,
2408  QualType *NotEncodedT=nullptr) const;
2409 
2410  // Adds the encoding of the structure's members.
2411  void getObjCEncodingForStructureImpl(RecordDecl *RD, std::string &S,
2412  const FieldDecl *Field,
2413  bool includeVBases = true,
2414  QualType *NotEncodedT=nullptr) const;
2415 public:
2416  // Adds the encoding of a method parameter or return type.
2418  QualType T, std::string& S,
2419  bool Extended) const;
2420 
2421  /// \brief Returns true if this is an inline-initialized static data member
2422  /// which is treated as a definition for MSVC compatibility.
2423  bool isMSStaticDataMemberInlineDefinition(const VarDecl *VD) const;
2424 
2425 private:
2426  const ASTRecordLayout &
2427  getObjCLayout(const ObjCInterfaceDecl *D,
2428  const ObjCImplementationDecl *Impl) const;
2429 
2430  /// \brief A set of deallocations that should be performed when the
2431  /// ASTContext is destroyed.
2432  typedef llvm::SmallDenseMap<void(*)(void*), llvm::SmallVector<void*, 16> >
2433  DeallocationMap;
2434  DeallocationMap Deallocations;
2435 
2436  // FIXME: This currently contains the set of StoredDeclMaps used
2437  // by DeclContext objects. This probably should not be in ASTContext,
2438  // but we include it here so that ASTContext can quickly deallocate them.
2439  llvm::PointerIntPair<StoredDeclsMap*,1> LastSDM;
2440 
2441  friend class DeclContext;
2442  friend class DeclarationNameTable;
2443  void ReleaseDeclContextMaps();
2444  void ReleaseParentMapEntries();
2445 
2446  std::unique_ptr<ParentMap> AllParents;
2447 
2448  std::unique_ptr<VTableContextBase> VTContext;
2449 
2450 public:
2451  enum PragmaSectionFlag : unsigned {
2453  PSF_Read = 0x1,
2454  PSF_Write = 0x2,
2457  PSF_Invalid = 0x80000000U,
2458  };
2459 
2460  struct SectionInfo {
2467  int SectionFlags)
2468  : Decl(Decl),
2469  PragmaSectionLocation(PragmaSectionLocation),
2470  SectionFlags(SectionFlags) {}
2471  };
2472 
2473  llvm::StringMap<SectionInfo> SectionInfos;
2474 };
2475 
2476 /// \brief Utility function for constructing a nullary selector.
2477 static inline Selector GetNullarySelector(StringRef name, ASTContext& Ctx) {
2478  IdentifierInfo* II = &Ctx.Idents.get(name);
2479  return Ctx.Selectors.getSelector(0, &II);
2480 }
2481 
2482 /// \brief Utility function for constructing an unary selector.
2483 static inline Selector GetUnarySelector(StringRef name, ASTContext& Ctx) {
2484  IdentifierInfo* II = &Ctx.Idents.get(name);
2485  return Ctx.Selectors.getSelector(1, &II);
2486 }
2487 
2488 } // end namespace clang
2489 
2490 // operator new and delete aren't allowed inside namespaces.
2491 
2492 /// @brief Placement new for using the ASTContext's allocator.
2493 ///
2494 /// This placement form of operator new uses the ASTContext's allocator for
2495 /// obtaining memory.
2496 ///
2497 /// IMPORTANT: These are also declared in clang/AST/AttrIterator.h! Any changes
2498 /// here need to also be made there.
2499 ///
2500 /// We intentionally avoid using a nothrow specification here so that the calls
2501 /// to this operator will not perform a null check on the result -- the
2502 /// underlying allocator never returns null pointers.
2503 ///
2504 /// Usage looks like this (assuming there's an ASTContext 'Context' in scope):
2505 /// @code
2506 /// // Default alignment (8)
2507 /// IntegerLiteral *Ex = new (Context) IntegerLiteral(arguments);
2508 /// // Specific alignment
2509 /// IntegerLiteral *Ex2 = new (Context, 4) IntegerLiteral(arguments);
2510 /// @endcode
2511 /// Memory allocated through this placement new operator does not need to be
2512 /// explicitly freed, as ASTContext will free all of this memory when it gets
2513 /// destroyed. Please note that you cannot use delete on the pointer.
2514 ///
2515 /// @param Bytes The number of bytes to allocate. Calculated by the compiler.
2516 /// @param C The ASTContext that provides the allocator.
2517 /// @param Alignment The alignment of the allocated memory (if the underlying
2518 /// allocator supports it).
2519 /// @return The allocated memory. Could be NULL.
2520 inline void *operator new(size_t Bytes, const clang::ASTContext &C,
2521  size_t Alignment) {
2522  return C.Allocate(Bytes, Alignment);
2523 }
2524 /// @brief Placement delete companion to the new above.
2525 ///
2526 /// This operator is just a companion to the new above. There is no way of
2527 /// invoking it directly; see the new operator for more details. This operator
2528 /// is called implicitly by the compiler if a placement new expression using
2529 /// the ASTContext throws in the object constructor.
2530 inline void operator delete(void *Ptr, const clang::ASTContext &C, size_t) {
2531  C.Deallocate(Ptr);
2532 }
2533 
2534 /// This placement form of operator new[] uses the ASTContext's allocator for
2535 /// obtaining memory.
2536 ///
2537 /// We intentionally avoid using a nothrow specification here so that the calls
2538 /// to this operator will not perform a null check on the result -- the
2539 /// underlying allocator never returns null pointers.
2540 ///
2541 /// Usage looks like this (assuming there's an ASTContext 'Context' in scope):
2542 /// @code
2543 /// // Default alignment (8)
2544 /// char *data = new (Context) char[10];
2545 /// // Specific alignment
2546 /// char *data = new (Context, 4) char[10];
2547 /// @endcode
2548 /// Memory allocated through this placement new[] operator does not need to be
2549 /// explicitly freed, as ASTContext will free all of this memory when it gets
2550 /// destroyed. Please note that you cannot use delete on the pointer.
2551 ///
2552 /// @param Bytes The number of bytes to allocate. Calculated by the compiler.
2553 /// @param C The ASTContext that provides the allocator.
2554 /// @param Alignment The alignment of the allocated memory (if the underlying
2555 /// allocator supports it).
2556 /// @return The allocated memory. Could be NULL.
2557 inline void *operator new[](size_t Bytes, const clang::ASTContext& C,
2558  size_t Alignment = 8) {
2559  return C.Allocate(Bytes, Alignment);
2560 }
2561 
2562 /// @brief Placement delete[] companion to the new[] above.
2563 ///
2564 /// This operator is just a companion to the new[] above. There is no way of
2565 /// invoking it directly; see the new[] operator for more details. This operator
2566 /// is called implicitly by the compiler if a placement new[] expression using
2567 /// the ASTContext throws in the object constructor.
2568 inline void operator delete[](void *Ptr, const clang::ASTContext &C, size_t) {
2569  C.Deallocate(Ptr);
2570 }
2571 
2572 /// \brief Create the representation of a LazyGenerationalUpdatePtr.
2573 template <typename Owner, typename T,
2574  void (clang::ExternalASTSource::*Update)(Owner)>
2577  const clang::ASTContext &Ctx, T Value) {
2578  // Note, this is implemented here so that ExternalASTSource.h doesn't need to
2579  // include ASTContext.h. We explicitly instantiate it for all relevant types
2580  // in ASTContext.cpp.
2581  if (auto *Source = Ctx.getExternalSource())
2582  return new (Ctx) LazyData(Source, Value);
2583  return Value;
2584 }
2585 
2586 #endif
static CanQual< Type > CreateUnsafe(QualType Other)
Builds a canonical type from a QualType.
void setExternalSource(IntrusiveRefCntPtr< ExternalASTSource > Source)
Attach an external AST source to the AST context.
Definition: ASTContext.cpp:806
MemberSpecializationInfo * getInstantiatedFromStaticDataMember(const VarDecl *Var)
If this variable is an instantiated static data member of a class template specialization, returns the templated static data member from which it was instantiated.
TypedefDecl * getObjCInstanceTypeDecl()
Retrieve the typedef declaration corresponding to the Objective-C "instancetype" type.
void setPrimaryMergedDecl(Decl *D, Decl *Primary)
Definition: ASTContext.h:791
int getFloatingTypeOrder(QualType LHS, QualType RHS) const
Compare the rank of the two specified floating point types, ignoring the domain of the type (i...
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType) const
void setTemplateOrSpecializationInfo(VarDecl *Inst, TemplateOrSpecializationInfo TSI)
ASTMutationListener * Listener
Definition: ASTContext.h:444
const Type * Ty
The locally-unqualified type.
Definition: Type.h:513
static Selector GetNullarySelector(StringRef name, ASTContext &Ctx)
Utility function for constructing a nullary selector.
Definition: ASTContext.h:2477
CanQualType LongLongTy
Definition: ASTContext.h:825
void setInstantiatedFromStaticDataMember(VarDecl *Inst, VarDecl *Tmpl, TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
Note that the static data member Inst is an instantiation of the static data member template Tmpl of ...
llvm::PointerUnion< VarTemplateDecl *, MemberSpecializationInfo * > TemplateOrSpecializationInfo
A type synonym for the TemplateOrInstantiation mapping.
Definition: ASTContext.h:301
AttrVec & getDeclAttrs(const Decl *D)
Retrieve the attributes for the given declaration.
CanQualType WIntTy
Definition: ASTContext.h:822
QualType getPromotedIntegerType(QualType PromotableType) const
Return the type that PromotableType will promote to: C99 6.3.1.1p2, assuming that PromotableType is a...
void setjmp_bufDecl(TypeDecl *jmp_bufDecl)
Set the type for the C jmp_buf type.
Definition: ASTContext.h:1405
ObjCPropertyImplDecl * getObjCPropertyImplDeclForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container) const
Smart pointer class that efficiently represents Objective-C method names.
Holds information about both target-independent and target-specific builtins, allowing easy queries b...
Definition: Builtins.h:66
CanQualType LongDoubleComplexTy
Definition: ASTContext.h:830
GVALinkage GetGVALinkageForFunction(const FunctionDecl *FD) const
QualType mergeFunctionTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
CanQualType VoidPtrTy
Definition: ASTContext.h:831
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
QualType areCommonBaseCompatible(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
TypedefDecl * getUInt128Decl() const
Retrieve the declaration for the 128-bit unsigned integer type.
Definition: ASTContext.cpp:933
CanQualType OCLImage1dBufferTy
Definition: ASTContext.h:837
unsigned getTypeAlign(const Type *T) const
Definition: ASTContext.h:1723
void getObjCEncodingForPropertyType(QualType T, std::string &S) const
Emit the Objective-C property type encoding for the given type T into S.
bool ProtocolCompatibleWithProtocol(ObjCProtocolDecl *lProto, ObjCProtocolDecl *rProto) const
NestedNameSpecifier * getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
CharUnits getDeclAlign(const Decl *D, bool ForAlignof=false) const
Return a conservative estimate of the alignment of the specified decl D.
ASTContext(LangOptions &LOpts, SourceManager &SM, IdentifierTable &idents, SelectorTable &sels, Builtin::Context &builtins)
Definition: ASTContext.cpp:727
static Selector GetUnarySelector(StringRef name, ASTContext &Ctx)
Utility function for constructing an unary selector.
Definition: ASTContext.h:2483
QualType getAdjustedType(QualType Orig, QualType New) const
Return the uniqued reference to a type adjusted from the original type to a new type.
bool operator==(CanQual< T > x, CanQual< U > y)
static unsigned NumImplicitMoveAssignmentOperatorsDeclared
The number of implicitly-declared move assignment operators for which declarations were built...
Definition: ASTContext.h:2372
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type...
RecordDecl * buildImplicitRecord(StringRef Name, RecordDecl::TagKind TK=TTK_Struct) const
Create a new implicit TU-level CXXRecordDecl or RecordDecl declaration.
Definition: ASTContext.cpp:901
void getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT, std::string &S) const
Put the string version of the type qualifiers QT into S.
unsigned getFastQualifiers() const
Definition: Type.h:328
CanQualType Char32Ty
Definition: ASTContext.h:824
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
Definition: ASTContext.h:1581
static unsigned NumImplicitDefaultConstructors
The number of implicitly-declared default constructors.
Definition: ASTContext.h:2340
uint64_t getTypeSize(const Type *T) const
Definition: ASTContext.h:1702
CanQualType getComplexType(CanQualType T) const
Definition: ASTContext.h:970
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
bool CommentsLoaded
True if comments are already loaded from ExternalASTSource.
Definition: ASTContext.h:549
void addComment(const RawComment &RC, llvm::BumpPtrAllocator &Allocator)
unsigned getIntWidth(QualType T) const
QualType getIntTypeForBitwidth(unsigned DestWidth, unsigned Signed) const
void setObjCClassRedefinitionType(QualType RedefType)
Set the user-written type that redefines 'SEL'.
Definition: ASTContext.h:1348
QualType getWCharType() const
Return the unique wchar_t type available in C++ (and available as __wchar_t as a Microsoft extension)...
Definition: ASTContext.h:1259
static unsigned NumImplicitMoveAssignmentOperators
The number of implicitly-declared move assignment operators.
Definition: ASTContext.h:2368
void setucontext_tDecl(TypeDecl *ucontext_tDecl)
Set the type for the C ucontext_t type.
Definition: ASTContext.h:1429
QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType, UnaryTransformType::UTTKind UKind) const
Unary type transforms.
CanQualType FloatComplexTy
Definition: ASTContext.h:830
RawCommentList Comments
All comments in this translation unit.
Definition: ASTContext.h:546
CanQualType ObjCBuiltinSelTy
Definition: ASTContext.h:835
void addDefaultArgExprForConstructor(const CXXConstructorDecl *CD, unsigned ParmIdx, Expr *DAE)
QualType getVolatileType(QualType T) const
Return the uniqued reference to the type for a volatile qualified type.
Definition: ASTContext.h:941
std::string getObjCEncodingForBlock(const BlockExpr *blockExpr) const
Return the encoded type for this block declaration.
bool isAlignmentRequired(const Type *T) const
Determine if the alignment the type has was required using an alignment attribute.
llvm::iterator_range< import_iterator > import_range
Definition: ASTContext.h:782
FullSourceLoc getFullLoc(SourceLocation Loc) const
Definition: ASTContext.h:541
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type...
CanQualType ARCUnbridgedCastTy
Definition: ASTContext.h:834
void setParameterIndex(const ParmVarDecl *D, unsigned index)
Used by ParmVarDecl to store on the side the index of the parameter when it exceeds the size of the n...
CanQualType LongTy
Definition: ASTContext.h:825
const IncompleteArrayType * getAsIncompleteArrayType(QualType T) const
Definition: ASTContext.h:2009
QualType getRecordType(const RecordDecl *Decl) const
QualType getObjCClassRedefinitionType() const
Retrieve the type that Class has been defined to, which may be different from the built-in Class if C...
Definition: ASTContext.h:1341
A container of type source information.
Definition: Decl.h:60
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2147
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:3746
CanQualType WideCharTy
Definition: ASTContext.h:821
SourceRange getSourceRange() const LLVM_READONLY
CanQualType HalfTy
Definition: ASTContext.h:829
void setInstantiatedFromUsingDecl(UsingDecl *Inst, NamedDecl *Pattern)
Remember that the using decl Inst is an instantiation of the using decl Pattern of a class template...
const ASTRecordLayout & getASTObjCImplementationLayout(const ObjCImplementationDecl *D) const
Get or compute information about the layout of the specified Objective-C implementation.
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
QualType getVaListTagType() const
Retrieve the C type declaration corresponding to the predefined __va_list_tag type used to help defin...
QualType getVariableArrayDecayedType(QualType Ty) const
Returns a vla type where known sizes are replaced with [*].
const RawComment * getRaw() const LLVM_READONLY
Definition: ASTContext.h:584
QualType getRestrictType(QualType T) const
Return the uniqued reference to the type for a restrict qualified type.
Definition: ASTContext.h:932
QualType getFloatingTypeOfSizeWithinDomain(QualType typeSize, QualType typeDomain) const
Return a real floating point or a complex type (based on typeDomain/typeSize).
TypedefDecl * getBuiltinVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_va_list type...
void removeObjCLifetime()
Definition: Type.h:293
comments::FullComment * getLocalCommentForDeclUncached(const Decl *D) const
Definition: ASTContext.cpp:434
void setClassScopeSpecializationPattern(FunctionDecl *FD, FunctionDecl *Pattern)
MangleContext * createMangleContext()
QualType isPromotableBitField(Expr *E) const
Whether this is a promotable bitfield reference according to C99 6.3.1.1p2, bullet 2 (and GCC extensi...
ExtProtoInfo - Extra information about a function prototype.
Definition: Type.h:3042
Declaration context for names declared as extern "C" in C++. This is neither the semantic nor lexical...
Definition: Decl.h:122
QualType getObjCClassType() const
Represents the Objective-C Class type.
Definition: ASTContext.h:1532
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
Definition: ASTContext.h:1701
QualType getucontext_tType() const
Retrieve the C ucontext_t type.
Definition: ASTContext.h:1434
ObjCImplementationDecl * getObjCImplementation(ObjCInterfaceDecl *D)
Get the implementation of the ObjCInterfaceDecl D, or NULL if none exists.
void setRaw(const RawComment *RC)
Definition: ASTContext.h:588
void PrintStats() const
Definition: ASTContext.cpp:810
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:35
bool FunctionTypesMatchOnNSConsumedAttrs(const FunctionProtoType *FromFunctionType, const FunctionProtoType *ToFunctionType)
ParmVarDecl - Represents a parameter to a function.
Definition: Decl.h:1334
QualType getRawCFConstantStringType() const
Definition: ASTContext.h:1305
TemplateArgument getCanonicalTemplateArgument(const TemplateArgument &Arg) const
Retrieve the "canonical" template argument.
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
const ObjCMethodDecl * getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const
Get the duplicate declaration of a ObjCMethod in the same interface, or null if none exists...
Definition: ASTContext.h:2236
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
CanQualType OCLSamplerTy
Definition: ASTContext.h:840
unsigned getStaticLocalNumber(const VarDecl *VD) const
const SmallVectorImpl< Type * > & getTypes() const
Definition: ASTContext.h:882
ObjCInterfaceDecl * getObjCProtocolDecl() const
Retrieve the Objective-C class declaration corresponding to the predefined Protocol class...
CharUnits getOffsetOfBaseWithVBPtr(const CXXRecordDecl *RD) const
CanQualType getIntMaxType() const
Return the unique type for "intmax_t" (C99 7.18.1.5), defined in <stdint.h>.
comments::CommandTraits & getCommentCommandTraits() const
Definition: ASTContext.h:697
This table allows us to fully hide how we implement multi-keyword caching.
void getOverriddenMethods(const NamedDecl *Method, SmallVectorImpl< const NamedDecl * > &Overridden) const
Return C++ or ObjC overridden methods for the given Method.
QualType getAutoType(QualType DeducedType, bool IsDecltypeAuto, bool IsDependent) const
C++11 deduced auto type.
void setManglingNumber(const NamedDecl *ND, unsigned Number)
QualType getUnsignedWCharType() const
Return the type of "unsigned wchar_t".
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:89
static unsigned NumImplicitMoveConstructorsDeclared
The number of implicitly-declared move constructors for which declarations were built.
Definition: ASTContext.h:2358
CanQualType OCLImage2dArrayTy
Definition: ASTContext.h:838
void setObjCConstantStringInterface(ObjCInterfaceDecl *Decl)
void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl)
Missing a type from <ucontext.h>
Definition: ASTContext.h:1648
const ASTRecordLayout * BuildMicrosoftASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class), which indicates its size and field position information.
QualType getAddrSpaceQualType(QualType T, unsigned AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
QualType getLifetimeQualifiedType(QualType type, Qualifiers::ObjCLifetime lifetime)
Return a type with the given lifetime qualifier.
Definition: ASTContext.h:1604
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size...
This class represents all comments included in the translation unit, sorted in order of appearance in...
void setBOOLDecl(TypedefDecl *TD)
Save declaration of 'BOOL' typedef.
Definition: ASTContext.h:1546
void DeepCollectObjCIvars(const ObjCInterfaceDecl *OI, bool leafClass, SmallVectorImpl< const ObjCIvarDecl * > &Ivars) const
void Deallocate(void *Ptr) const
Definition: ASTContext.h:504
QualType getBlockDescriptorType() const
CanQualType OCLEventTy
Definition: ASTContext.h:840
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
Definition: ASTContext.h:1871
void getObjCEncodingForMethodParameter(Decl::ObjCDeclQualifier QT, QualType T, std::string &S, bool Extended) const
void setStaticLocalNumber(const VarDecl *VD, unsigned Number)
QualType getTypeOfType(QualType t) const
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, const clang::CharUnits &CU)
Definition: CharUnits.h:183
void setPrintingPolicy(const clang::PrintingPolicy &Policy)
Definition: ASTContext.h:490
unsigned getTargetDefaultAlignForAttributeAligned(void) const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:48
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
Definition: ASTContext.h:1114
llvm::BumpPtrAllocator & getAllocator() const
Definition: ASTContext.h:497
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
Definition: ASTContext.h:1896
Describes a module or submodule.
Definition: Basic/Module.h:49
IdentifierTable & Idents
Definition: ASTContext.h:439
bool ObjCObjectAdoptsQTypeProtocols(QualType QT, ObjCInterfaceDecl *Decl)
RawCommentList & getRawCommentList()
Definition: ASTContext.h:621
Values of this type can be null.
bool isNearlyEmpty(const CXXRecordDecl *RD) const
unsigned CountNonClassIvars(const ObjCInterfaceDecl *OI) const
QualType mergeObjCGCQualifiers(QualType, QualType)
QualType getObjCNSStringType() const
Definition: ASTContext.h:1318
Represents a C++ using-declaration.
Definition: DeclCXX.h:2871
bool hasNonFastQualifiers() const
Definition: Type.h:347
QualType getParenType(QualType NamedType) const
const TargetInfo & getTargetInfo() const
Definition: ASTContext.h:518
bool UnwrapSimilarPointerTypes(QualType &T1, QualType &T2)
CanQualType OCLImage2dTy
Definition: ASTContext.h:838
const LangOptions & getLangOpts() const
Definition: ASTContext.h:533
void setcudaConfigureCallDecl(FunctionDecl *FD)
Definition: ASTContext.h:1013
Keeps track of the mangled names of lambda expressions and block literals within a particular context...
QualType GetBuiltinType(unsigned ID, GetBuiltinTypeError &Error, unsigned *IntegerConstantArgs=nullptr) const
Return the type for the specified builtin.
Qualifiers::ObjCLifetime getInnerObjCOwnership(QualType T) const
Recurses in pointer/array types until it finds an Objective-C retainable type and returns its ownersh...
TemplateName getSubstTemplateTemplateParm(TemplateTemplateParmDecl *param, TemplateName replacement) const
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:135
const ArrayType * getAsArrayType(QualType T) const
bool getByrefLifetime(QualType Ty, Qualifiers::ObjCLifetime &Lifetime, bool &HasByrefExtendedLayout) const
unsigned getOpenMPDefaultSimdAlign(QualType T) const
Get default simd alignment of the specified complete type in bits.
CanQualType PseudoObjectTy
Definition: ASTContext.h:834
QualType getIntPtrType() const
Return a type compatible with "intptr_t" (C99 7.18.1.4), as defined by the target.
TypedefDecl * getObjCIdDecl() const
Retrieve the typedef corresponding to the predefined id type in Objective-C.
const SanitizerBlacklist & getSanitizerBlacklist() const
Definition: ASTContext.h:535
CanQualType LongDoubleTy
Definition: ASTContext.h:828
Values of this type can never be null.
unsigned Align
Definition: ASTContext.h:80
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D...
QualType getSignatureParameterType(QualType T) const
Retrieve the parameter type as adjusted for use in the signature of a function, decaying array and fu...
bool AlignIsRequired
Definition: ASTContext.h:81
QualType getsigjmp_bufType() const
Retrieve the C sigjmp_buf type.
Definition: ASTContext.h:1422
void eraseDeclAttrs(const Decl *D)
Erase the attributes corresponding to the given declaration.
CanQualType getAdjustedType(CanQualType Orig, CanQualType New) const
Definition: ASTContext.h:984
static unsigned NumImplicitDefaultConstructorsDeclared
The number of implicitly-declared default constructors for which declarations were built...
Definition: ASTContext.h:2344
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:1731
QualType mergeTransparentUnionType(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
Represents an ObjC class declaration.
Definition: DeclObjC.h:851
Decl * getPrimaryMergedDecl(Decl *D)
Definition: ASTContext.h:787
const DependentSizedArrayType * getAsDependentSizedArrayType(QualType T) const
Definition: ASTContext.h:2012
CanQualType OCLImage3dTy
Definition: ASTContext.h:839
TypedefDecl * getObjCClassDecl() const
Retrieve the typedef declaration corresponding to the predefined Objective-C 'Class' type...
QualType getCanonicalTypeInternal() const
Definition: Type.h:1951
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
std::pair< CharUnits, CharUnits > getTypeInfoInChars(const Type *T) const
IntrusiveRefCntPtr< ExternalASTSource > ExternalSource
Definition: ASTContext.h:443
CanQualType UnsignedCharTy
Definition: ASTContext.h:826
DiagnosticsEngine & getDiagnostics() const
unsigned getPreferredTypeAlign(const Type *T) const
Return the "preferred" alignment of the specified type T for the current target, in bits...
bool addressSpaceMapManglingFor(unsigned AS) const
Definition: ASTContext.h:2104
QualType getAutoRRefDeductType() const
C++11 deduction pattern for 'auto &&' type.
QualType getTemplateSpecializationType(TemplateName T, const TemplateArgument *Args, unsigned NumArgs, QualType Canon=QualType()) const
Provides definitions for the various language-specific address spaces.
void adjustDeducedFunctionResultType(FunctionDecl *FD, QualType ResultType)
Change the result type of a function type once it is deduced.
llvm::StringMap< SectionInfo > SectionInfos
Definition: ASTContext.h:2473
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
bool AtomicUsesUnsupportedLibcall(const AtomicExpr *E) const
Qualifiers::ObjCLifetime getObjCLifetime() const
getObjCLifetime - Returns lifetime attribute of this type.
Definition: Type.h:976
static unsigned NumImplicitCopyConstructors
The number of implicitly-declared copy constructors.
Definition: ASTContext.h:2347
Represents a ValueDecl that came out of a declarator. Contains type source information through TypeSo...
Definition: Decl.h:586
ArrayRef< Module * > getModulesWithMergedDefinition(NamedDecl *Def)
Get the additional modules in which the definition Def has been merged.
Definition: ASTContext.h:805
DeclarationNameTable DeclarationNames
Definition: ASTContext.h:442
QualType getLogicalOperationType() const
The result type of logical operations, '<', '>', '!=', etc.
Definition: ASTContext.h:1441
void getObjCEncodingForType(QualType T, std::string &S, const FieldDecl *Field=nullptr, QualType *NotEncodedT=nullptr) const
Emit the Objective-CC type encoding for the given type T into S.
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
llvm::iterator_range< SmallVectorImpl< Type * >::const_iterator > type_const_range
Definition: ASTContext.h:2194
void addObjCLifetime(ObjCLifetime type)
Definition: Type.h:294
void setCFConstantStringType(QualType T)
const SmallVectorImpl< AnnotatedLine * >::const_iterator End
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
bool AnyObjCImplementation()
Return true if there is at least one @implementation in the TU.
Definition: ASTContext.h:2223
ID
Defines the set of possible language-specific address spaces.
Definition: AddressSpaces.h:27
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
SourceManager & SM
bool ObjCMethodsAreEqual(const ObjCMethodDecl *MethodDecl, const ObjCMethodDecl *MethodImp)
std::pair< CharUnits, CharUnits > getTypeInfoDataSizeInChars(QualType T) const
Exposes information about the current target.
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, const TemplateArgumentListInfo &Args) const
bool isSignedIntegerOrEnumerationType() const
Definition: Type.cpp:1699
int * Depth
bool hasSameType(const Type *T1, const Type *T2) const
Definition: ASTContext.h:1875
bool isMSStaticDataMemberInlineDefinition(const VarDecl *VD) const
Returns true if this is an inline-initialized static data member which is treated as a definition for...
QualType getAutoDeductType() const
C++11 deduction pattern for 'auto' type.
Defines the clang::LangOptions interface.
QualType getBlockDescriptorExtendedType() const
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, UsingShadowDecl *Pattern)
MatchFinder::MatchCallback * Callback
CanQualType OCLImage1dTy
Definition: ASTContext.h:837
Declaration of a template type parameter.
Implements an efficient mapping from strings to IdentifierInfo nodes.
SourceManager & SourceMgr
Definition: Format.cpp:1205
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
Definition: Type.h:4143
void setObjCMethodRedeclaration(const ObjCMethodDecl *MD, const ObjCMethodDecl *Redecl)
Definition: ASTContext.h:2241
TemplateName getOverloadedTemplateName(UnresolvedSetIterator Begin, UnresolvedSetIterator End) const
Retrieve the template name that corresponds to a non-empty lookup.
unsigned getParameterIndex(const ParmVarDecl *D) const
Used by ParmVarDecl to retrieve on the side the index of the parameter when it exceeds the size of th...
QualType getWIntType() const
In C99, this returns a type compatible with the type defined in <stddef.h> as defined by the target...
Definition: ASTContext.h:1278
CanQualType getUIntMaxType() const
Return the unique type for "uintmax_t" (C99 7.18.1.5), defined in <stdint.h>.
TranslationUnitDecl * getTranslationUnitDecl() const
Definition: ASTContext.h:812
static unsigned NumImplicitMoveConstructors
The number of implicitly-declared move constructors.
Definition: ASTContext.h:2354
QualType getUnqualifiedObjCPointerType(QualType type) const
Definition: ASTContext.h:1616
Defines an enumeration for C++ overloaded operators.
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
static ImportDecl * getNextLocalImport(ImportDecl *Import)
Definition: ASTContext.h:778
void setObjCIdRedefinitionType(QualType RedefType)
Set the user-written type that redefines id.
Definition: ASTContext.h:1335
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
An allocator for Storage objects, which uses a small cache to objects, used to reduce malloc()/free()...
CanQualType ShortTy
Definition: ASTContext.h:825
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
QualType getObjCSuperType() const
Returns the C struct type for objc_super.
Represents a C++ template name within the type system.
Definition: TemplateName.h:175
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
MangleNumberingContext * createMangleNumberingContext() const
TypeSourceInfo * getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc, const TemplateArgumentListInfo &Args, QualType Canon=QualType()) const
TemplateOrSpecializationInfo getTemplateOrSpecializationInfo(const VarDecl *Var)
void setObjCImplementation(ObjCInterfaceDecl *IFaceD, ObjCImplementationDecl *ImplD)
Set the implementation of ObjCInterfaceDecl.
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
CanQualType UnsignedInt128Ty
Definition: ASTContext.h:827
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
QualType getFILEType() const
Retrieve the C FILE type.
Definition: ASTContext.h:1398
QualType getAdjustedParameterType(QualType T) const
Perform adjustment on the parameter type of a function.
PartialDiagnostic::StorageAllocator & getDiagAllocator()
Definition: ASTContext.h:514
Qualifiers Quals
The local qualifiers.
Definition: Type.h:516
QualType getObjCIdType() const
Represents the Objective-CC id type.
Definition: ASTContext.h:1510
QualType withFastQualifiers(unsigned TQs) const
Definition: Type.h:779
NamedDecl * getInstantiatedFromUsingDecl(UsingDecl *Inst)
If the given using decl Inst is an instantiation of a (possibly unresolved) using decl from a templat...
QualType getSubstTemplateTypeParmPackType(const TemplateTypeParmType *Replaced, const TemplateArgument &ArgPack)
Retrieve a.
Implements C++ ABI-specific semantic analysis functions.
Definition: CXXABI.h:29
void deduplicateMergedDefinitonsFor(NamedDecl *ND)
Clean up the merged definition list. Call this if you might have added duplicates into the list...
Definition: ASTContext.cpp:881
bool isObjCClassType(QualType T) const
Definition: ASTContext.h:2130
void CollectInheritedProtocols(const Decl *CDecl, llvm::SmallPtrSet< ObjCProtocolDecl *, 8 > &Protocols)
QualType getCVRQualifiedType(QualType T, unsigned CVR) const
Return a type with additional const, volatile, or restrict qualifiers.
Definition: ASTContext.h:1576
The result type of a method or function.
bool ObjCQualifiedClassTypesAreCompatible(QualType LHS, QualType RHS)
IdentifierInfo * getNSObjectName()
Retrieve the identifier 'NSObject'.
Definition: ASTContext.h:1367
bool getObjCEncodingForFunctionDecl(const FunctionDecl *Decl, std::string &S)
Emit the encoded type for the function Decl into S.
QualType getObjCConstantStringInterface() const
Definition: ASTContext.h:1314
void setOriginalDecl(const Decl *Orig)
Definition: ASTContext.h:596
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition: Specifiers.h:204
QualType getWideCharType() const
Return the type of wide characters. In C++, this returns the unique wchar_t type. In C99...
Definition: ASTContext.h:1264
CanQualType SignedCharTy
Definition: ASTContext.h:825
const clang::PrintingPolicy & getPrintingPolicy() const
Definition: ASTContext.h:486
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateDecl *Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
bool hasObjCLifetime() const
Definition: Type.h:286
IdentifierInfo * getNSCopyingName()
Retrieve the identifier 'NSCopying'.
Definition: ASTContext.h:1376
uint64_t getFieldOffset(const ValueDecl *FD) const
Get the offset of a FieldDecl or IndirectFieldDecl, in bits.
QualType getPackExpansionType(QualType Pattern, Optional< unsigned > NumExpansions)
QualType getFunctionNoProtoType(QualType ResultTy) const
Definition: ASTContext.h:1104
Abstract interface for external sources of AST nodes.
SourceLocation PragmaSectionLocation
Definition: ASTContext.h:2462
llvm::SmallVector< ast_type_traits::DynTypedNode, 2 > ParentVector
Contains parents of a node.
Definition: ASTContext.h:447
TypeSourceInfo * CreateTypeSourceInfo(QualType T, unsigned Size=0) const
Allocate an uninitialized TypeSourceInfo.
CanQualType OverloadTy
Definition: ASTContext.h:832
There is no lifetime qualification on this type.
Definition: Type.h:130
static unsigned NumImplicitDestructorsDeclared
The number of implicitly-declared destructors for which declarations were built.
Definition: ASTContext.h:2379
unsigned getTypeAlign(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in bits.
Definition: ASTContext.h:1722
int getIntegerTypeOrder(QualType LHS, QualType RHS) const
Return the highest ranked integer type, see C99 6.3.1.8p1.
TypeInfo getTypeInfo(const Type *T) const
Get the size and alignment of the specified complete type in bits.
#define false
Definition: stdbool.h:33
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
CanQualType BuiltinFnTy
Definition: ASTContext.h:833
The "struct" keyword.
Definition: Type.h:4130
SelectorTable & Selectors
Definition: ASTContext.h:440
DeclarationNameInfo getNameForTemplate(TemplateName Name, SourceLocation NameLoc) const
bool QIdProtocolsAdoptObjCObjectProtocols(QualType QT, ObjCInterfaceDecl *IDecl)
Expr * getBlockVarCopyInits(const VarDecl *VD)
Get the copy initialization expression of the VarDecl VD, or NULL if none exists. ...
void AddDeallocation(void(*Callback)(void *), void *Data)
Add a deallocation callback that will be invoked when the ASTContext is destroyed.
Definition: ASTContext.cpp:801
ExternCContextDecl * getExternCContextDecl() const
Definition: ASTContext.cpp:894
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
Definition: ASTContext.h:864
const Type * getTypePtr() const
Definition: Type.h:5016
bool hasSameTemplateName(TemplateName X, TemplateName Y)
Determine whether the given template names refer to the same template.
CanQualType Int128Ty
Definition: ASTContext.h:825
RawComment * getRawCommentForDeclNoCache(const Decl *D) const
Return the documentation comment attached to a given declaration, without looking into cache...
Definition: ASTContext.cpp:63
A structure for storing an already-substituted template template parameter pack.
Definition: TemplateName.h:118
CharUnits getObjCEncodingTypeSize(QualType T) const
Return the size of type T for Objective-C encoding purpose, in characters.
static unsigned NumImplicitCopyAssignmentOperatorsDeclared
The number of implicitly-declared copy assignment operators for which declarations were built...
Definition: ASTContext.h:2365
Kind getKind() const LLVM_READONLY
Definition: ASTContext.h:576
void getLegacyIntegralTypeEncoding(QualType &t) const
TagDecl - Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:2694
TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, const IdentifierInfo *Name) const
Retrieve the template name that represents a dependent template name such as MetaFun::template apply...
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
QualType getDependentSizedArrayType(QualType EltTy, Expr *NumElts, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a dependently-sized array of the specified element type...
CanQualType getPointerType(CanQualType T) const
Definition: ASTContext.h:977
QualType withConst() const
Definition: Type.h:736
QualType getConstType(QualType T) const
Return the uniqued reference to the type for a const qualified type.
Definition: ASTContext.h:952
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1717
CanQualType getCanonicalParamType(QualType T) const
Return the canonical parameter type corresponding to the specific potentially non-canonical one...
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
QualType getQualifiedType(QualType T, Qualifiers Qs) const
Return a type with additional qualifiers.
Definition: ASTContext.h:1586
CanQualType FloatTy
Definition: ASTContext.h:828
QualType getIncompleteArrayType(QualType EltTy, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a unique reference to the type for an incomplete array of the specified element type...
QualType getObjCSelRedefinitionType() const
Retrieve the type that 'SEL' has been defined to, which may be different from the built-in 'SEL' if '...
Definition: ASTContext.h:1354
const ConstantArrayType * getAsConstantArrayType(QualType T) const
Definition: ASTContext.h:2003
void ResetObjCLayout(const ObjCContainerDecl *CD)
Definition: ASTContext.h:2173
QualType getObjCGCQualType(QualType T, Qualifiers::GC gcAttr) const
Return the uniqued reference to the type for an Objective-C gc-qualified type.
CanQualType VoidTy
Definition: ASTContext.h:817
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:2424
bool canBindObjCObjectType(QualType To, QualType From)
SourceLocation getBegin() const
QualType getAttributedType(AttributedType::Kind attrKind, QualType modifiedType, QualType equivalentType)
bool typesAreBlockPointerCompatible(QualType, QualType)
FunctionDecl * getcudaConfigureCallDecl()
Definition: ASTContext.h:1016
TypedefDecl * getInt128Decl() const
Retrieve the declaration for the 128-bit signed integer type.
Definition: ASTContext.cpp:927
FunctionDecl * getClassScopeSpecializationPattern(const FunctionDecl *FD)
QualType getRealTypeForBitwidth(unsigned DestWidth) const
QualType AutoDeductTy
Definition: ASTContext.h:843
TypeInfo getTypeInfo(QualType T) const
Definition: ASTContext.h:1695
void setObjCSuperType(QualType ST)
Definition: ASTContext.h:1301
llvm::DenseMap< const Decl *, RawCommentAndCacheFlags > RedeclComments
Mapping from declarations to comments attached to any redeclaration.
Definition: ASTContext.h:610
static DynTypedNode create(const T &Node)
Creates a DynTypedNode from Node.
__SIZE_TYPE__ size_t
Definition: stddef.h:62
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:3704
unsigned getManglingNumber(const NamedDecl *ND) const
QualType getObjCInstanceType()
Retrieve the Objective-C "instancetype" type, if already known; otherwise, returns a NULL type;...
Definition: ASTContext.h:1386
void getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container, std::string &S) const
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
const SourceManager & getSourceManager() const
Definition: ASTContext.h:495
QualType getObjCSelType() const
Retrieve the type that corresponds to the predefined Objective-C 'SEL' type.
Definition: ASTContext.h:1520
CanQualType UnsignedShortTy
Definition: ASTContext.h:826
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:2576
ast_type_traits::DynTypedNode Node
CanQualType CharTy
Definition: ASTContext.h:819
bool propertyTypesAreCompatible(QualType, QualType)
Represents a template argument.
Definition: TemplateBase.h:39
TypedefDecl * buildImplicitTypedef(QualType T, StringRef Name) const
Create a new implicit TU-level typedef declaration.
Definition: ASTContext.cpp:917
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
TagTypeKind
The kind of a tag type.
Definition: Type.h:4128
TemplateName getSubstTemplateTemplateParmPack(TemplateTemplateParmDecl *Param, const TemplateArgument &ArgPack) const
CanQualType ObjCBuiltinIdTy
Definition: ASTContext.h:835
SectionInfo(DeclaratorDecl *Decl, SourceLocation PragmaSectionLocation, int SectionFlags)
Definition: ASTContext.h:2465
QualType getCanonicalTemplateSpecializationType(TemplateName T, const TemplateArgument *Args, unsigned NumArgs) const
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type. Can only be called on array an...
A qualifier set is used to build a set of qualifiers.
Definition: Type.h:4982
QualType mergeTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false, bool BlockReturnType=false)
CanQualType NullPtrTy
Definition: ASTContext.h:831
TypedefDecl * getBOOLDecl() const
Retrieve declaration of 'BOOL' typedef.
Definition: ASTContext.h:1541
unsigned getTargetAddressSpace(Qualifiers Q) const
Definition: ASTContext.h:2093
bool isSentinelNullExpr(const Expr *E)
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:311
CanQualType DoubleComplexTy
Definition: ASTContext.h:830
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:22
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Definition: ASTMatchers.h:1639
void addCopyConstructorForExceptionObject(CXXRecordDecl *RD, CXXConstructorDecl *CD)
ArrayRef< ast_type_traits::DynTypedNode > getParents(const NodeT &Node)
Returns the parents of the given node.
Definition: ASTContext.h:479
comments::FullComment * getCommentForDecl(const Decl *D, const Preprocessor *PP) const
Definition: ASTContext.cpp:439
TemplateName getCanonicalTemplateName(TemplateName Name) const
Retrieves the "canonical" template name that refers to a given template.
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:302
CanQualType UnsignedLongLongTy
Definition: ASTContext.h:827
QualType getEnumType(const EnumDecl *Decl) const
QualType getExceptionObjectType(QualType T) const
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getObjCProtoType() const
Retrieve the type of the Objective-C Protocol class.
Definition: ASTContext.h:1556
void setASTMutationListener(ASTMutationListener *Listener)
Attach an AST mutation listener to the AST context.
Definition: ASTContext.h:873
const Type * strip(QualType type)
Definition: Type.h:4989
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
MangleNumberingContext & getManglingNumberContext(const DeclContext *DC)
Retrieve the context for computing mangling numbers in the given DeclContext.
QualType getTemplateTypeParmType(unsigned Depth, unsigned Index, bool ParameterPack, TemplateTypeParmDecl *ParmDecl=nullptr) const
Retrieve the template type parameter type for a template parameter or parameter pack with the given d...
const FunctionType * adjustFunctionType(const FunctionType *Fn, FunctionType::ExtInfo EInfo)
Change the ExtInfo on a function type.
bool canAssignObjCInterfacesInBlockPointer(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT, bool BlockReturnType)
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
Definition: Specifiers.h:131
QualType AutoRRefDeductTy
Definition: ASTContext.h:844
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
Definition: ASTContext.h:1855
QualType getCorrespondingUnsignedType(QualType T) const
unsigned Map[Count]
Definition: AddressSpaces.h:45
bool areComparableObjCPointerTypes(QualType LHS, QualType RHS)
QualType getBuiltinVaListType() const
Retrieve the type of the __builtin_va_list type.
Definition: ASTContext.h:1565
static unsigned NumImplicitCopyAssignmentOperators
The number of implicitly-declared copy assignment operators.
Definition: ASTContext.h:2361
const VariableArrayType * getAsVariableArrayType(QualType T) const
Definition: ASTContext.h:2006
GVALinkage GetGVALinkageForVariable(const VarDecl *VD)
A dynamically typed AST node container.
const Decl * getOriginalDecl() const LLVM_READONLY
Definition: ASTContext.h:592
QualType getDependentSizedExtVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc) const
CanQualType ObjCBuiltinBoolTy
Definition: ASTContext.h:836
const RawComment * getRawCommentForAnyRedecl(const Decl *D, const Decl **OriginalDecl=nullptr) const
Return the documentation comment attached to a given declaration. Returns NULL if no comment is attac...
Definition: ASTContext.cpp:332
unsigned getAlignOfGlobalVar(QualType T) const
Return the alignment in bits that should be given to a global variable with type T.
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>. Pointer - pointer requires t...
bool isObjCNSObjectType() const
Definition: Type.cpp:3532
CanQualType UnknownAnyTy
Definition: ASTContext.h:832
comments::FullComment * cloneFullComment(comments::FullComment *FC, const Decl *D) const
Definition: ASTContext.cpp:418
QualType getCanonicalType() const
Definition: Type.h:5055
CanQualType UnsignedLongTy
Definition: ASTContext.h:826
bool areCompatibleVectorTypes(QualType FirstVec, QualType SecondVec)
Return true if the given vector types are of the same unqualified type or if they are equivalent to t...
Selector getSelector(unsigned NumArgs, IdentifierInfo **IIV)
Can create any sort of selector.
unsigned getTargetAddressSpace(unsigned AS) const
Definition: ASTContext.h:2097
CanQualType DependentTy
Definition: ASTContext.h:832
CanQualType WCharTy
Definition: ASTContext.h:820
void setNonKeyFunction(const CXXMethodDecl *method)
Observe that the given method cannot be a key function. Checks the key-function cache for the method'...
CanQualType ObjCBuiltinClassTy
Definition: ASTContext.h:835
QualType getQualifiedType(const Type *T, Qualifiers Qs) const
Return a type with additional qualifiers.
Definition: ASTContext.h:1595
CanQualType BoundMemberTy
Definition: ASTContext.h:832
unsigned getAddressSpace() const
Definition: Type.h:313
void addComment(const RawComment &RC)
Definition: ASTContext.h:625
uint64_t getCharWidth() const
Return the size of the character type, in bits.
Definition: ASTContext.h:1705
llvm::DenseMap< const Decl *, comments::FullComment * > ParsedComments
Mapping from declarations to parsed comments attached to any redeclaration.
Definition: ASTContext.h:614
QualType getObjCIdRedefinitionType() const
Retrieve the type that id has been defined to, which may be different from the built-in id if id has ...
Definition: ASTContext.h:1328
import_range local_imports() const
Definition: ASTContext.h:783
bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream...
void setBlockVarCopyInits(VarDecl *VD, Expr *Init)
Set the copy inialization expression of a block var decl.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl...
bool getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl, std::string &S, bool Extended=false) const
Emit the encoded type for the method declaration Decl into S.
ASTMutationListener * getASTMutationListener() const
Retrieve a pointer to the AST mutation listener associated with this AST context, if any...
Definition: ASTContext.h:879
const Type * getCanonicalType(const Type *T) const
Definition: ASTContext.h:1859
SourceManager & getSourceManager()
Definition: ASTContext.h:494
TypeDecl * getFloat128StubType() const
Retrieve the declaration for a 128-bit float stub type.
Definition: ASTContext.cpp:939
void mergeDefinitionIntoModule(NamedDecl *ND, Module *M, bool NotifyListeners=true)
Note that the definition ND has been merged into module M, and should be visible whenever M is visibl...
Definition: ASTContext.cpp:869
X
Definition: SemaDecl.cpp:11429
QualType getTypedefType(const TypedefNameDecl *Decl, QualType Canon=QualType()) const
Return the unique reference to the type for the specified typedef-name decl.
void setObjCNSStringType(QualType T)
Definition: ASTContext.h:1322
QualType getTypeOfExprType(Expr *e) const
GCC extension.
bool typesAreCompatible(QualType T1, QualType T2, bool CompareUnqualified=false)
Compatibility predicates used to check assignment expressions.
QualType getVariableArrayType(QualType EltTy, Expr *NumElts, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a variable array of the specified element type...
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Definition: Type.h:5096
CanQualType getDecayedType(CanQualType T) const
Definition: ASTContext.h:993
const CXXMethodDecl * getCurrentKeyFunction(const CXXRecordDecl *RD)
Get our current best idea for the key function of the given record decl, or NULL if there isn't one...
Represents a C++ struct/union/class.
Definition: DeclCXX.h:285
bool isObjCObjectPointerType() const
Definition: Type.h:5304
VTableContextBase * getVTableContext()
Missing a type from <stdio.h>
Definition: ASTContext.h:1646
type_const_range types() const
Definition: ASTContext.h:2196
CanQualType OCLImage1dArrayTy
Definition: ASTContext.h:837
bool operator!=(CanQual< T > x, CanQual< U > y)
void * Allocate(size_t Size, unsigned Align=8) const
Definition: ASTContext.h:501
CallingConv getDefaultCallingConvention(bool isVariadic, bool IsCXXMethod) const
Retrieves the default calling convention for the current target.
Provides information a specialization of a member of a class template, which may be a member function...
Definition: DeclTemplate.h:481
CanQualType Char16Ty
Definition: ASTContext.h:823
void DumpRecordLayout(const RecordDecl *RD, raw_ostream &OS, bool Simple=false) const
size_t getASTAllocatedMemory() const
Definition: ASTContext.h:508
bool isObjCSelType(QualType T) const
Definition: ASTContext.h:2133
size_t getSideTableAllocatedMemory() const
Return the total memory used for various side tables.
static unsigned NumImplicitCopyConstructorsDeclared
The number of implicitly-declared copy constructors for which declarations were built.
Definition: ASTContext.h:2351
Builtin::Context & BuiltinInfo
Definition: ASTContext.h:441
llvm::APSInt MakeIntValue(uint64_t Value, QualType Type) const
Make an APSInt of the appropriate width and signedness for the given Value and integer Type...
Definition: ASTContext.h:2206
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorType::VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:82
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
Definition: CanonicalType.h:70
A SourceLocation and its associated SourceManager.
Defines the clang::VersionTuple class, which represents a version in the form major[.minor[.subminor]].
static Qualifiers fromCVRMask(unsigned CVR)
Definition: Type.h:208
void adjustExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI, bool AsWritten=false)
Change the exception specification on a function once it is delay-parsed, instantiated, or computed.
CXXMethodVector::const_iterator overridden_cxx_method_iterator
Definition: ASTContext.h:749
void setObjCSelRedefinitionType(QualType RedefType)
Set the user-written type that redefines 'SEL'.
Definition: ASTContext.h:1362
uint64_t Width
Definition: ASTContext.h:79
CanQualType IntTy
Definition: ASTContext.h:825
TranslationUnitDecl - The top declaration context.
Definition: Decl.h:78
unsigned getTargetAddressSpace(QualType T) const
Definition: ASTContext.h:2089
QualType getDecltypeType(Expr *e, QualType UnderlyingType) const
C++11 decltype.
QualType getjmp_bufType() const
Retrieve the C jmp_buf type.
Definition: ASTContext.h:1410
QualType getUIntPtrType() const
Return a type compatible with "uintptr_t" (C99 7.18.1.4), as defined by the target.
GVALinkage
A more specific kind of linkage than enum Linkage.
Definition: Linkage.h:64
A lazy value (of type T) that is within an AST node of type Owner, where the value might change in la...
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type...
uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const
Return number of constant array elements.
QualType mergeFunctionParameterTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
Expr * getDefaultArgExprForConstructor(const CXXConstructorDecl *CD, unsigned ParmIdx)
QualType VaListTagTy
Definition: ASTContext.h:848
const ObjCInterfaceDecl * getObjContainingInterface(const NamedDecl *ND) const
Returns the Objective-C interface that ND belongs to if it is an Objective-C method/property/ivar etc...
TypedefDecl * getObjCSelDecl() const
Retrieve the typedef corresponding to the predefined 'SEL' type in Objective-C.
bool isObjCIdType(QualType T) const
Definition: ASTContext.h:2127
void InitBuiltinTypes(const TargetInfo &Target)
Initialize built-in types.
Definition: ASTContext.cpp:953
llvm::DenseMap< const void *, llvm::PointerUnion< ast_type_traits::DynTypedNode *, ParentVector * > > ParentMap
Maps from a node to its parents.
Definition: ASTContext.h:452
Qualifiers::GC getObjCGCAttrKind(QualType Ty) const
Return one of the GCNone, Weak or Strong Objective-C garbage collection attributes.
int64_t toBits(CharUnits CharSize) const
Convert a size in characters to a size in bits.
const llvm::fltSemantics & getFloatTypeSemantics(QualType T) const
Return the APFloat 'semantics' for the specified scalar floating point type.
A trivial tuple used to represent a source range.
void setsigjmp_bufDecl(TypeDecl *sigjmp_bufDecl)
Set the type for the C sigjmp_buf type.
Definition: ASTContext.h:1417
void setFILEDecl(TypeDecl *FILEDecl)
Set the type for the C FILE type.
Definition: ASTContext.h:1395
QualType getSignedWCharType() const
Return the type of "signed wchar_t".
TypeInfo(uint64_t Width, unsigned Align, bool AlignIsRequired)
Definition: ASTContext.h:83
bool hasSameNullabilityTypeQualifier(QualType SubT, QualType SuperT, bool IsParam) const
Definition: ASTContext.h:1901
CanQualType BoolTy
Definition: ASTContext.h:818
const ASTRecordLayout & getASTObjCInterfaceLayout(const ObjCInterfaceDecl *D) const
Get or compute information about the layout of the specified Objective-C interface.
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
bool DeclMustBeEmitted(const Decl *D)
Determines if the decl can be CodeGen'ed or deserialized from PCH lazily, only when used; this is onl...
const CXXConstructorDecl * getCopyConstructorForExceptionObject(CXXRecordDecl *RD)
llvm::PointerUnion< T, LazyData * > ValueType
bool ObjCQualifiedIdTypesAreCompatible(QualType LHS, QualType RHS, bool ForCompare)
CharUnits getAlignOfGlobalVarInChars(QualType T) const
Return the alignment in characters that should be given to a global variable with type T...
CanQualType DoubleTy
Definition: ASTContext.h:828
bool isNull() const
isNull - Return true if this QualType doesn't point to a type yet.
Definition: Type.h:633
static bool isObjCNSObjectType(QualType Ty)
Return true if this is an NSObject object with its NSObject attribute set.
Definition: ASTContext.h:1681
void addedLocalImportDecl(ImportDecl *Import)
Notify the AST context that a new import declaration has been parsed or implicitly created within thi...
QualType getSubstTemplateTypeParmType(const TemplateTypeParmType *Replaced, QualType Replacement) const
Retrieve a substitution-result type.
Missing a type from <setjmp.h>
Definition: ASTContext.h:1647
Optional< NullabilityKind > getNullability(const ASTContext &context) const
Definition: Type.cpp:3326
This class handles loading and caching of source files into memory.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
QualType getBOOLType() const
type of 'BOOL' type.
Definition: ASTContext.h:1551
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals)
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals...
bool BlockRequiresCopying(QualType Ty, const VarDecl *D)
Returns true iff we need copy/dispose helpers for the given type.
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:2779
A full comment attached to a declaration, contains block content.
Definition: Comment.h:1097
APValue * getMaterializedTemporaryValue(const MaterializeTemporaryExpr *E, bool MayCreate)
Get the storage for the constant value of a materialized temporary of static storage duration...
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:96
CanQualType UnsignedIntTy
Definition: ASTContext.h:826
QualType getProcessIDType() const
Return the unique type for "pid_t" defined in <sys/types.h>. We need this to compute the correct type...
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Definition: Type.h:5043
static unsigned NumImplicitDestructors
The number of implicitly-declared destructors.
Definition: ASTContext.h:2375
QualType getCFConstantStringType() const
Return the C structure type used to represent constant CFStrings.