clang  16.0.0git
DeclSpec.h
Go to the documentation of this file.
1 //===--- DeclSpec.h - Parsed declaration specifiers -------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// This file defines the classes used to store parsed information about
11 /// declaration-specifiers and declarators.
12 ///
13 /// \verbatim
14 /// static const int volatile x, *y, *(*(*z)[10])(const void *x);
15 /// ------------------------- - -- ---------------------------
16 /// declaration-specifiers \ | /
17 /// declarators
18 /// \endverbatim
19 ///
20 //===----------------------------------------------------------------------===//
21 
22 #ifndef LLVM_CLANG_SEMA_DECLSPEC_H
23 #define LLVM_CLANG_SEMA_DECLSPEC_H
24 
25 #include "clang/AST/DeclCXX.h"
29 #include "clang/Basic/Lambda.h"
31 #include "clang/Basic/Specifiers.h"
32 #include "clang/Lex/Token.h"
33 #include "clang/Sema/Ownership.h"
34 #include "clang/Sema/ParsedAttr.h"
35 #include "llvm/ADT/STLExtras.h"
36 #include "llvm/ADT/SmallVector.h"
37 #include "llvm/Support/Compiler.h"
38 #include "llvm/Support/ErrorHandling.h"
39 
40 namespace clang {
41  class ASTContext;
42  class CXXRecordDecl;
43  class TypeLoc;
44  class LangOptions;
45  class IdentifierInfo;
46  class NamespaceAliasDecl;
47  class NamespaceDecl;
48  class ObjCDeclSpec;
49  class Sema;
50  class Declarator;
51  struct TemplateIdAnnotation;
52 
53 /// Represents a C++ nested-name-specifier or a global scope specifier.
54 ///
55 /// These can be in 3 states:
56 /// 1) Not present, identified by isEmpty()
57 /// 2) Present, identified by isNotEmpty()
58 /// 2.a) Valid, identified by isValid()
59 /// 2.b) Invalid, identified by isInvalid().
60 ///
61 /// isSet() is deprecated because it mostly corresponded to "valid" but was
62 /// often used as if it meant "present".
63 ///
64 /// The actual scope is described by getScopeRep().
65 class CXXScopeSpec {
66  SourceRange Range;
68 
69 public:
70  SourceRange getRange() const { return Range; }
71  void setRange(SourceRange R) { Range = R; }
72  void setBeginLoc(SourceLocation Loc) { Range.setBegin(Loc); }
73  void setEndLoc(SourceLocation Loc) { Range.setEnd(Loc); }
74  SourceLocation getBeginLoc() const { return Range.getBegin(); }
75  SourceLocation getEndLoc() const { return Range.getEnd(); }
76 
77  /// Retrieve the representation of the nested-name-specifier.
79  return Builder.getRepresentation();
80  }
81 
82  /// Extend the current nested-name-specifier by another
83  /// nested-name-specifier component of the form 'type::'.
84  ///
85  /// \param Context The AST context in which this nested-name-specifier
86  /// resides.
87  ///
88  /// \param TemplateKWLoc The location of the 'template' keyword, if present.
89  ///
90  /// \param TL The TypeLoc that describes the type preceding the '::'.
91  ///
92  /// \param ColonColonLoc The location of the trailing '::'.
93  void Extend(ASTContext &Context, SourceLocation TemplateKWLoc, TypeLoc TL,
94  SourceLocation ColonColonLoc);
95 
96  /// Extend the current nested-name-specifier by another
97  /// nested-name-specifier component of the form 'identifier::'.
98  ///
99  /// \param Context The AST context in which this nested-name-specifier
100  /// resides.
101  ///
102  /// \param Identifier The identifier.
103  ///
104  /// \param IdentifierLoc The location of the identifier.
105  ///
106  /// \param ColonColonLoc The location of the trailing '::'.
107  void Extend(ASTContext &Context, IdentifierInfo *Identifier,
109 
110  /// Extend the current nested-name-specifier by another
111  /// nested-name-specifier component of the form 'namespace::'.
112  ///
113  /// \param Context The AST context in which this nested-name-specifier
114  /// resides.
115  ///
116  /// \param Namespace The namespace.
117  ///
118  /// \param NamespaceLoc The location of the namespace name.
119  ///
120  /// \param ColonColonLoc The location of the trailing '::'.
121  void Extend(ASTContext &Context, NamespaceDecl *Namespace,
122  SourceLocation NamespaceLoc, SourceLocation ColonColonLoc);
123 
124  /// Extend the current nested-name-specifier by another
125  /// nested-name-specifier component of the form 'namespace-alias::'.
126  ///
127  /// \param Context The AST context in which this nested-name-specifier
128  /// resides.
129  ///
130  /// \param Alias The namespace alias.
131  ///
132  /// \param AliasLoc The location of the namespace alias
133  /// name.
134  ///
135  /// \param ColonColonLoc The location of the trailing '::'.
136  void Extend(ASTContext &Context, NamespaceAliasDecl *Alias,
137  SourceLocation AliasLoc, SourceLocation ColonColonLoc);
138 
139  /// Turn this (empty) nested-name-specifier into the global
140  /// nested-name-specifier '::'.
141  void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc);
142 
143  /// Turns this (empty) nested-name-specifier into '__super'
144  /// nested-name-specifier.
145  ///
146  /// \param Context The AST context in which this nested-name-specifier
147  /// resides.
148  ///
149  /// \param RD The declaration of the class in which nested-name-specifier
150  /// appeared.
151  ///
152  /// \param SuperLoc The location of the '__super' keyword.
153  /// name.
154  ///
155  /// \param ColonColonLoc The location of the trailing '::'.
156  void MakeSuper(ASTContext &Context, CXXRecordDecl *RD,
157  SourceLocation SuperLoc, SourceLocation ColonColonLoc);
158 
159  /// Make a new nested-name-specifier from incomplete source-location
160  /// information.
161  ///
162  /// FIXME: This routine should be used very, very rarely, in cases where we
163  /// need to synthesize a nested-name-specifier. Most code should instead use
164  /// \c Adopt() with a proper \c NestedNameSpecifierLoc.
165  void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier,
166  SourceRange R);
167 
168  /// Adopt an existing nested-name-specifier (with source-range
169  /// information).
170  void Adopt(NestedNameSpecifierLoc Other);
171 
172  /// Retrieve a nested-name-specifier with location information, copied
173  /// into the given AST context.
174  ///
175  /// \param Context The context into which this nested-name-specifier will be
176  /// copied.
178 
179  /// Retrieve the location of the name in the last qualifier
180  /// in this nested name specifier.
181  ///
182  /// For example, the location of \c bar
183  /// in
184  /// \verbatim
185  /// \::foo::bar<0>::
186  /// ^~~
187  /// \endverbatim
189 
190  /// No scope specifier.
191  bool isEmpty() const { return Range.isInvalid() && getScopeRep() == nullptr; }
192  /// A scope specifier is present, but may be valid or invalid.
193  bool isNotEmpty() const { return !isEmpty(); }
194 
195  /// An error occurred during parsing of the scope specifier.
196  bool isInvalid() const { return Range.isValid() && getScopeRep() == nullptr; }
197  /// A scope specifier is present, and it refers to a real scope.
198  bool isValid() const { return getScopeRep() != nullptr; }
199 
200  /// Indicate that this nested-name-specifier is invalid.
202  assert(R.isValid() && "Must have a valid source range");
203  if (Range.getBegin().isInvalid())
204  Range.setBegin(R.getBegin());
205  Range.setEnd(R.getEnd());
206  Builder.Clear();
207  }
208 
209  /// Deprecated. Some call sites intend isNotEmpty() while others intend
210  /// isValid().
211  bool isSet() const { return getScopeRep() != nullptr; }
212 
213  void clear() {
214  Range = SourceRange();
215  Builder.Clear();
216  }
217 
218  /// Retrieve the data associated with the source-location information.
219  char *location_data() const { return Builder.getBuffer().first; }
220 
221  /// Retrieve the size of the data associated with source-location
222  /// information.
223  unsigned location_size() const { return Builder.getBuffer().second; }
224 };
225 
226 /// Captures information about "declaration specifiers".
227 ///
228 /// "Declaration specifiers" encompasses storage-class-specifiers,
229 /// type-specifiers, type-qualifiers, and function-specifiers.
230 class DeclSpec {
231 public:
232  /// storage-class-specifier
233  /// \note The order of these enumerators is important for diagnostics.
234  enum SCS {
243  };
244 
245  // Import thread storage class specifier enumeration and constants.
246  // These can be combined with SCS_extern and SCS_static.
252 
253  enum TSC {
257  };
258 
259  // Import type specifier type enumeration and constants.
262  static const TST TST_void = clang::TST_void;
263  static const TST TST_char = clang::TST_char;
268  static const TST TST_int = clang::TST_int;
271  static const TST TST_half = clang::TST_half;
280  static const TST TST_bool = clang::TST_bool;
284  static const TST TST_enum = clang::TST_enum;
296 #define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) \
297  static const TST TST_##Trait = clang::TST_##Trait;
298 #include "clang/Basic/TransformTypeTraits.def"
299  static const TST TST_auto = clang::TST_auto;
303 #define GENERIC_IMAGE_TYPE(ImgType, Id) \
304  static const TST TST_##ImgType##_t = clang::TST_##ImgType##_t;
305 #include "clang/Basic/OpenCLImageTypes.def"
307 
308  // type-qualifiers
309  enum TQ { // NOTE: These flags must be kept in sync with Qualifiers::TQ.
311  TQ_const = 1,
315  // This has no corresponding Qualifiers::TQ value, because it's not treated
316  // as a qualifier in our type system.
318  };
319 
320  /// ParsedSpecifiers - Flags to query which specifiers were applied. This is
321  /// returned by getParsedSpecifiers.
323  PQ_None = 0,
328  // FIXME: Attributes should be included here.
329  };
330 
331  enum FriendSpecified : bool {
332  No,
334  };
335 
336 private:
337  // storage-class-specifier
338  /*SCS*/unsigned StorageClassSpec : 3;
339  /*TSCS*/unsigned ThreadStorageClassSpec : 2;
340  unsigned SCS_extern_in_linkage_spec : 1;
341 
342  // type-specifier
343  /*TypeSpecifierWidth*/ unsigned TypeSpecWidth : 2;
344  /*TSC*/unsigned TypeSpecComplex : 2;
345  /*TSS*/unsigned TypeSpecSign : 2;
346  /*TST*/unsigned TypeSpecType : 7;
347  unsigned TypeAltiVecVector : 1;
348  unsigned TypeAltiVecPixel : 1;
349  unsigned TypeAltiVecBool : 1;
350  unsigned TypeSpecOwned : 1;
351  unsigned TypeSpecPipe : 1;
352  unsigned TypeSpecSat : 1;
353  unsigned ConstrainedAuto : 1;
354 
355  // type-qualifiers
356  unsigned TypeQualifiers : 5; // Bitwise OR of TQ.
357 
358  // function-specifier
359  unsigned FS_inline_specified : 1;
360  unsigned FS_forceinline_specified: 1;
361  unsigned FS_virtual_specified : 1;
362  unsigned FS_noreturn_specified : 1;
363 
364  // friend-specifier
365  unsigned Friend_specified : 1;
366 
367  // constexpr-specifier
368  unsigned ConstexprSpecifier : 2;
369 
370  union {
375  };
376 
377  /// ExplicitSpecifier - Store information about explicit spicifer.
378  ExplicitSpecifier FS_explicit_specifier;
379 
380  // attributes.
381  ParsedAttributes Attrs;
382 
383  // Scope specifier for the type spec, if applicable.
384  CXXScopeSpec TypeScope;
385 
386  // SourceLocation info. These are null if the item wasn't specified or if
387  // the setting was synthesized.
388  SourceRange Range;
389 
390  SourceLocation StorageClassSpecLoc, ThreadStorageClassSpecLoc;
391  SourceRange TSWRange;
392  SourceLocation TSCLoc, TSSLoc, TSTLoc, AltiVecLoc, TSSatLoc;
393  /// TSTNameLoc - If TypeSpecType is any of class, enum, struct, union,
394  /// typename, then this is the location of the named type (if present);
395  /// otherwise, it is the same as TSTLoc. Hence, the pair TSTLoc and
396  /// TSTNameLoc provides source range info for tag types.
397  SourceLocation TSTNameLoc;
398  SourceRange TypeofParensRange;
399  SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc, TQ_atomicLoc,
400  TQ_unalignedLoc;
401  SourceLocation FS_inlineLoc, FS_virtualLoc, FS_explicitLoc, FS_noreturnLoc;
402  SourceLocation FS_explicitCloseParenLoc;
403  SourceLocation FS_forceinlineLoc;
404  SourceLocation FriendLoc, ModulePrivateLoc, ConstexprLoc;
405  SourceLocation TQ_pipeLoc;
406 
407  WrittenBuiltinSpecs writtenBS;
408  void SaveWrittenBuiltinSpecs();
409 
410  ObjCDeclSpec *ObjCQualifiers;
411 
412  static bool isTypeRep(TST T) {
413  return T == TST_atomic || T == TST_typename || T == TST_typeofType ||
415  }
416  static bool isExprRep(TST T) {
417  return T == TST_typeofExpr || T == TST_typeof_unqualExpr ||
418  T == TST_decltype || T == TST_bitint;
419  }
420  static bool isTemplateIdRep(TST T) {
421  return (T == TST_auto || T == TST_decltype_auto);
422  }
423 
424  DeclSpec(const DeclSpec &) = delete;
425  void operator=(const DeclSpec &) = delete;
426 public:
427  static bool isDeclRep(TST T) {
428  return (T == TST_enum || T == TST_struct ||
429  T == TST_interface || T == TST_union ||
430  T == TST_class);
431  }
432  static bool isTransformTypeTrait(TST T) {
433  constexpr std::array<TST, 16> Traits = {
434 #define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) TST_##Trait,
435 #include "clang/Basic/TransformTypeTraits.def"
436  };
437 
438  return T >= Traits.front() && T <= Traits.back();
439  }
440 
442  : StorageClassSpec(SCS_unspecified),
443  ThreadStorageClassSpec(TSCS_unspecified),
444  SCS_extern_in_linkage_spec(false),
445  TypeSpecWidth(static_cast<unsigned>(TypeSpecifierWidth::Unspecified)),
446  TypeSpecComplex(TSC_unspecified),
447  TypeSpecSign(static_cast<unsigned>(TypeSpecifierSign::Unspecified)),
448  TypeSpecType(TST_unspecified), TypeAltiVecVector(false),
449  TypeAltiVecPixel(false), TypeAltiVecBool(false), TypeSpecOwned(false),
450  TypeSpecPipe(false), TypeSpecSat(false), ConstrainedAuto(false),
451  TypeQualifiers(TQ_unspecified), FS_inline_specified(false),
452  FS_forceinline_specified(false), FS_virtual_specified(false),
453  FS_noreturn_specified(false), Friend_specified(false),
454  ConstexprSpecifier(
455  static_cast<unsigned>(ConstexprSpecKind::Unspecified)),
456  Attrs(attrFactory), writtenBS(), ObjCQualifiers(nullptr) {}
457 
458  // storage-class-specifier
459  SCS getStorageClassSpec() const { return (SCS)StorageClassSpec; }
461  return (TSCS)ThreadStorageClassSpec;
462  }
463  bool isExternInLinkageSpec() const { return SCS_extern_in_linkage_spec; }
465  SCS_extern_in_linkage_spec = Value;
466  }
467 
468  SourceLocation getStorageClassSpecLoc() const { return StorageClassSpecLoc; }
470  return ThreadStorageClassSpecLoc;
471  }
472 
474  StorageClassSpec = DeclSpec::SCS_unspecified;
475  ThreadStorageClassSpec = DeclSpec::TSCS_unspecified;
476  SCS_extern_in_linkage_spec = false;
477  StorageClassSpecLoc = SourceLocation();
478  ThreadStorageClassSpecLoc = SourceLocation();
479  }
480 
482  TypeSpecType = DeclSpec::TST_unspecified;
483  TypeSpecOwned = false;
484  TSTLoc = SourceLocation();
485  }
486 
487  // type-specifier
489  return static_cast<TypeSpecifierWidth>(TypeSpecWidth);
490  }
491  TSC getTypeSpecComplex() const { return (TSC)TypeSpecComplex; }
493  return static_cast<TypeSpecifierSign>(TypeSpecSign);
494  }
495  TST getTypeSpecType() const { return (TST)TypeSpecType; }
496  bool isTypeAltiVecVector() const { return TypeAltiVecVector; }
497  bool isTypeAltiVecPixel() const { return TypeAltiVecPixel; }
498  bool isTypeAltiVecBool() const { return TypeAltiVecBool; }
499  bool isTypeSpecOwned() const { return TypeSpecOwned; }
500  bool isTypeRep() const { return isTypeRep((TST) TypeSpecType); }
501  bool isTypeSpecPipe() const { return TypeSpecPipe; }
502  bool isTypeSpecSat() const { return TypeSpecSat; }
503  bool isConstrainedAuto() const { return ConstrainedAuto; }
504 
506  assert(isTypeRep((TST) TypeSpecType) && "DeclSpec does not store a type");
507  return TypeRep;
508  }
509  Decl *getRepAsDecl() const {
510  assert(isDeclRep((TST) TypeSpecType) && "DeclSpec does not store a decl");
511  return DeclRep;
512  }
513  Expr *getRepAsExpr() const {
514  assert(isExprRep((TST) TypeSpecType) && "DeclSpec does not store an expr");
515  return ExprRep;
516  }
518  assert(isTemplateIdRep((TST) TypeSpecType) &&
519  "DeclSpec does not store a template id");
520  return TemplateIdRep;
521  }
522  CXXScopeSpec &getTypeSpecScope() { return TypeScope; }
523  const CXXScopeSpec &getTypeSpecScope() const { return TypeScope; }
524 
525  SourceRange getSourceRange() const LLVM_READONLY { return Range; }
526  SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
527  SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
528 
529  SourceLocation getTypeSpecWidthLoc() const { return TSWRange.getBegin(); }
530  SourceRange getTypeSpecWidthRange() const { return TSWRange; }
531  SourceLocation getTypeSpecComplexLoc() const { return TSCLoc; }
532  SourceLocation getTypeSpecSignLoc() const { return TSSLoc; }
533  SourceLocation getTypeSpecTypeLoc() const { return TSTLoc; }
534  SourceLocation getAltiVecLoc() const { return AltiVecLoc; }
535  SourceLocation getTypeSpecSatLoc() const { return TSSatLoc; }
536 
538  assert(isDeclRep((TST)TypeSpecType) || isTypeRep((TST)TypeSpecType) ||
539  isExprRep((TST)TypeSpecType));
540  return TSTNameLoc;
541  }
542 
543  SourceRange getTypeofParensRange() const { return TypeofParensRange; }
544  void setTypeArgumentRange(SourceRange range) { TypeofParensRange = range; }
545 
546  bool hasAutoTypeSpec() const {
547  return (TypeSpecType == TST_auto || TypeSpecType == TST_auto_type ||
548  TypeSpecType == TST_decltype_auto);
549  }
550 
551  bool hasTagDefinition() const;
552 
553  /// Turn a type-specifier-type into a string like "_Bool" or "union".
554  static const char *getSpecifierName(DeclSpec::TST T,
555  const PrintingPolicy &Policy);
556  static const char *getSpecifierName(DeclSpec::TQ Q);
557  static const char *getSpecifierName(TypeSpecifierSign S);
558  static const char *getSpecifierName(DeclSpec::TSC C);
559  static const char *getSpecifierName(TypeSpecifierWidth W);
560  static const char *getSpecifierName(DeclSpec::SCS S);
561  static const char *getSpecifierName(DeclSpec::TSCS S);
562  static const char *getSpecifierName(ConstexprSpecKind C);
563 
564  // type-qualifiers
565 
566  /// getTypeQualifiers - Return a set of TQs.
567  unsigned getTypeQualifiers() const { return TypeQualifiers; }
568  SourceLocation getConstSpecLoc() const { return TQ_constLoc; }
569  SourceLocation getRestrictSpecLoc() const { return TQ_restrictLoc; }
570  SourceLocation getVolatileSpecLoc() const { return TQ_volatileLoc; }
571  SourceLocation getAtomicSpecLoc() const { return TQ_atomicLoc; }
572  SourceLocation getUnalignedSpecLoc() const { return TQ_unalignedLoc; }
573  SourceLocation getPipeLoc() const { return TQ_pipeLoc; }
574 
575  /// Clear out all of the type qualifiers.
577  TypeQualifiers = 0;
578  TQ_constLoc = SourceLocation();
579  TQ_restrictLoc = SourceLocation();
580  TQ_volatileLoc = SourceLocation();
581  TQ_atomicLoc = SourceLocation();
582  TQ_unalignedLoc = SourceLocation();
583  TQ_pipeLoc = SourceLocation();
584  }
585 
586  // function-specifier
587  bool isInlineSpecified() const {
588  return FS_inline_specified | FS_forceinline_specified;
589  }
591  return FS_inline_specified ? FS_inlineLoc : FS_forceinlineLoc;
592  }
593 
595  return FS_explicit_specifier;
596  }
597 
598  bool isVirtualSpecified() const { return FS_virtual_specified; }
599  SourceLocation getVirtualSpecLoc() const { return FS_virtualLoc; }
600 
601  bool hasExplicitSpecifier() const {
602  return FS_explicit_specifier.isSpecified();
603  }
604  SourceLocation getExplicitSpecLoc() const { return FS_explicitLoc; }
606  return FS_explicit_specifier.getExpr()
607  ? SourceRange(FS_explicitLoc, FS_explicitCloseParenLoc)
608  : SourceRange(FS_explicitLoc);
609  }
610 
611  bool isNoreturnSpecified() const { return FS_noreturn_specified; }
612  SourceLocation getNoreturnSpecLoc() const { return FS_noreturnLoc; }
613 
615  FS_inline_specified = false;
616  FS_inlineLoc = SourceLocation();
617  FS_forceinline_specified = false;
618  FS_forceinlineLoc = SourceLocation();
619  FS_virtual_specified = false;
620  FS_virtualLoc = SourceLocation();
621  FS_explicit_specifier = ExplicitSpecifier();
622  FS_explicitLoc = SourceLocation();
623  FS_explicitCloseParenLoc = SourceLocation();
624  FS_noreturn_specified = false;
625  FS_noreturnLoc = SourceLocation();
626  }
627 
628  /// This method calls the passed in handler on each CVRU qual being
629  /// set.
630  /// Handle - a handler to be invoked.
632  llvm::function_ref<void(TQ, StringRef, SourceLocation)> Handle);
633 
634  /// This method calls the passed in handler on each qual being
635  /// set.
636  /// Handle - a handler to be invoked.
637  void forEachQualifier(
638  llvm::function_ref<void(TQ, StringRef, SourceLocation)> Handle);
639 
640  /// Return true if any type-specifier has been found.
641  bool hasTypeSpecifier() const {
646  }
647 
648  /// Return a bitmask of which flavors of specifiers this
649  /// DeclSpec includes.
650  unsigned getParsedSpecifiers() const;
651 
652  /// isEmpty - Return true if this declaration specifier is completely empty:
653  /// no tokens were parsed in the production of it.
654  bool isEmpty() const {
656  }
657 
658  void SetRangeStart(SourceLocation Loc) { Range.setBegin(Loc); }
659  void SetRangeEnd(SourceLocation Loc) { Range.setEnd(Loc); }
660 
661  /// These methods set the specified attribute of the DeclSpec and
662  /// return false if there was no error. If an error occurs (for
663  /// example, if we tried to set "auto" on a spec with "extern"
664  /// already set), they return true and set PrevSpec and DiagID
665  /// such that
666  /// Diag(Loc, DiagID) << PrevSpec;
667  /// will yield a useful result.
668  ///
669  /// TODO: use a more general approach that still allows these
670  /// diagnostics to be ignored when desired.
671  bool SetStorageClassSpec(Sema &S, SCS SC, SourceLocation Loc,
672  const char *&PrevSpec, unsigned &DiagID,
673  const PrintingPolicy &Policy);
675  const char *&PrevSpec, unsigned &DiagID);
677  const char *&PrevSpec, unsigned &DiagID,
678  const PrintingPolicy &Policy);
679  bool SetTypeSpecComplex(TSC C, SourceLocation Loc, const char *&PrevSpec,
680  unsigned &DiagID);
682  const char *&PrevSpec, unsigned &DiagID);
683  bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec,
684  unsigned &DiagID, const PrintingPolicy &Policy);
685  bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec,
686  unsigned &DiagID, ParsedType Rep,
687  const PrintingPolicy &Policy);
688  bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec,
689  unsigned &DiagID, TypeResult Rep,
690  const PrintingPolicy &Policy) {
691  if (Rep.isInvalid())
692  return SetTypeSpecError();
693  return SetTypeSpecType(T, Loc, PrevSpec, DiagID, Rep.get(), Policy);
694  }
695  bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec,
696  unsigned &DiagID, Decl *Rep, bool Owned,
697  const PrintingPolicy &Policy);
698  bool SetTypeSpecType(TST T, SourceLocation TagKwLoc,
699  SourceLocation TagNameLoc, const char *&PrevSpec,
700  unsigned &DiagID, ParsedType Rep,
701  const PrintingPolicy &Policy);
702  bool SetTypeSpecType(TST T, SourceLocation TagKwLoc,
703  SourceLocation TagNameLoc, const char *&PrevSpec,
704  unsigned &DiagID, Decl *Rep, bool Owned,
705  const PrintingPolicy &Policy);
706  bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec,
707  unsigned &DiagID, TemplateIdAnnotation *Rep,
708  const PrintingPolicy &Policy);
709 
710  bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec,
711  unsigned &DiagID, Expr *Rep,
712  const PrintingPolicy &policy);
713  bool SetTypeAltiVecVector(bool isAltiVecVector, SourceLocation Loc,
714  const char *&PrevSpec, unsigned &DiagID,
715  const PrintingPolicy &Policy);
716  bool SetTypeAltiVecPixel(bool isAltiVecPixel, SourceLocation Loc,
717  const char *&PrevSpec, unsigned &DiagID,
718  const PrintingPolicy &Policy);
719  bool SetTypeAltiVecBool(bool isAltiVecBool, SourceLocation Loc,
720  const char *&PrevSpec, unsigned &DiagID,
721  const PrintingPolicy &Policy);
722  bool SetTypePipe(bool isPipe, SourceLocation Loc,
723  const char *&PrevSpec, unsigned &DiagID,
724  const PrintingPolicy &Policy);
725  bool SetBitIntType(SourceLocation KWLoc, Expr *BitWidth,
726  const char *&PrevSpec, unsigned &DiagID,
727  const PrintingPolicy &Policy);
728  bool SetTypeSpecSat(SourceLocation Loc, const char *&PrevSpec,
729  unsigned &DiagID);
730  bool SetTypeSpecError();
731  void UpdateDeclRep(Decl *Rep) {
732  assert(isDeclRep((TST) TypeSpecType));
733  DeclRep = Rep;
734  }
736  assert(isTypeRep((TST) TypeSpecType));
737  TypeRep = Rep;
738  }
739  void UpdateExprRep(Expr *Rep) {
740  assert(isExprRep((TST) TypeSpecType));
741  ExprRep = Rep;
742  }
743 
744  bool SetTypeQual(TQ T, SourceLocation Loc);
745 
746  bool SetTypeQual(TQ T, SourceLocation Loc, const char *&PrevSpec,
747  unsigned &DiagID, const LangOptions &Lang);
748 
749  bool setFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec,
750  unsigned &DiagID);
751  bool setFunctionSpecForceInline(SourceLocation Loc, const char *&PrevSpec,
752  unsigned &DiagID);
753  bool setFunctionSpecVirtual(SourceLocation Loc, const char *&PrevSpec,
754  unsigned &DiagID);
755  bool setFunctionSpecExplicit(SourceLocation Loc, const char *&PrevSpec,
756  unsigned &DiagID, ExplicitSpecifier ExplicitSpec,
757  SourceLocation CloseParenLoc);
758  bool setFunctionSpecNoreturn(SourceLocation Loc, const char *&PrevSpec,
759  unsigned &DiagID);
760 
761  bool SetFriendSpec(SourceLocation Loc, const char *&PrevSpec,
762  unsigned &DiagID);
763  bool setModulePrivateSpec(SourceLocation Loc, const char *&PrevSpec,
764  unsigned &DiagID);
765  bool SetConstexprSpec(ConstexprSpecKind ConstexprKind, SourceLocation Loc,
766  const char *&PrevSpec, unsigned &DiagID);
767 
769  return static_cast<FriendSpecified>(Friend_specified);
770  }
771 
772  SourceLocation getFriendSpecLoc() const { return FriendLoc; }
773 
774  bool isModulePrivateSpecified() const { return ModulePrivateLoc.isValid(); }
775  SourceLocation getModulePrivateSpecLoc() const { return ModulePrivateLoc; }
776 
778  return ConstexprSpecKind(ConstexprSpecifier);
779  }
780 
781  SourceLocation getConstexprSpecLoc() const { return ConstexprLoc; }
782  bool hasConstexprSpecifier() const {
784  }
785 
787  ConstexprSpecifier = static_cast<unsigned>(ConstexprSpecKind::Unspecified);
788  ConstexprLoc = SourceLocation();
789  }
790 
792  return Attrs.getPool();
793  }
794 
795  /// Concatenates two attribute lists.
796  ///
797  /// The GCC attribute syntax allows for the following:
798  ///
799  /// \code
800  /// short __attribute__(( unused, deprecated ))
801  /// int __attribute__(( may_alias, aligned(16) )) var;
802  /// \endcode
803  ///
804  /// This declares 4 attributes using 2 lists. The following syntax is
805  /// also allowed and equivalent to the previous declaration.
806  ///
807  /// \code
808  /// short __attribute__((unused)) __attribute__((deprecated))
809  /// int __attribute__((may_alias)) __attribute__((aligned(16))) var;
810  /// \endcode
811  ///
813  Attrs.addAll(AL.begin(), AL.end());
814  }
815 
816  bool hasAttributes() const { return !Attrs.empty(); }
817 
818  ParsedAttributes &getAttributes() { return Attrs; }
819  const ParsedAttributes &getAttributes() const { return Attrs; }
820 
822  Attrs.takeAllFrom(attrs);
823  }
824 
825  /// Finish - This does final analysis of the declspec, issuing diagnostics for
826  /// things like "_Imaginary" (lacking an FP type). After calling this method,
827  /// DeclSpec is guaranteed self-consistent, even if an error occurred.
828  void Finish(Sema &S, const PrintingPolicy &Policy);
829 
831  return writtenBS;
832  }
833 
834  ObjCDeclSpec *getObjCQualifiers() const { return ObjCQualifiers; }
835  void setObjCQualifiers(ObjCDeclSpec *quals) { ObjCQualifiers = quals; }
836 
837  /// Checks if this DeclSpec can stand alone, without a Declarator.
838  ///
839  /// Only tag declspecs can stand alone.
840  bool isMissingDeclaratorOk();
841 };
842 
843 /// Captures information about "declaration specifiers" specific to
844 /// Objective-C.
846 public:
847  /// ObjCDeclQualifier - Qualifier used on types in method
848  /// declarations. Not all combinations are sensible. Parameters
849  /// can be one of { in, out, inout } with one of { bycopy, byref }.
850  /// Returns can either be { oneway } or not.
851  ///
852  /// This should be kept in sync with Decl::ObjCDeclQualifier.
854  DQ_None = 0x0,
855  DQ_In = 0x1,
856  DQ_Inout = 0x2,
857  DQ_Out = 0x4,
858  DQ_Bycopy = 0x8,
859  DQ_Byref = 0x10,
860  DQ_Oneway = 0x20,
862  };
863 
865  : objcDeclQualifier(DQ_None),
866  PropertyAttributes(ObjCPropertyAttribute::kind_noattr), Nullability(0),
867  GetterName(nullptr), SetterName(nullptr) {}
868 
870  return (ObjCDeclQualifier)objcDeclQualifier;
871  }
873  objcDeclQualifier = (ObjCDeclQualifier) (objcDeclQualifier | DQVal);
874  }
876  objcDeclQualifier = (ObjCDeclQualifier) (objcDeclQualifier & ~DQVal);
877  }
878 
880  return ObjCPropertyAttribute::Kind(PropertyAttributes);
881  }
883  PropertyAttributes =
884  (ObjCPropertyAttribute::Kind)(PropertyAttributes | PRVal);
885  }
886 
888  assert(
891  "Objective-C declspec doesn't have nullability");
892  return static_cast<NullabilityKind>(Nullability);
893  }
894 
896  assert(
899  "Objective-C declspec doesn't have nullability");
900  return NullabilityLoc;
901  }
902 
904  assert(
907  "Set the nullability declspec or property attribute first");
908  Nullability = static_cast<unsigned>(kind);
909  NullabilityLoc = loc;
910  }
911 
912  const IdentifierInfo *getGetterName() const { return GetterName; }
913  IdentifierInfo *getGetterName() { return GetterName; }
914  SourceLocation getGetterNameLoc() const { return GetterNameLoc; }
916  GetterName = name;
917  GetterNameLoc = loc;
918  }
919 
920  const IdentifierInfo *getSetterName() const { return SetterName; }
921  IdentifierInfo *getSetterName() { return SetterName; }
922  SourceLocation getSetterNameLoc() const { return SetterNameLoc; }
924  SetterName = name;
925  SetterNameLoc = loc;
926  }
927 
928 private:
929  // FIXME: These two are unrelated and mutually exclusive. So perhaps
930  // we can put them in a union to reflect their mutual exclusivity
931  // (space saving is negligible).
932  unsigned objcDeclQualifier : 7;
933 
934  // NOTE: VC++ treats enums as signed, avoid using ObjCPropertyAttribute::Kind
935  unsigned PropertyAttributes : NumObjCPropertyAttrsBits;
936 
937  unsigned Nullability : 2;
938 
939  SourceLocation NullabilityLoc;
940 
941  IdentifierInfo *GetterName; // getter name or NULL if no getter
942  IdentifierInfo *SetterName; // setter name or NULL if no setter
943  SourceLocation GetterNameLoc; // location of the getter attribute's value
944  SourceLocation SetterNameLoc; // location of the setter attribute's value
945 
946 };
947 
948 /// Describes the kind of unqualified-id parsed.
949 enum class UnqualifiedIdKind {
950  /// An identifier.
952  /// An overloaded operator name, e.g., operator+.
954  /// A conversion function name, e.g., operator int.
956  /// A user-defined literal name, e.g., operator "" _i.
958  /// A constructor name.
960  /// A constructor named via a template-id.
962  /// A destructor name.
964  /// A template-id, e.g., f<int>.
966  /// An implicit 'self' parameter
968  /// A deduction-guide name (a template-name)
970 };
971 
972 /// Represents a C++ unqualified-id that has been parsed.
974 private:
975  UnqualifiedId(const UnqualifiedId &Other) = delete;
976  const UnqualifiedId &operator=(const UnqualifiedId &) = delete;
977 
978  /// Describes the kind of unqualified-id parsed.
979  UnqualifiedIdKind Kind;
980 
981 public:
982  struct OFI {
983  /// The kind of overloaded operator.
985 
986  /// The source locations of the individual tokens that name
987  /// the operator, e.g., the "new", "[", and "]" tokens in
988  /// operator new [].
989  ///
990  /// Different operators have different numbers of tokens in their name,
991  /// up to three. Any remaining source locations in this array will be
992  /// set to an invalid value for operators with fewer than three tokens.
994  };
995 
996  /// Anonymous union that holds extra data associated with the
997  /// parsed unqualified-id.
998  union {
999  /// When Kind == IK_Identifier, the parsed identifier, or when
1000  /// Kind == IK_UserLiteralId, the identifier suffix.
1002 
1003  /// When Kind == IK_OperatorFunctionId, the overloaded operator
1004  /// that we parsed.
1006 
1007  /// When Kind == IK_ConversionFunctionId, the type that the
1008  /// conversion function names.
1010 
1011  /// When Kind == IK_ConstructorName, the class-name of the type
1012  /// whose constructor is being referenced.
1014 
1015  /// When Kind == IK_DestructorName, the type referred to by the
1016  /// class-name.
1018 
1019  /// When Kind == IK_DeductionGuideName, the parsed template-name.
1021 
1022  /// When Kind == IK_TemplateId or IK_ConstructorTemplateId,
1023  /// the template-id annotation that contains the template name and
1024  /// template arguments.
1026  };
1027 
1028  /// The location of the first token that describes this unqualified-id,
1029  /// which will be the location of the identifier, "operator" keyword,
1030  /// tilde (for a destructor), or the template name of a template-id.
1032 
1033  /// The location of the last token that describes this unqualified-id.
1035 
1038 
1039  /// Clear out this unqualified-id, setting it to default (invalid)
1040  /// state.
1041  void clear() {
1043  Identifier = nullptr;
1046  }
1047 
1048  /// Determine whether this unqualified-id refers to a valid name.
1049  bool isValid() const { return StartLocation.isValid(); }
1050 
1051  /// Determine whether this unqualified-id refers to an invalid name.
1052  bool isInvalid() const { return !isValid(); }
1053 
1054  /// Determine what kind of name we have.
1055  UnqualifiedIdKind getKind() const { return Kind; }
1056 
1057  /// Specify that this unqualified-id was parsed as an identifier.
1058  ///
1059  /// \param Id the parsed identifier.
1060  /// \param IdLoc the location of the parsed identifier.
1063  Identifier = const_cast<IdentifierInfo *>(Id);
1064  StartLocation = EndLocation = IdLoc;
1065  }
1066 
1067  /// Specify that this unqualified-id was parsed as an
1068  /// operator-function-id.
1069  ///
1070  /// \param OperatorLoc the location of the 'operator' keyword.
1071  ///
1072  /// \param Op the overloaded operator.
1073  ///
1074  /// \param SymbolLocations the locations of the individual operator symbols
1075  /// in the operator.
1076  void setOperatorFunctionId(SourceLocation OperatorLoc,
1078  SourceLocation SymbolLocations[3]);
1079 
1080  /// Specify that this unqualified-id was parsed as a
1081  /// conversion-function-id.
1082  ///
1083  /// \param OperatorLoc the location of the 'operator' keyword.
1084  ///
1085  /// \param Ty the type to which this conversion function is converting.
1086  ///
1087  /// \param EndLoc the location of the last token that makes up the type name.
1089  ParsedType Ty,
1090  SourceLocation EndLoc) {
1092  StartLocation = OperatorLoc;
1093  EndLocation = EndLoc;
1094  ConversionFunctionId = Ty;
1095  }
1096 
1097  /// Specific that this unqualified-id was parsed as a
1098  /// literal-operator-id.
1099  ///
1100  /// \param Id the parsed identifier.
1101  ///
1102  /// \param OpLoc the location of the 'operator' keyword.
1103  ///
1104  /// \param IdLoc the location of the identifier.
1106  SourceLocation IdLoc) {
1108  Identifier = const_cast<IdentifierInfo *>(Id);
1109  StartLocation = OpLoc;
1110  EndLocation = IdLoc;
1111  }
1112 
1113  /// Specify that this unqualified-id was parsed as a constructor name.
1114  ///
1115  /// \param ClassType the class type referred to by the constructor name.
1116  ///
1117  /// \param ClassNameLoc the location of the class name.
1118  ///
1119  /// \param EndLoc the location of the last token that makes up the type name.
1121  SourceLocation ClassNameLoc,
1122  SourceLocation EndLoc) {
1124  StartLocation = ClassNameLoc;
1125  EndLocation = EndLoc;
1126  ConstructorName = ClassType;
1127  }
1128 
1129  /// Specify that this unqualified-id was parsed as a
1130  /// template-id that names a constructor.
1131  ///
1132  /// \param TemplateId the template-id annotation that describes the parsed
1133  /// template-id. This UnqualifiedId instance will take ownership of the
1134  /// \p TemplateId and will free it on destruction.
1136 
1137  /// Specify that this unqualified-id was parsed as a destructor name.
1138  ///
1139  /// \param TildeLoc the location of the '~' that introduces the destructor
1140  /// name.
1141  ///
1142  /// \param ClassType the name of the class referred to by the destructor name.
1144  ParsedType ClassType,
1145  SourceLocation EndLoc) {
1147  StartLocation = TildeLoc;
1148  EndLocation = EndLoc;
1149  DestructorName = ClassType;
1150  }
1151 
1152  /// Specify that this unqualified-id was parsed as a template-id.
1153  ///
1154  /// \param TemplateId the template-id annotation that describes the parsed
1155  /// template-id. This UnqualifiedId instance will take ownership of the
1156  /// \p TemplateId and will free it on destruction.
1158 
1159  /// Specify that this unqualified-id was parsed as a template-name for
1160  /// a deduction-guide.
1161  ///
1162  /// \param Template The parsed template-name.
1163  /// \param TemplateLoc The location of the parsed template-name.
1165  SourceLocation TemplateLoc) {
1167  TemplateName = Template;
1168  StartLocation = EndLocation = TemplateLoc;
1169  }
1170 
1171  /// Specify that this unqualified-id is an implicit 'self'
1172  /// parameter.
1173  ///
1174  /// \param Id the identifier.
1177  Identifier = const_cast<IdentifierInfo *>(Id);
1179  }
1180 
1181  /// Return the source range that covers this unqualified-id.
1182  SourceRange getSourceRange() const LLVM_READONLY {
1184  }
1185  SourceLocation getBeginLoc() const LLVM_READONLY { return StartLocation; }
1186  SourceLocation getEndLoc() const LLVM_READONLY { return EndLocation; }
1187 };
1188 
1189 /// A set of tokens that has been cached for later parsing.
1191 
1192 /// One instance of this struct is used for each type in a
1193 /// declarator that is parsed.
1194 ///
1195 /// This is intended to be a small value object.
1198 
1199  enum {
1201  } Kind;
1202 
1203  /// Loc - The place where this type was defined.
1205  /// EndLoc - If valid, the place where this chunck ends.
1207 
1209  if (EndLoc.isInvalid())
1210  return SourceRange(Loc, Loc);
1211  return SourceRange(Loc, EndLoc);
1212  }
1213 
1215 
1217  /// The type qualifiers: const/volatile/restrict/unaligned/atomic.
1218  unsigned TypeQuals : 5;
1219 
1220  /// The location of the const-qualifier, if any.
1222 
1223  /// The location of the volatile-qualifier, if any.
1225 
1226  /// The location of the restrict-qualifier, if any.
1228 
1229  /// The location of the _Atomic-qualifier, if any.
1231 
1232  /// The location of the __unaligned-qualifier, if any.
1234 
1235  void destroy() {
1236  }
1237  };
1238 
1240  /// The type qualifier: restrict. [GNU] C++ extension
1241  bool HasRestrict : 1;
1242  /// True if this is an lvalue reference, false if it's an rvalue reference.
1243  bool LValueRef : 1;
1244  void destroy() {
1245  }
1246  };
1247 
1248  struct ArrayTypeInfo {
1249  /// The type qualifiers for the array:
1250  /// const/volatile/restrict/__unaligned/_Atomic.
1251  unsigned TypeQuals : 5;
1252 
1253  /// True if this dimension included the 'static' keyword.
1254  unsigned hasStatic : 1;
1255 
1256  /// True if this dimension was [*]. In this case, NumElts is null.
1257  unsigned isStar : 1;
1258 
1259  /// This is the size of the array, or null if [] or [*] was specified.
1260  /// Since the parser is multi-purpose, and we don't want to impose a root
1261  /// expression class on all clients, NumElts is untyped.
1263 
1264  void destroy() {}
1265  };
1266 
1267  /// ParamInfo - An array of paraminfo objects is allocated whenever a function
1268  /// declarator is parsed. There are two interesting styles of parameters
1269  /// here:
1270  /// K&R-style identifier lists and parameter type lists. K&R-style identifier
1271  /// lists will have information about the identifier, but no type information.
1272  /// Parameter type lists will have type info (if the actions module provides
1273  /// it), but may have null identifier info: e.g. for 'void foo(int X, int)'.
1274  struct ParamInfo {
1278 
1279  /// DefaultArgTokens - When the parameter's default argument
1280  /// cannot be parsed immediately (because it occurs within the
1281  /// declaration of a member function), it will be stored here as a
1282  /// sequence of tokens to be parsed once the class definition is
1283  /// complete. Non-NULL indicates that there is a default argument.
1284  std::unique_ptr<CachedTokens> DefaultArgTokens;
1285 
1286  ParamInfo() = default;
1288  Decl *param,
1289  std::unique_ptr<CachedTokens> DefArgTokens = nullptr)
1290  : Ident(ident), IdentLoc(iloc), Param(param),
1291  DefaultArgTokens(std::move(DefArgTokens)) {}
1292  };
1293 
1294  struct TypeAndRange {
1297  };
1298 
1300  /// hasPrototype - This is true if the function had at least one typed
1301  /// parameter. If the function is () or (a,b,c), then it has no prototype,
1302  /// and is treated as a K&R-style function.
1303  unsigned hasPrototype : 1;
1304 
1305  /// isVariadic - If this function has a prototype, and if that
1306  /// proto ends with ',...)', this is true. When true, EllipsisLoc
1307  /// contains the location of the ellipsis.
1308  unsigned isVariadic : 1;
1309 
1310  /// Can this declaration be a constructor-style initializer?
1311  unsigned isAmbiguous : 1;
1312 
1313  /// Whether the ref-qualifier (if any) is an lvalue reference.
1314  /// Otherwise, it's an rvalue reference.
1316 
1317  /// ExceptionSpecType - An ExceptionSpecificationType value.
1318  unsigned ExceptionSpecType : 4;
1319 
1320  /// DeleteParams - If this is true, we need to delete[] Params.
1321  unsigned DeleteParams : 1;
1322 
1323  /// HasTrailingReturnType - If this is true, a trailing return type was
1324  /// specified.
1326 
1327  /// The location of the left parenthesis in the source.
1329 
1330  /// When isVariadic is true, the location of the ellipsis in the source.
1332 
1333  /// The location of the right parenthesis in the source.
1335 
1336  /// NumParams - This is the number of formal parameters specified by the
1337  /// declarator.
1338  unsigned NumParams;
1339 
1340  /// NumExceptionsOrDecls - This is the number of types in the
1341  /// dynamic-exception-decl, if the function has one. In C, this is the
1342  /// number of declarations in the function prototype.
1344 
1345  /// The location of the ref-qualifier, if any.
1346  ///
1347  /// If this is an invalid location, there is no ref-qualifier.
1349 
1350  /// The location of the 'mutable' qualifer in a lambda-declarator, if
1351  /// any.
1353 
1354  /// The beginning location of the exception specification, if any.
1356 
1357  /// The end location of the exception specification, if any.
1359 
1360  /// Params - This is a pointer to a new[]'d array of ParamInfo objects that
1361  /// describe the parameters specified by this function declarator. null if
1362  /// there are no parameters specified.
1364 
1365  /// DeclSpec for the function with the qualifier related info.
1367 
1368  /// AttributeFactory for the MethodQualifiers.
1370 
1371  union {
1372  /// Pointer to a new[]'d array of TypeAndRange objects that
1373  /// contain the types in the function's dynamic exception specification
1374  /// and their locations, if there is one.
1376 
1377  /// Pointer to the expression in the noexcept-specifier of this
1378  /// function, if it has one.
1380 
1381  /// Pointer to the cached tokens for an exception-specification
1382  /// that has not yet been parsed.
1384 
1385  /// Pointer to a new[]'d array of declarations that need to be available
1386  /// for lookup inside the function body, if one exists. Does not exist in
1387  /// C++.
1389  };
1390 
1391  /// If HasTrailingReturnType is true, this is the trailing return
1392  /// type specified.
1394 
1395  /// If HasTrailingReturnType is true, this is the location of the trailing
1396  /// return type.
1398 
1399  /// Reset the parameter list to having zero parameters.
1400  ///
1401  /// This is used in various places for error recovery.
1402  void freeParams() {
1403  for (unsigned I = 0; I < NumParams; ++I)
1404  Params[I].DefaultArgTokens.reset();
1405  if (DeleteParams) {
1406  delete[] Params;
1407  DeleteParams = false;
1408  }
1409  NumParams = 0;
1410  }
1411 
1412  void destroy() {
1413  freeParams();
1414  delete QualAttrFactory;
1415  delete MethodQualifiers;
1416  switch (getExceptionSpecType()) {
1417  default:
1418  break;
1419  case EST_Dynamic:
1420  delete[] Exceptions;
1421  break;
1422  case EST_Unparsed:
1423  delete ExceptionSpecTokens;
1424  break;
1425  case EST_None:
1426  if (NumExceptionsOrDecls != 0)
1427  delete[] DeclsInPrototype;
1428  break;
1429  }
1430  }
1431 
1433  if (!MethodQualifiers) {
1436  }
1437  return *MethodQualifiers;
1438  }
1439 
1440  /// isKNRPrototype - Return true if this is a K&R style identifier list,
1441  /// like "void foo(a,b,c)". In a function definition, this will be followed
1442  /// by the parameter type definitions.
1443  bool isKNRPrototype() const { return !hasPrototype && NumParams != 0; }
1444 
1446 
1448 
1450 
1452  return ExceptionSpecLocBeg;
1453  }
1454 
1456  return ExceptionSpecLocEnd;
1457  }
1458 
1461  }
1462 
1463  /// Retrieve the location of the ref-qualifier, if any.
1465 
1466  /// Retrieve the location of the 'const' qualifier.
1468  assert(MethodQualifiers);
1470  }
1471 
1472  /// Retrieve the location of the 'volatile' qualifier.
1474  assert(MethodQualifiers);
1476  }
1477 
1478  /// Retrieve the location of the 'restrict' qualifier.
1480  assert(MethodQualifiers);
1482  }
1483 
1484  /// Retrieve the location of the 'mutable' qualifier, if any.
1486 
1487  /// Determine whether this function declaration contains a
1488  /// ref-qualifier.
1489  bool hasRefQualifier() const { return getRefQualifierLoc().isValid(); }
1490 
1491  /// Determine whether this lambda-declarator contains a 'mutable'
1492  /// qualifier.
1493  bool hasMutableQualifier() const { return getMutableLoc().isValid(); }
1494 
1495  /// Determine whether this method has qualifiers.
1499  }
1500 
1501  /// Get the type of exception specification this function has.
1503  return static_cast<ExceptionSpecificationType>(ExceptionSpecType);
1504  }
1505 
1506  /// Get the number of dynamic exception specifications.
1507  unsigned getNumExceptions() const {
1508  assert(ExceptionSpecType != EST_None);
1509  return NumExceptionsOrDecls;
1510  }
1511 
1512  /// Get the non-parameter decls defined within this function
1513  /// prototype. Typically these are tag declarations.
1515  assert(ExceptionSpecType == EST_None);
1516  return llvm::makeArrayRef(DeclsInPrototype, NumExceptionsOrDecls);
1517  }
1518 
1519  /// Determine whether this function declarator had a
1520  /// trailing-return-type.
1522 
1523  /// Get the trailing-return-type for this function declarator.
1525  assert(HasTrailingReturnType);
1526  return TrailingReturnType;
1527  }
1528 
1529  /// Get the trailing-return-type location for this function declarator.
1531  assert(HasTrailingReturnType);
1532  return TrailingReturnTypeLoc;
1533  }
1534  };
1535 
1537  /// For now, sema will catch these as invalid.
1538  /// The type qualifiers: const/volatile/restrict/__unaligned/_Atomic.
1539  unsigned TypeQuals : 5;
1540 
1541  void destroy() {
1542  }
1543  };
1544 
1546  /// The type qualifiers: const/volatile/restrict/__unaligned/_Atomic.
1547  unsigned TypeQuals : 5;
1548  /// Location of the '*' token.
1550  // CXXScopeSpec has a constructor, so it can't be a direct member.
1551  // So we need some pointer-aligned storage and a bit of trickery.
1552  alignas(CXXScopeSpec) char ScopeMem[sizeof(CXXScopeSpec)];
1554  return *reinterpret_cast<CXXScopeSpec *>(ScopeMem);
1555  }
1556  const CXXScopeSpec &Scope() const {
1557  return *reinterpret_cast<const CXXScopeSpec *>(ScopeMem);
1558  }
1559  void destroy() {
1560  Scope().~CXXScopeSpec();
1561  }
1562  };
1563 
1564  struct PipeTypeInfo {
1565  /// The access writes.
1566  unsigned AccessWrites : 3;
1567 
1568  void destroy() {}
1569  };
1570 
1571  union {
1579  };
1580 
1581  void destroy() {
1582  switch (Kind) {
1583  case DeclaratorChunk::Function: return Fun.destroy();
1584  case DeclaratorChunk::Pointer: return Ptr.destroy();
1585  case DeclaratorChunk::BlockPointer: return Cls.destroy();
1586  case DeclaratorChunk::Reference: return Ref.destroy();
1587  case DeclaratorChunk::Array: return Arr.destroy();
1589  case DeclaratorChunk::Paren: return;
1590  case DeclaratorChunk::Pipe: return PipeInfo.destroy();
1591  }
1592  }
1593 
1594  /// If there are attributes applied to this declaratorchunk, return
1595  /// them.
1596  const ParsedAttributesView &getAttrs() const { return AttrList; }
1598 
1599  /// Return a DeclaratorChunk for a pointer.
1600  static DeclaratorChunk getPointer(unsigned TypeQuals, SourceLocation Loc,
1601  SourceLocation ConstQualLoc,
1602  SourceLocation VolatileQualLoc,
1603  SourceLocation RestrictQualLoc,
1604  SourceLocation AtomicQualLoc,
1605  SourceLocation UnalignedQualLoc) {
1606  DeclaratorChunk I;
1607  I.Kind = Pointer;
1608  I.Loc = Loc;
1609  new (&I.Ptr) PointerTypeInfo;
1610  I.Ptr.TypeQuals = TypeQuals;
1611  I.Ptr.ConstQualLoc = ConstQualLoc;
1612  I.Ptr.VolatileQualLoc = VolatileQualLoc;
1613  I.Ptr.RestrictQualLoc = RestrictQualLoc;
1614  I.Ptr.AtomicQualLoc = AtomicQualLoc;
1615  I.Ptr.UnalignedQualLoc = UnalignedQualLoc;
1616  return I;
1617  }
1618 
1619  /// Return a DeclaratorChunk for a reference.
1620  static DeclaratorChunk getReference(unsigned TypeQuals, SourceLocation Loc,
1621  bool lvalue) {
1622  DeclaratorChunk I;
1623  I.Kind = Reference;
1624  I.Loc = Loc;
1625  I.Ref.HasRestrict = (TypeQuals & DeclSpec::TQ_restrict) != 0;
1626  I.Ref.LValueRef = lvalue;
1627  return I;
1628  }
1629 
1630  /// Return a DeclaratorChunk for an array.
1631  static DeclaratorChunk getArray(unsigned TypeQuals,
1632  bool isStatic, bool isStar, Expr *NumElts,
1633  SourceLocation LBLoc, SourceLocation RBLoc) {
1634  DeclaratorChunk I;
1635  I.Kind = Array;
1636  I.Loc = LBLoc;
1637  I.EndLoc = RBLoc;
1638  I.Arr.TypeQuals = TypeQuals;
1639  I.Arr.hasStatic = isStatic;
1640  I.Arr.isStar = isStar;
1641  I.Arr.NumElts = NumElts;
1642  return I;
1643  }
1644 
1645  /// DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
1646  /// "TheDeclarator" is the declarator that this will be added to.
1647  static DeclaratorChunk getFunction(bool HasProto,
1648  bool IsAmbiguous,
1649  SourceLocation LParenLoc,
1650  ParamInfo *Params, unsigned NumParams,
1651  SourceLocation EllipsisLoc,
1652  SourceLocation RParenLoc,
1653  bool RefQualifierIsLvalueRef,
1654  SourceLocation RefQualifierLoc,
1655  SourceLocation MutableLoc,
1656  ExceptionSpecificationType ESpecType,
1657  SourceRange ESpecRange,
1658  ParsedType *Exceptions,
1659  SourceRange *ExceptionRanges,
1660  unsigned NumExceptions,
1661  Expr *NoexceptExpr,
1662  CachedTokens *ExceptionSpecTokens,
1663  ArrayRef<NamedDecl *> DeclsInPrototype,
1664  SourceLocation LocalRangeBegin,
1665  SourceLocation LocalRangeEnd,
1666  Declarator &TheDeclarator,
1667  TypeResult TrailingReturnType =
1668  TypeResult(),
1669  SourceLocation TrailingReturnTypeLoc =
1670  SourceLocation(),
1671  DeclSpec *MethodQualifiers = nullptr);
1672 
1673  /// Return a DeclaratorChunk for a block.
1674  static DeclaratorChunk getBlockPointer(unsigned TypeQuals,
1675  SourceLocation Loc) {
1676  DeclaratorChunk I;
1677  I.Kind = BlockPointer;
1678  I.Loc = Loc;
1679  I.Cls.TypeQuals = TypeQuals;
1680  return I;
1681  }
1682 
1683  /// Return a DeclaratorChunk for a block.
1684  static DeclaratorChunk getPipe(unsigned TypeQuals,
1685  SourceLocation Loc) {
1686  DeclaratorChunk I;
1687  I.Kind = Pipe;
1688  I.Loc = Loc;
1689  I.Cls.TypeQuals = TypeQuals;
1690  return I;
1691  }
1692 
1694  unsigned TypeQuals,
1695  SourceLocation StarLoc,
1697  DeclaratorChunk I;
1698  I.Kind = MemberPointer;
1699  I.Loc = SS.getBeginLoc();
1700  I.EndLoc = EndLoc;
1701  new (&I.Mem) MemberPointerTypeInfo;
1702  I.Mem.StarLoc = StarLoc;
1703  I.Mem.TypeQuals = TypeQuals;
1704  new (I.Mem.ScopeMem) CXXScopeSpec(SS);
1705  return I;
1706  }
1707 
1708  /// Return a DeclaratorChunk for a paren.
1710  SourceLocation RParenLoc) {
1711  DeclaratorChunk I;
1712  I.Kind = Paren;
1713  I.Loc = LParenLoc;
1714  I.EndLoc = RParenLoc;
1715  return I;
1716  }
1717 
1718  bool isParen() const {
1719  return Kind == Paren;
1720  }
1721 };
1722 
1723 /// A parsed C++17 decomposition declarator of the form
1724 /// '[' identifier-list ']'
1726 public:
1727  struct Binding {
1730  };
1731 
1732 private:
1733  /// The locations of the '[' and ']' tokens.
1734  SourceLocation LSquareLoc, RSquareLoc;
1735 
1736  /// The bindings.
1737  Binding *Bindings;
1738  unsigned NumBindings : 31;
1739  unsigned DeleteBindings : 1;
1740 
1741  friend class Declarator;
1742 
1743 public:
1745  : Bindings(nullptr), NumBindings(0), DeleteBindings(false) {}
1749  if (DeleteBindings)
1750  delete[] Bindings;
1751  }
1752 
1753  void clear() {
1754  LSquareLoc = RSquareLoc = SourceLocation();
1755  if (DeleteBindings)
1756  delete[] Bindings;
1757  Bindings = nullptr;
1758  NumBindings = 0;
1759  DeleteBindings = false;
1760  }
1761 
1763  return llvm::makeArrayRef(Bindings, NumBindings);
1764  }
1765 
1766  bool isSet() const { return LSquareLoc.isValid(); }
1767 
1768  SourceLocation getLSquareLoc() const { return LSquareLoc; }
1769  SourceLocation getRSquareLoc() const { return RSquareLoc; }
1771  return SourceRange(LSquareLoc, RSquareLoc);
1772  }
1773 };
1774 
1775 /// Described the kind of function definition (if any) provided for
1776 /// a function.
1778  Declaration,
1779  Definition,
1780  Defaulted,
1781  Deleted
1782 };
1783 
1784 enum class DeclaratorContext {
1785  File, // File scope declaration.
1786  Prototype, // Within a function prototype.
1787  ObjCResult, // An ObjC method result type.
1788  ObjCParameter, // An ObjC method parameter type.
1789  KNRTypeList, // K&R type definition list for formals.
1790  TypeName, // Abstract declarator for types.
1791  FunctionalCast, // Type in a C++ functional cast expression.
1792  Member, // Struct/Union field.
1793  Block, // Declaration within a block in a function.
1794  ForInit, // Declaration within first part of a for loop.
1795  SelectionInit, // Declaration within optional init stmt of if/switch.
1796  Condition, // Condition declaration in a C++ if/switch/while/for.
1797  TemplateParam, // Within a template parameter list.
1798  CXXNew, // C++ new-expression.
1799  CXXCatch, // C++ catch exception-declaration
1800  ObjCCatch, // Objective-C catch exception-declaration
1801  BlockLiteral, // Block literal declarator.
1802  LambdaExpr, // Lambda-expression declarator.
1803  LambdaExprParameter, // Lambda-expression parameter declarator.
1804  ConversionId, // C++ conversion-type-id.
1805  TrailingReturn, // C++11 trailing-type-specifier.
1806  TrailingReturnVar, // C++11 trailing-type-specifier for variable.
1807  TemplateArg, // Any template argument (in template argument list).
1808  TemplateTypeArg, // Template type argument (in default argument).
1809  AliasDecl, // C++11 alias-declaration.
1810  AliasTemplate, // C++11 alias-declaration template.
1811  RequiresExpr, // C++2a requires-expression.
1812  Association // C11 _Generic selection expression association.
1813 };
1814 
1815 // Describes whether the current context is a context where an implicit
1816 // typename is allowed (C++2a [temp.res]p5]).
1818  No,
1819  Yes,
1820 };
1821 
1822 /// Information about one declarator, including the parsed type
1823 /// information and the identifier.
1824 ///
1825 /// When the declarator is fully formed, this is turned into the appropriate
1826 /// Decl object.
1827 ///
1828 /// Declarators come in two types: normal declarators and abstract declarators.
1829 /// Abstract declarators are used when parsing types, and don't have an
1830 /// identifier. Normal declarators do have ID's.
1831 ///
1832 /// Instances of this class should be a transient object that lives on the
1833 /// stack, not objects that are allocated in large quantities on the heap.
1834 class Declarator {
1835 
1836 private:
1837  const DeclSpec &DS;
1838  CXXScopeSpec SS;
1839  UnqualifiedId Name;
1840  SourceRange Range;
1841 
1842  /// Where we are parsing this declarator.
1843  DeclaratorContext Context;
1844 
1845  /// The C++17 structured binding, if any. This is an alternative to a Name.
1846  DecompositionDeclarator BindingGroup;
1847 
1848  /// DeclTypeInfo - This holds each type that the declarator includes as it is
1849  /// parsed. This is pushed from the identifier out, which means that element
1850  /// #0 will be the most closely bound to the identifier, and
1851  /// DeclTypeInfo.back() will be the least closely bound.
1852  SmallVector<DeclaratorChunk, 8> DeclTypeInfo;
1853 
1854  /// InvalidType - Set by Sema::GetTypeForDeclarator().
1855  unsigned InvalidType : 1;
1856 
1857  /// GroupingParens - Set by Parser::ParseParenDeclarator().
1858  unsigned GroupingParens : 1;
1859 
1860  /// FunctionDefinition - Is this Declarator for a function or member
1861  /// definition and, if so, what kind?
1862  ///
1863  /// Actually a FunctionDefinitionKind.
1864  unsigned FunctionDefinition : 2;
1865 
1866  /// Is this Declarator a redeclaration?
1867  unsigned Redeclaration : 1;
1868 
1869  /// true if the declaration is preceded by \c __extension__.
1870  unsigned Extension : 1;
1871 
1872  /// Indicates whether this is an Objective-C instance variable.
1873  unsigned ObjCIvar : 1;
1874 
1875  /// Indicates whether this is an Objective-C 'weak' property.
1876  unsigned ObjCWeakProperty : 1;
1877 
1878  /// Indicates whether the InlineParams / InlineBindings storage has been used.
1879  unsigned InlineStorageUsed : 1;
1880 
1881  /// Indicates whether this declarator has an initializer.
1882  unsigned HasInitializer : 1;
1883 
1884  /// Attributes attached to the declarator.
1885  ParsedAttributes Attrs;
1886 
1887  /// Attributes attached to the declaration. See also documentation for the
1888  /// corresponding constructor parameter.
1889  const ParsedAttributesView &DeclarationAttrs;
1890 
1891  /// The asm label, if specified.
1892  Expr *AsmLabel;
1893 
1894  /// \brief The constraint-expression specified by the trailing
1895  /// requires-clause, or null if no such clause was specified.
1896  Expr *TrailingRequiresClause;
1897 
1898  /// If this declarator declares a template, its template parameter lists.
1899  ArrayRef<TemplateParameterList *> TemplateParameterLists;
1900 
1901  /// If the declarator declares an abbreviated function template, the innermost
1902  /// template parameter list containing the invented and explicit template
1903  /// parameters (if any).
1904  TemplateParameterList *InventedTemplateParameterList;
1905 
1906 #ifndef _MSC_VER
1907  union {
1908 #endif
1909  /// InlineParams - This is a local array used for the first function decl
1910  /// chunk to avoid going to the heap for the common case when we have one
1911  /// function chunk in the declarator.
1914 #ifndef _MSC_VER
1915  };
1916 #endif
1917 
1918  /// If this is the second or subsequent declarator in this declaration,
1919  /// the location of the comma before this declarator.
1920  SourceLocation CommaLoc;
1921 
1922  /// If provided, the source location of the ellipsis used to describe
1923  /// this declarator as a parameter pack.
1924  SourceLocation EllipsisLoc;
1925 
1926  friend struct DeclaratorChunk;
1927 
1928 public:
1929  /// `DS` and `DeclarationAttrs` must outlive the `Declarator`. In particular,
1930  /// take care not to pass temporary objects for these parameters.
1931  ///
1932  /// `DeclarationAttrs` contains [[]] attributes from the
1933  /// attribute-specifier-seq at the beginning of a declaration, which appertain
1934  /// to the declared entity itself. Attributes with other syntax (e.g. GNU)
1935  /// should not be placed in this attribute list; if they occur at the
1936  /// beginning of a declaration, they apply to the `DeclSpec` and should be
1937  /// attached to that instead.
1938  ///
1939  /// Here is an example of an attribute associated with a declaration:
1940  ///
1941  /// [[deprecated]] int x, y;
1942  ///
1943  /// This attribute appertains to all of the entities declared in the
1944  /// declaration, i.e. `x` and `y` in this case.
1945  Declarator(const DeclSpec &DS, const ParsedAttributesView &DeclarationAttrs,
1947  : DS(DS), Range(DS.getSourceRange()), Context(C),
1948  InvalidType(DS.getTypeSpecType() == DeclSpec::TST_error),
1949  GroupingParens(false), FunctionDefinition(static_cast<unsigned>(
1950  FunctionDefinitionKind::Declaration)),
1951  Redeclaration(false), Extension(false), ObjCIvar(false),
1952  ObjCWeakProperty(false), InlineStorageUsed(false),
1953  HasInitializer(false), Attrs(DS.getAttributePool().getFactory()),
1954  DeclarationAttrs(DeclarationAttrs), AsmLabel(nullptr),
1955  TrailingRequiresClause(nullptr),
1956  InventedTemplateParameterList(nullptr) {
1957  assert(llvm::all_of(DeclarationAttrs,
1958  [](const ParsedAttr &AL) {
1959  return AL.isStandardAttributeSyntax();
1960  }) &&
1961  "DeclarationAttrs may only contain [[]] attributes");
1962  }
1963 
1965  clear();
1966  }
1967  /// getDeclSpec - Return the declaration-specifier that this declarator was
1968  /// declared with.
1969  const DeclSpec &getDeclSpec() const { return DS; }
1970 
1971  /// getMutableDeclSpec - Return a non-const version of the DeclSpec. This
1972  /// should be used with extreme care: declspecs can often be shared between
1973  /// multiple declarators, so mutating the DeclSpec affects all of the
1974  /// Declarators. This should only be done when the declspec is known to not
1975  /// be shared or when in error recovery etc.
1976  DeclSpec &getMutableDeclSpec() { return const_cast<DeclSpec &>(DS); }
1977 
1979  return Attrs.getPool();
1980  }
1981 
1982  /// getCXXScopeSpec - Return the C++ scope specifier (global scope or
1983  /// nested-name-specifier) that is part of the declarator-id.
1984  const CXXScopeSpec &getCXXScopeSpec() const { return SS; }
1985  CXXScopeSpec &getCXXScopeSpec() { return SS; }
1986 
1987  /// Retrieve the name specified by this declarator.
1988  UnqualifiedId &getName() { return Name; }
1989 
1991  return BindingGroup;
1992  }
1993 
1994  DeclaratorContext getContext() const { return Context; }
1995 
1996  bool isPrototypeContext() const {
1997  return (Context == DeclaratorContext::Prototype ||
1998  Context == DeclaratorContext::ObjCParameter ||
1999  Context == DeclaratorContext::ObjCResult ||
2001  }
2002 
2003  /// Get the source range that spans this declarator.
2004  SourceRange getSourceRange() const LLVM_READONLY { return Range; }
2005  SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
2006  SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
2007 
2008  void SetSourceRange(SourceRange R) { Range = R; }
2009  /// SetRangeBegin - Set the start of the source range to Loc, unless it's
2010  /// invalid.
2012  if (!Loc.isInvalid())
2013  Range.setBegin(Loc);
2014  }
2015  /// SetRangeEnd - Set the end of the source range to Loc, unless it's invalid.
2017  if (!Loc.isInvalid())
2018  Range.setEnd(Loc);
2019  }
2020  /// ExtendWithDeclSpec - Extend the declarator source range to include the
2021  /// given declspec, unless its location is invalid. Adopts the range start if
2022  /// the current range start is invalid.
2023  void ExtendWithDeclSpec(const DeclSpec &DS) {
2024  SourceRange SR = DS.getSourceRange();
2025  if (Range.getBegin().isInvalid())
2026  Range.setBegin(SR.getBegin());
2027  if (!SR.getEnd().isInvalid())
2028  Range.setEnd(SR.getEnd());
2029  }
2030 
2031  /// Reset the contents of this Declarator.
2032  void clear() {
2033  SS.clear();
2034  Name.clear();
2035  Range = DS.getSourceRange();
2036  BindingGroup.clear();
2037 
2038  for (unsigned i = 0, e = DeclTypeInfo.size(); i != e; ++i)
2039  DeclTypeInfo[i].destroy();
2040  DeclTypeInfo.clear();
2041  Attrs.clear();
2042  AsmLabel = nullptr;
2043  InlineStorageUsed = false;
2044  HasInitializer = false;
2045  ObjCIvar = false;
2046  ObjCWeakProperty = false;
2047  CommaLoc = SourceLocation();
2048  EllipsisLoc = SourceLocation();
2049  }
2050 
2051  /// mayOmitIdentifier - Return true if the identifier is either optional or
2052  /// not allowed. This is true for typenames, prototypes, and template
2053  /// parameter lists.
2054  bool mayOmitIdentifier() const {
2055  switch (Context) {
2063  return false;
2064 
2086  return true;
2087  }
2088  llvm_unreachable("unknown context kind!");
2089  }
2090 
2091  /// mayHaveIdentifier - Return true if the identifier is either optional or
2092  /// required. This is true for normal declarators and prototypes, but not
2093  /// typenames.
2094  bool mayHaveIdentifier() const {
2095  switch (Context) {
2109  return true;
2110 
2126  return false;
2127  }
2128  llvm_unreachable("unknown context kind!");
2129  }
2130 
2131  /// Return true if the context permits a C++17 decomposition declarator.
2133  switch (Context) {
2135  // FIXME: It's not clear that the proposal meant to allow file-scope
2136  // structured bindings, but it does.
2141  return true;
2142 
2147  // Maybe one day...
2148  return false;
2149 
2150  // These contexts don't allow any kind of non-abstract declarator.
2170  return false;
2171  }
2172  llvm_unreachable("unknown context kind!");
2173  }
2174 
2175  /// mayBeFollowedByCXXDirectInit - Return true if the declarator can be
2176  /// followed by a C++ direct initializer, e.g. "int x(1);".
2178  if (hasGroupingParens()) return false;
2179 
2180  if (getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_typedef)
2181  return false;
2182 
2183  if (getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_extern &&
2184  Context != DeclaratorContext::File)
2185  return false;
2186 
2187  // Special names can't have direct initializers.
2188  if (Name.getKind() != UnqualifiedIdKind::IK_Identifier)
2189  return false;
2190 
2191  switch (Context) {
2197  return true;
2198 
2200  // This may not be followed by a direct initializer, but it can't be a
2201  // function declaration either, and we'd prefer to perform a tentative
2202  // parse in order to produce the right diagnostic.
2203  return true;
2204 
2215  case DeclaratorContext::FunctionalCast: // FIXME
2227  return false;
2228  }
2229  llvm_unreachable("unknown context kind!");
2230  }
2231 
2232  /// isPastIdentifier - Return true if we have parsed beyond the point where
2233  /// the name would appear. (This may happen even if we haven't actually parsed
2234  /// a name, perhaps because this context doesn't require one.)
2235  bool isPastIdentifier() const { return Name.isValid(); }
2236 
2237  /// hasName - Whether this declarator has a name, which might be an
2238  /// identifier (accessible via getIdentifier()) or some kind of
2239  /// special C++ name (constructor, destructor, etc.), or a structured
2240  /// binding (which is not exactly a name, but occupies the same position).
2241  bool hasName() const {
2242  return Name.getKind() != UnqualifiedIdKind::IK_Identifier ||
2243  Name.Identifier || isDecompositionDeclarator();
2244  }
2245 
2246  /// Return whether this declarator is a decomposition declarator.
2248  return BindingGroup.isSet();
2249  }
2250 
2252  if (Name.getKind() == UnqualifiedIdKind::IK_Identifier)
2253  return Name.Identifier;
2254 
2255  return nullptr;
2256  }
2257  SourceLocation getIdentifierLoc() const { return Name.StartLocation; }
2258 
2259  /// Set the name of this declarator to be the given identifier.
2261  Name.setIdentifier(Id, IdLoc);
2262  }
2263 
2264  /// Set the decomposition bindings for this declarator.
2265  void
2268  SourceLocation RSquareLoc);
2269 
2270  /// AddTypeInfo - Add a chunk to this declarator. Also extend the range to
2271  /// EndLoc, which should be the last token of the chunk.
2272  /// This function takes attrs by R-Value reference because it takes ownership
2273  /// of those attributes from the parameter.
2275  SourceLocation EndLoc) {
2276  DeclTypeInfo.push_back(TI);
2277  DeclTypeInfo.back().getAttrs().addAll(attrs.begin(), attrs.end());
2278  getAttributePool().takeAllFrom(attrs.getPool());
2279 
2280  if (!EndLoc.isInvalid())
2281  SetRangeEnd(EndLoc);
2282  }
2283 
2284  /// AddTypeInfo - Add a chunk to this declarator. Also extend the range to
2285  /// EndLoc, which should be the last token of the chunk.
2286  void AddTypeInfo(const DeclaratorChunk &TI, SourceLocation EndLoc) {
2287  DeclTypeInfo.push_back(TI);
2288 
2289  if (!EndLoc.isInvalid())
2290  SetRangeEnd(EndLoc);
2291  }
2292 
2293  /// Add a new innermost chunk to this declarator.
2295  DeclTypeInfo.insert(DeclTypeInfo.begin(), TI);
2296  }
2297 
2298  /// Return the number of types applied to this declarator.
2299  unsigned getNumTypeObjects() const { return DeclTypeInfo.size(); }
2300 
2301  /// Return the specified TypeInfo from this declarator. TypeInfo #0 is
2302  /// closest to the identifier.
2303  const DeclaratorChunk &getTypeObject(unsigned i) const {
2304  assert(i < DeclTypeInfo.size() && "Invalid type chunk");
2305  return DeclTypeInfo[i];
2306  }
2308  assert(i < DeclTypeInfo.size() && "Invalid type chunk");
2309  return DeclTypeInfo[i];
2310  }
2311 
2313  typedef llvm::iterator_range<type_object_iterator> type_object_range;
2314 
2315  /// Returns the range of type objects, from the identifier outwards.
2317  return type_object_range(DeclTypeInfo.begin(), DeclTypeInfo.end());
2318  }
2319 
2321  assert(!DeclTypeInfo.empty() && "No type chunks to drop.");
2322  DeclTypeInfo.front().destroy();
2323  DeclTypeInfo.erase(DeclTypeInfo.begin());
2324  }
2325 
2326  /// Return the innermost (closest to the declarator) chunk of this
2327  /// declarator that is not a parens chunk, or null if there are no
2328  /// non-parens chunks.
2330  for (unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
2331  if (!DeclTypeInfo[i].isParen())
2332  return &DeclTypeInfo[i];
2333  }
2334  return nullptr;
2335  }
2336 
2337  /// Return the outermost (furthest from the declarator) chunk of
2338  /// this declarator that is not a parens chunk, or null if there are
2339  /// no non-parens chunks.
2341  for (unsigned i = DeclTypeInfo.size(), i_end = 0; i != i_end; --i) {
2342  if (!DeclTypeInfo[i-1].isParen())
2343  return &DeclTypeInfo[i-1];
2344  }
2345  return nullptr;
2346  }
2347 
2348  /// isArrayOfUnknownBound - This method returns true if the declarator
2349  /// is a declarator for an array of unknown bound (looking through
2350  /// parentheses).
2351  bool isArrayOfUnknownBound() const {
2352  const DeclaratorChunk *chunk = getInnermostNonParenChunk();
2353  return (chunk && chunk->Kind == DeclaratorChunk::Array &&
2354  !chunk->Arr.NumElts);
2355  }
2356 
2357  /// isFunctionDeclarator - This method returns true if the declarator
2358  /// is a function declarator (looking through parentheses).
2359  /// If true is returned, then the reference type parameter idx is
2360  /// assigned with the index of the declaration chunk.
2361  bool isFunctionDeclarator(unsigned& idx) const {
2362  for (unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
2363  switch (DeclTypeInfo[i].Kind) {
2365  idx = i;
2366  return true;
2368  continue;
2374  case DeclaratorChunk::Pipe:
2375  return false;
2376  }
2377  llvm_unreachable("Invalid type chunk");
2378  }
2379  return false;
2380  }
2381 
2382  /// isFunctionDeclarator - Once this declarator is fully parsed and formed,
2383  /// this method returns true if the identifier is a function declarator
2384  /// (looking through parentheses).
2385  bool isFunctionDeclarator() const {
2386  unsigned index;
2387  return isFunctionDeclarator(index);
2388  }
2389 
2390  /// getFunctionTypeInfo - Retrieves the function type info object
2391  /// (looking through parentheses).
2393  assert(isFunctionDeclarator() && "Not a function declarator!");
2394  unsigned index = 0;
2395  isFunctionDeclarator(index);
2396  return DeclTypeInfo[index].Fun;
2397  }
2398 
2399  /// getFunctionTypeInfo - Retrieves the function type info object
2400  /// (looking through parentheses).
2402  return const_cast<Declarator*>(this)->getFunctionTypeInfo();
2403  }
2404 
2405  /// Determine whether the declaration that will be produced from
2406  /// this declaration will be a function.
2407  ///
2408  /// A declaration can declare a function even if the declarator itself
2409  /// isn't a function declarator, if the type specifier refers to a function
2410  /// type. This routine checks for both cases.
2411  bool isDeclarationOfFunction() const;
2412 
2413  /// Return true if this declaration appears in a context where a
2414  /// function declarator would be a function declaration.
2416  if (getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_typedef)
2417  return false;
2418 
2419  switch (Context) {
2425  return true;
2426 
2450  return false;
2451  }
2452  llvm_unreachable("unknown context kind!");
2453  }
2454 
2455  /// Determine whether this declaration appears in a context where an
2456  /// expression could appear.
2457  bool isExpressionContext() const {
2458  switch (Context) {
2462 
2463  // FIXME: sizeof(...) permits an expression.
2465 
2485  return false;
2486 
2492  return true;
2493  }
2494 
2495  llvm_unreachable("unknown context kind!");
2496  }
2497 
2498  /// Return true if a function declarator at this position would be a
2499  /// function declaration.
2502  return false;
2503 
2504  for (unsigned I = 0, N = getNumTypeObjects(); I != N; ++I)
2506  return false;
2507 
2508  return true;
2509  }
2510 
2511  /// Determine whether a trailing return type was written (at any
2512  /// level) within this declarator.
2513  bool hasTrailingReturnType() const {
2514  for (const auto &Chunk : type_objects())
2515  if (Chunk.Kind == DeclaratorChunk::Function &&
2516  Chunk.Fun.hasTrailingReturnType())
2517  return true;
2518  return false;
2519  }
2520  /// Get the trailing return type appearing (at any level) within this
2521  /// declarator.
2523  for (const auto &Chunk : type_objects())
2524  if (Chunk.Kind == DeclaratorChunk::Function &&
2525  Chunk.Fun.hasTrailingReturnType())
2526  return Chunk.Fun.getTrailingReturnType();
2527  return ParsedType();
2528  }
2529 
2530  /// \brief Sets a trailing requires clause for this declarator.
2532  TrailingRequiresClause = TRC;
2533 
2534  SetRangeEnd(TRC->getEndLoc());
2535  }
2536 
2537  /// \brief Sets a trailing requires clause for this declarator.
2539  return TrailingRequiresClause;
2540  }
2541 
2542  /// \brief Determine whether a trailing requires clause was written in this
2543  /// declarator.
2545  return TrailingRequiresClause != nullptr;
2546  }
2547 
2548  /// Sets the template parameter lists that preceded the declarator.
2550  TemplateParameterLists = TPLs;
2551  }
2552 
2553  /// The template parameter lists that preceded the declarator.
2555  return TemplateParameterLists;
2556  }
2557 
2558  /// Sets the template parameter list generated from the explicit template
2559  /// parameters along with any invented template parameters from
2560  /// placeholder-typed parameters.
2562  InventedTemplateParameterList = Invented;
2563  }
2564 
2565  /// The template parameter list generated from the explicit template
2566  /// parameters along with any invented template parameters from
2567  /// placeholder-typed parameters, if there were any such parameters.
2569  return InventedTemplateParameterList;
2570  }
2571 
2572  /// takeAttributes - Takes attributes from the given parsed-attributes
2573  /// set and add them to this declarator.
2574  ///
2575  /// These examples both add 3 attributes to "var":
2576  /// short int var __attribute__((aligned(16),common,deprecated));
2577  /// short int x, __attribute__((aligned(16)) var
2578  /// __attribute__((common,deprecated));
2579  ///
2580  /// Also extends the range of the declarator.
2582  Attrs.takeAllFrom(attrs);
2583 
2584  if (attrs.Range.getEnd().isValid())
2585  SetRangeEnd(attrs.Range.getEnd());
2586  }
2587 
2588  const ParsedAttributes &getAttributes() const { return Attrs; }
2589  ParsedAttributes &getAttributes() { return Attrs; }
2590 
2592  return DeclarationAttrs;
2593  }
2594 
2595  /// hasAttributes - do we contain any attributes?
2596  bool hasAttributes() const {
2597  if (!getAttributes().empty() || !getDeclarationAttributes().empty() ||
2599  return true;
2600  for (unsigned i = 0, e = getNumTypeObjects(); i != e; ++i)
2601  if (!getTypeObject(i).getAttrs().empty())
2602  return true;
2603  return false;
2604  }
2605 
2606  /// Return a source range list of C++11 attributes associated
2607  /// with the declarator.
2609  for (const ParsedAttr &AL : Attrs)
2610  if (AL.isCXX11Attribute())
2611  Ranges.push_back(AL.getRange());
2612  }
2613 
2614  void setAsmLabel(Expr *E) { AsmLabel = E; }
2615  Expr *getAsmLabel() const { return AsmLabel; }
2616 
2617  void setExtension(bool Val = true) { Extension = Val; }
2618  bool getExtension() const { return Extension; }
2619 
2620  void setObjCIvar(bool Val = true) { ObjCIvar = Val; }
2621  bool isObjCIvar() const { return ObjCIvar; }
2622 
2623  void setObjCWeakProperty(bool Val = true) { ObjCWeakProperty = Val; }
2624  bool isObjCWeakProperty() const { return ObjCWeakProperty; }
2625 
2626  void setInvalidType(bool Val = true) { InvalidType = Val; }
2627  bool isInvalidType() const {
2628  return InvalidType || DS.getTypeSpecType() == DeclSpec::TST_error;
2629  }
2630 
2631  void setGroupingParens(bool flag) { GroupingParens = flag; }
2632  bool hasGroupingParens() const { return GroupingParens; }
2633 
2634  bool isFirstDeclarator() const { return !CommaLoc.isValid(); }
2635  SourceLocation getCommaLoc() const { return CommaLoc; }
2636  void setCommaLoc(SourceLocation CL) { CommaLoc = CL; }
2637 
2638  bool hasEllipsis() const { return EllipsisLoc.isValid(); }
2639  SourceLocation getEllipsisLoc() const { return EllipsisLoc; }
2640  void setEllipsisLoc(SourceLocation EL) { EllipsisLoc = EL; }
2641 
2643  FunctionDefinition = static_cast<unsigned>(Val);
2644  }
2645 
2646  bool isFunctionDefinition() const {
2648  }
2649 
2651  return (FunctionDefinitionKind)FunctionDefinition;
2652  }
2653 
2654  void setHasInitializer(bool Val = true) { HasInitializer = Val; }
2655  bool hasInitializer() const { return HasInitializer; }
2656 
2657  /// Returns true if this declares a real member and not a friend.
2659  return getContext() == DeclaratorContext::Member &&
2661  }
2662 
2663  /// Returns true if this declares a static member. This cannot be called on a
2664  /// declarator outside of a MemberContext because we won't know until
2665  /// redeclaration time if the decl is static.
2666  bool isStaticMember();
2667 
2668  /// Returns true if this declares a constructor or a destructor.
2669  bool isCtorOrDtor();
2670 
2671  void setRedeclaration(bool Val) { Redeclaration = Val; }
2672  bool isRedeclaration() const { return Redeclaration; }
2673 };
2674 
2675 /// This little struct is used to capture information about
2676 /// structure field declarators, which is basically just a bitfield size.
2680  explicit FieldDeclarator(const DeclSpec &DS,
2681  const ParsedAttributes &DeclarationAttrs)
2682  : D(DS, DeclarationAttrs, DeclaratorContext::Member),
2683  BitfieldSize(nullptr) {}
2684 };
2685 
2686 /// Represents a C++11 virt-specifier-seq.
2688 public:
2689  enum Specifier {
2690  VS_None = 0,
2694  // Represents the __final keyword, which is legal for gcc in pre-C++11 mode.
2697  };
2698 
2699  VirtSpecifiers() : Specifiers(0), LastSpecifier(VS_None) { }
2700 
2701  bool SetSpecifier(Specifier VS, SourceLocation Loc,
2702  const char *&PrevSpec);
2703 
2704  bool isUnset() const { return Specifiers == 0; }
2705 
2706  bool isOverrideSpecified() const { return Specifiers & VS_Override; }
2707  SourceLocation getOverrideLoc() const { return VS_overrideLoc; }
2708 
2709  bool isFinalSpecified() const { return Specifiers & (VS_Final | VS_Sealed | VS_GNU_Final); }
2710  bool isFinalSpelledSealed() const { return Specifiers & VS_Sealed; }
2711  SourceLocation getFinalLoc() const { return VS_finalLoc; }
2712  SourceLocation getAbstractLoc() const { return VS_abstractLoc; }
2713 
2714  void clear() { Specifiers = 0; }
2715 
2716  static const char *getSpecifierName(Specifier VS);
2717 
2718  SourceLocation getFirstLocation() const { return FirstLocation; }
2719  SourceLocation getLastLocation() const { return LastLocation; }
2720  Specifier getLastSpecifier() const { return LastSpecifier; }
2721 
2722 private:
2723  unsigned Specifiers;
2724  Specifier LastSpecifier;
2725 
2726  SourceLocation VS_overrideLoc, VS_finalLoc, VS_abstractLoc;
2727  SourceLocation FirstLocation;
2728  SourceLocation LastLocation;
2729 };
2730 
2732  NoInit, //!< [a]
2733  CopyInit, //!< [a = b], [a = {b}]
2734  DirectInit, //!< [a(b)]
2735  ListInit //!< [a{b}]
2736 };
2737 
2738 /// Represents a complete lambda introducer.
2740  /// An individual capture in a lambda introducer.
2741  struct LambdaCapture {
2750 
2759  };
2760 
2765 
2767  : Default(LCD_None) {}
2768 
2769  bool hasLambdaCapture() const {
2770  return Captures.size() > 0 || Default != LCD_None;
2771  }
2772 
2773  /// Append a capture in a lambda introducer.
2775  SourceLocation Loc,
2776  IdentifierInfo* Id,
2777  SourceLocation EllipsisLoc,
2778  LambdaCaptureInitKind InitKind,
2779  ExprResult Init,
2780  ParsedType InitCaptureType,
2781  SourceRange ExplicitRange) {
2782  Captures.push_back(LambdaCapture(Kind, Loc, Id, EllipsisLoc, InitKind, Init,
2783  InitCaptureType, ExplicitRange));
2784  }
2785 };
2786 
2788  /// The number of parameters in the template parameter list that were
2789  /// explicitly specified by the user, as opposed to being invented by use
2790  /// of an auto parameter.
2792 
2793  /// If this is a generic lambda or abbreviated function template, use this
2794  /// as the depth of each 'auto' parameter, during initial AST construction.
2796 
2797  /// Store the list of the template parameters for a generic lambda or an
2798  /// abbreviated function template.
2799  /// If this is a generic lambda or abbreviated function template, this holds
2800  /// the explicit template parameters followed by the auto parameters
2801  /// converted into TemplateTypeParmDecls.
2802  /// It can be used to construct the generic lambda or abbreviated template's
2803  /// template parameter list during initial AST construction.
2805 };
2806 
2807 } // end namespace clang
2808 
2809 #endif // LLVM_CLANG_SEMA_DECLSPEC_H
clang::FunctionDefinitionKind::Defaulted
@ Defaulted
clang::UnqualifiedId::UnqualifiedId
UnqualifiedId()
Definition: DeclSpec.h:1036
clang::ExplicitSpecifier
Store information needed for an explicit specifier.
Definition: DeclCXX.h:1830
clang::DeclaratorChunk::PointerTypeInfo
Definition: DeclSpec.h:1216
clang::DeclSpec::getVirtualSpecLoc
SourceLocation getVirtualSpecLoc() const
Definition: DeclSpec.h:599
clang::TST_half
@ TST_half
Definition: Specifiers.h:63
clang::Declarator::isDeclarationOfFunction
bool isDeclarationOfFunction() const
Determine whether the declaration that will be produced from this declaration will be a function.
Definition: DeclSpec.cpp:325
clang::VirtSpecifiers::isOverrideSpecified
bool isOverrideSpecified() const
Definition: DeclSpec.h:2706
clang::DeclSpec::isConstrainedAuto
bool isConstrainedAuto() const
Definition: DeclSpec.h:503
clang::DeclaratorChunk::FunctionTypeInfo::NumParams
unsigned NumParams
NumParams - This is the number of formal parameters specified by the declarator.
Definition: DeclSpec.h:1338
clang::DeclaratorChunk::ParamInfo::ParamInfo
ParamInfo()=default
clang::DeclaratorChunk::Pointer
@ Pointer
Definition: DeclSpec.h:1200
clang::UnqualifiedId
Represents a C++ unqualified-id that has been parsed.
Definition: DeclSpec.h:973
clang::CXXScopeSpec::setEndLoc
void setEndLoc(SourceLocation Loc)
Definition: DeclSpec.h:73
clang::LambdaIntroducer::LambdaCapture::Loc
SourceLocation Loc
Definition: DeclSpec.h:2743
clang::UnqualifiedId::setIdentifier
void setIdentifier(const IdentifierInfo *Id, SourceLocation IdLoc)
Specify that this unqualified-id was parsed as an identifier.
Definition: DeclSpec.h:1061
clang::UnqualifiedId::TemplateName
UnionParsedTemplateTy TemplateName
When Kind == IK_DeductionGuideName, the parsed template-name.
Definition: DeclSpec.h:1020
clang::DecompositionDeclarator::Binding::NameLoc
SourceLocation NameLoc
Definition: DeclSpec.h:1729
clang::DeclSpec::SetTypeQual
bool SetTypeQual(TQ T, SourceLocation Loc)
Definition: DeclSpec.cpp:980
clang::DeclaratorChunk::EndLoc
SourceLocation EndLoc
EndLoc - If valid, the place where this chunck ends.
Definition: DeclSpec.h:1206
clang::DeclaratorChunk::FunctionTypeInfo::hasPrototype
unsigned hasPrototype
hasPrototype - This is true if the function had at least one typed parameter.
Definition: DeclSpec.h:1303
clang::Declarator::getName
UnqualifiedId & getName()
Retrieve the name specified by this declarator.
Definition: DeclSpec.h:1988
clang::DeclaratorChunk::getReference
static DeclaratorChunk getReference(unsigned TypeQuals, SourceLocation Loc, bool lvalue)
Return a DeclaratorChunk for a reference.
Definition: DeclSpec.h:1620
clang::ObjCDeclSpec
Captures information about "declaration specifiers" specific to Objective-C.
Definition: DeclSpec.h:845
clang::InventedTemplateParameterInfo
Definition: DeclSpec.h:2787
clang::DeclaratorChunk::FunctionTypeInfo::RefQualifierLoc
SourceLocation RefQualifierLoc
The location of the ref-qualifier, if any.
Definition: DeclSpec.h:1348
clang::TST_Float16
@ TST_Float16
Definition: Specifiers.h:64
clang::UnqualifiedId::DestructorName
UnionParsedType DestructorName
When Kind == IK_DestructorName, the type referred to by the class-name.
Definition: DeclSpec.h:1017
clang::LambdaIntroducer::LambdaCapture::Init
ExprResult Init
Definition: DeclSpec.h:2747
clang::TST_char8
@ TST_char8
Definition: Specifiers.h:57
clang::DeclaratorContext::TrailingReturnVar
@ TrailingReturnVar
clang::Declarator::type_objects
type_object_range type_objects() const
Returns the range of type objects, from the identifier outwards.
Definition: DeclSpec.h:2316
clang::TST_bool
@ TST_bool
Definition: Specifiers.h:72
clang::VirtSpecifiers::VS_GNU_Final
@ VS_GNU_Final
Definition: DeclSpec.h:2695
clang::DeclSpec::TSC_unspecified
@ TSC_unspecified
Definition: DeclSpec.h:254
clang::Declarator::setGroupingParens
void setGroupingParens(bool flag)
Definition: DeclSpec.h:2631
clang::DeclaratorChunk::FunctionTypeInfo::getMutableLoc
SourceLocation getMutableLoc() const
Retrieve the location of the 'mutable' qualifier, if any.
Definition: DeclSpec.h:1485
clang::DeclSpec::getRestrictSpecLoc
SourceLocation getRestrictSpecLoc() const
Definition: DeclSpec.h:569
Specifiers.h
clang::DeclaratorChunk::FunctionTypeInfo::hasTrailingReturnType
bool hasTrailingReturnType() const
Determine whether this function declarator had a trailing-return-type.
Definition: DeclSpec.h:1521
clang::DeclSpec::TST_typeof_unqualExpr
static const TST TST_typeof_unqualExpr
Definition: DeclSpec.h:293
clang::UnqualifiedId::TemplateId
TemplateIdAnnotation * TemplateId
When Kind == IK_TemplateId or IK_ConstructorTemplateId, the template-id annotation that contains the ...
Definition: DeclSpec.h:1025
clang::DeclSpec::ClearTypeSpecType
void ClearTypeSpecType()
Definition: DeclSpec.h:481
clang::Declarator::getCXXScopeSpec
CXXScopeSpec & getCXXScopeSpec()
Definition: DeclSpec.h:1985
clang::DeclSpec::SetTypeSpecComplex
bool SetTypeSpecComplex(TSC C, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:719
clang::Declarator::getTypeObject
DeclaratorChunk & getTypeObject(unsigned i)
Definition: DeclSpec.h:2307
clang::TemplateIdAnnotation
Information about a template-id annotation token.
Definition: ParsedTemplate.h:149
clang::UnqualifiedIdKind::IK_OperatorFunctionId
@ IK_OperatorFunctionId
An overloaded operator name, e.g., operator+.
clang::VirtSpecifiers::getOverrideLoc
SourceLocation getOverrideLoc() const
Definition: DeclSpec.h:2707
clang::DeclSpec::TQ_unspecified
@ TQ_unspecified
Definition: DeclSpec.h:310
clang::LambdaIntroducer
Represents a complete lambda introducer.
Definition: DeclSpec.h:2739
clang::DeclSpec::TST_unknown_anytype
static const TST TST_unknown_anytype
Definition: DeclSpec.h:301
clang::DeclaratorChunk::getBlockPointer
static DeclaratorChunk getBlockPointer(unsigned TypeQuals, SourceLocation Loc)
Return a DeclaratorChunk for a block.
Definition: DeclSpec.h:1674
clang::CXXScopeSpec::Adopt
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Definition: DeclSpec.cpp:132
clang::CXXScopeSpec::setBeginLoc
void setBeginLoc(SourceLocation Loc)
Definition: DeclSpec.h:72
clang::DeclaratorChunk::FunctionTypeInfo::getVolatileQualifierLoc
SourceLocation getVolatileQualifierLoc() const
Retrieve the location of the 'volatile' qualifier.
Definition: DeclSpec.h:1473
clang::VirtSpecifiers::VirtSpecifiers
VirtSpecifiers()
Definition: DeclSpec.h:2699
clang::DeclaratorChunk::FunctionTypeInfo::ExceptionSpecType
unsigned ExceptionSpecType
ExceptionSpecType - An ExceptionSpecificationType value.
Definition: DeclSpec.h:1318
clang::DeclaratorChunk::MemberPointerTypeInfo::TypeQuals
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/__unaligned/_Atomic.
Definition: DeclSpec.h:1547
clang::DeclaratorContext::File
@ File
clang::Declarator::setAsmLabel
void setAsmLabel(Expr *E)
Definition: DeclSpec.h:2614
clang::DeclaratorChunk::PointerTypeInfo::TypeQuals
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/unaligned/atomic.
Definition: DeclSpec.h:1218
clang::VirtSpecifiers::VS_None
@ VS_None
Definition: DeclSpec.h:2690
clang::DeclSpec::TST_enum
static const TST TST_enum
Definition: DeclSpec.h:284
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:210
clang::ObjCDeclSpec::getSetterNameLoc
SourceLocation getSetterNameLoc() const
Definition: DeclSpec.h:922
clang::VirtSpecifiers::getFinalLoc
SourceLocation getFinalLoc() const
Definition: DeclSpec.h:2711
clang::Declarator::getCXX11AttributeRanges
void getCXX11AttributeRanges(SmallVectorImpl< SourceRange > &Ranges)
Return a source range list of C++11 attributes associated with the declarator.
Definition: DeclSpec.h:2608
clang::Declarator::InlineParams
DeclaratorChunk::ParamInfo InlineParams[16]
InlineParams - This is a local array used for the first function decl chunk to avoid going to the hea...
Definition: DeclSpec.h:1912
clang::UnqualifiedId::OperatorFunctionId
struct OFI OperatorFunctionId
When Kind == IK_OperatorFunctionId, the overloaded operator that we parsed.
Definition: DeclSpec.h:1005
clang::TST_interface
@ TST_interface
Definition: Specifiers.h:80
clang::DeclSpec::getTypeSpecWidthRange
SourceRange getTypeSpecWidthRange() const
Definition: DeclSpec.h:530
clang::NamespaceAliasDecl
Represents a C++ namespace alias.
Definition: DeclCXX.h:3021
clang::DeclaratorChunk::Mem
MemberPointerTypeInfo Mem
Definition: DeclSpec.h:1577
clang::TypeSpecifierSign
TypeSpecifierSign
Specifies the signedness of a type, e.g., signed or unsigned.
Definition: Specifiers.h:47
clang::DeclSpec::getExplicitSpecLoc
SourceLocation getExplicitSpecLoc() const
Definition: DeclSpec.h:604
clang::Declarator::getNumTypeObjects
unsigned getNumTypeObjects() const
Return the number of types applied to this declarator.
Definition: DeclSpec.h:2299
clang::TST_unspecified
@ TST_unspecified
Definition: Specifiers.h:53
clang::DeclSpec::getExplicitSpecRange
SourceRange getExplicitSpecRange() const
Definition: DeclSpec.h:605
clang::DeclSpec::PQ_None
@ PQ_None
Definition: DeclSpec.h:323
clang::DeclaratorChunk::FunctionTypeInfo::hasMethodTypeQualifiers
bool hasMethodTypeQualifiers() const
Determine whether this method has qualifiers.
Definition: DeclSpec.h:1496
clang::DeclaratorChunk::PipeTypeInfo::destroy
void destroy()
Definition: DeclSpec.h:1568
clang::DeclSpec::isInlineSpecified
bool isInlineSpecified() const
Definition: DeclSpec.h:587
clang::TST_typename
@ TST_typename
Definition: Specifiers.h:81
clang::DeclSpec::getAttributes
ParsedAttributes & getAttributes()
Definition: DeclSpec.h:818
clang::DeclaratorChunk::FunctionTypeInfo::hasMutableQualifier
bool hasMutableQualifier() const
Determine whether this lambda-declarator contains a 'mutable' qualifier.
Definition: DeclSpec.h:1493
clang::DeclSpec::SetTypeSpecError
bool SetTypeSpecError()
Definition: DeclSpec.cpp:935
clang::UnqualifiedId::setTemplateId
void setTemplateId(TemplateIdAnnotation *TemplateId)
Specify that this unqualified-id was parsed as a template-id.
Definition: DeclSpec.cpp:32
clang::DeclSpec::SCS_static
@ SCS_static
Definition: DeclSpec.h:238
llvm::SmallVector< Token, 4 >
clang::Declarator::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
Get the source range that spans this declarator.
Definition: DeclSpec.h:2004
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::DeclaratorContext::LambdaExprParameter
@ LambdaExprParameter
clang::ImplicitTypenameContext
ImplicitTypenameContext
Definition: DeclSpec.h:1817
clang::LambdaIntroducer::LambdaCapture::Id
IdentifierInfo * Id
Definition: DeclSpec.h:2744
clang::DeclaratorChunk::ArrayTypeInfo::destroy
void destroy()
Definition: DeclSpec.h:1264
clang::DeclSpec::TST_error
static const TST TST_error
Definition: DeclSpec.h:306
clang::DeclaratorChunk::FunctionTypeInfo::getRParenLoc
SourceLocation getRParenLoc() const
Definition: DeclSpec.h:1449
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:247
clang::DeclSpec::setFunctionSpecInline
bool setFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:995
clang::SourceRange::getBegin
SourceLocation getBegin() const
Definition: SourceLocation.h:219
clang::DeclSpec::SetTypeSpecType
bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, TypeResult Rep, const PrintingPolicy &Policy)
Definition: DeclSpec.h:688
clang::DeclSpec::setTypeArgumentRange
void setTypeArgumentRange(SourceRange range)
Definition: DeclSpec.h:544
clang::AttributePool
Definition: ParsedAttr.h:792
clang::TST_void
@ TST_void
Definition: Specifiers.h:54
clang::UnqualifiedIdKind::IK_DeductionGuideName
@ IK_DeductionGuideName
A deduction-guide name (a template-name)
clang::DeclSpec::TSC_complex
@ TSC_complex
Definition: DeclSpec.h:256
clang::Declarator::ExtendWithDeclSpec
void ExtendWithDeclSpec(const DeclSpec &DS)
ExtendWithDeclSpec - Extend the declarator source range to include the given declspec,...
Definition: DeclSpec.h:2023
clang::LambdaIntroducer::Captures
SmallVector< LambdaCapture, 4 > Captures
Definition: DeclSpec.h:2764
clang::DeclSpec::setObjCQualifiers
void setObjCQualifiers(ObjCDeclSpec *quals)
Definition: DeclSpec.h:835
clang::DeclSpec::getRepAsExpr
Expr * getRepAsExpr() const
Definition: DeclSpec.h:513
clang::DeclaratorChunk::ReferenceTypeInfo
Definition: DeclSpec.h:1239
clang::DeclaratorChunk::PointerTypeInfo::ConstQualLoc
SourceLocation ConstQualLoc
The location of the const-qualifier, if any.
Definition: DeclSpec.h:1221
clang::DeclSpec::setFunctionSpecExplicit
bool setFunctionSpecExplicit(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, ExplicitSpecifier ExplicitSpec, SourceLocation CloseParenLoc)
Definition: DeclSpec.cpp:1036
clang::TypeSpecifierWidth::Unspecified
@ Unspecified
clang::DeclaratorChunk::FunctionTypeInfo::TrailingReturnType
UnionParsedType TrailingReturnType
If HasTrailingReturnType is true, this is the trailing return type specified.
Definition: DeclSpec.h:1393
clang::UnqualifiedId::OFI::Operator
OverloadedOperatorKind Operator
The kind of overloaded operator.
Definition: DeclSpec.h:984
clang::UnqualifiedId::Identifier
IdentifierInfo * Identifier
When Kind == IK_Identifier, the parsed identifier, or when Kind == IK_UserLiteralId,...
Definition: DeclSpec.h:1001
clang::DeclSpec::SCS_auto
@ SCS_auto
Definition: DeclSpec.h:239
clang::DeclSpec::SetBitIntType
bool SetBitIntType(SourceLocation KWLoc, Expr *BitWidth, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
Definition: DeclSpec.cpp:943
clang::DeclSpec::SetTypeAltiVecPixel
bool SetTypeAltiVecPixel(bool isAltiVecPixel, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
Definition: DeclSpec.cpp:901
clang::FunctionDefinitionKind::Deleted
@ Deleted
clang::CXXScopeSpec::location_size
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
Definition: DeclSpec.h:223
Ownership.h
clang::Declarator::getIdentifier
IdentifierInfo * getIdentifier() const
Definition: DeclSpec.h:2251
AttributeLangSupport::C
@ C
Definition: SemaDeclAttr.cpp:56
clang::EST_None
@ EST_None
no exception specification
Definition: ExceptionSpecificationType.h:21
clang::NestedNameSpecifier
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Definition: NestedNameSpecifier.h:50
clang::DecompositionDeclarator::bindings
ArrayRef< Binding > bindings() const
Definition: DeclSpec.h:1762
clang::ObjCDeclSpec::DQ_None
@ DQ_None
Definition: DeclSpec.h:854
clang::DeclSpec::setExternInLinkageSpec
void setExternInLinkageSpec(bool Value)
Definition: DeclSpec.h:464
clang::TST_struct
@ TST_struct
Definition: Specifiers.h:78
clang::DeclSpec::Yes
@ Yes
Definition: DeclSpec.h:333
clang::DeclSpec::DeclSpec
DeclSpec(AttributeFactory &attrFactory)
Definition: DeclSpec.h:441
clang::DeclaratorChunk::Fun
FunctionTypeInfo Fun
Definition: DeclSpec.h:1575
clang::EST_Dynamic
@ EST_Dynamic
throw(T1, T2)
Definition: ExceptionSpecificationType.h:23
clang::Declarator::getContext
DeclaratorContext getContext() const
Definition: DeclSpec.h:1994
DeclCXX.h
clang::DeclSpec::getObjCQualifiers
ObjCDeclSpec * getObjCQualifiers() const
Definition: DeclSpec.h:834
clang::DeclSpec::hasAutoTypeSpec
bool hasAutoTypeSpec() const
Definition: DeclSpec.h:546
clang::UnqualifiedIdKind::IK_Identifier
@ IK_Identifier
An identifier.
clang::Declarator::isArrayOfUnknownBound
bool isArrayOfUnknownBound() const
isArrayOfUnknownBound - This method returns true if the declarator is a declarator for an array of un...
Definition: DeclSpec.h:2351
clang::VirtSpecifiers::Specifier
Specifier
Definition: DeclSpec.h:2689
clang::ParsedAttributesView::size
SizeType size() const
Definition: ParsedAttr.h:933
clang::VirtSpecifiers::getSpecifierName
static const char * getSpecifierName(Specifier VS)
Definition: DeclSpec.cpp:1499
clang::SourceRange::isValid
bool isValid() const
Definition: SourceLocation.h:225
clang::UnqualifiedId::setConstructorName
void setConstructorName(ParsedType ClassType, SourceLocation ClassNameLoc, SourceLocation EndLoc)
Specify that this unqualified-id was parsed as a constructor name.
Definition: DeclSpec.h:1120
clang::DeclSpec::isFriendSpecified
FriendSpecified isFriendSpecified() const
Definition: DeclSpec.h:768
clang::DeclSpec::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
Definition: DeclSpec.h:525
clang::TST_enum
@ TST_enum
Definition: Specifiers.h:76
clang::TST_error
@ TST_error
Definition: Specifiers.h:96
clang::DeclSpec::SCS
SCS
storage-class-specifier
Definition: DeclSpec.h:234
clang::ObjCDeclSpec::getGetterName
IdentifierInfo * getGetterName()
Definition: DeclSpec.h:913
clang::DeclSpec::SCS_unspecified
@ SCS_unspecified
Definition: DeclSpec.h:235
clang::Declarator::getFunctionDefinitionKind
FunctionDefinitionKind getFunctionDefinitionKind() const
Definition: DeclSpec.h:2650
clang::DeclSpec::getParsedSpecifiers
unsigned getParsedSpecifiers() const
Return a bitmask of which flavors of specifiers this DeclSpec includes.
Definition: DeclSpec.cpp:455
clang::Declarator::getExtension
bool getExtension() const
Definition: DeclSpec.h:2618
clang::DeclSpec::hasExplicitSpecifier
bool hasExplicitSpecifier() const
Definition: DeclSpec.h:601
clang::DeclaratorContext::AliasTemplate
@ AliasTemplate
clang::DeclSpec::TQ_volatile
@ TQ_volatile
Definition: DeclSpec.h:313
clang::DeclaratorChunk::getMemberPointer
static DeclaratorChunk getMemberPointer(const CXXScopeSpec &SS, unsigned TypeQuals, SourceLocation StarLoc, SourceLocation EndLoc)
Definition: DeclSpec.h:1693
clang::TST_auto
@ TST_auto
Definition: Specifiers.h:89
clang::DecompositionDeclarator::operator=
DecompositionDeclarator & operator=(const DecompositionDeclarator &G)=delete
clang::DeclaratorChunk::MemberPointerTypeInfo::StarLoc
SourceLocation StarLoc
Location of the '*' token.
Definition: DeclSpec.h:1549
clang::DeclSpec::getTypeSpecComplex
TSC getTypeSpecComplex() const
Definition: DeclSpec.h:491
clang::FieldDeclarator::FieldDeclarator
FieldDeclarator(const DeclSpec &DS, const ParsedAttributes &DeclarationAttrs)
Definition: DeclSpec.h:2680
clang::Declarator::getAttributes
ParsedAttributes & getAttributes()
Definition: DeclSpec.h:2589
clang::EST_Unparsed
@ EST_Unparsed
not parsed yet
Definition: ExceptionSpecificationType.h:32
clang::DeclaratorChunk::FunctionTypeInfo::DeleteParams
unsigned DeleteParams
DeleteParams - If this is true, we need to delete[] Params.
Definition: DeclSpec.h:1321
clang::TSCS_thread_local
@ TSCS_thread_local
C++11 thread_local.
Definition: Specifiers.h:229
clang::DeclaratorChunk::FunctionTypeInfo::ExceptionSpecLocBeg
SourceLocation ExceptionSpecLocBeg
The beginning location of the exception specification, if any.
Definition: DeclSpec.h:1355
clang::CXXScopeSpec
Represents a C++ nested-name-specifier or a global scope specifier.
Definition: DeclSpec.h:65
clang::ParsedAttributesView::end
iterator end()
Definition: ParsedAttr.h:987
clang::DeclSpec::TQ_unaligned
@ TQ_unaligned
Definition: DeclSpec.h:314
clang::PrintingPolicy
Describes how types, statements, expressions, and declarations should be printed.
Definition: PrettyPrinter.h:57
clang::DeclSpec::TQ_atomic
@ TQ_atomic
Definition: DeclSpec.h:317
clang::LambdaIntroducer::LambdaCapture::LambdaCapture
LambdaCapture(LambdaCaptureKind Kind, SourceLocation Loc, IdentifierInfo *Id, SourceLocation EllipsisLoc, LambdaCaptureInitKind InitKind, ExprResult Init, ParsedType InitCaptureType, SourceRange ExplicitRange)
Definition: DeclSpec.h:2751
clang::DeclaratorChunk::FunctionTypeInfo::getEllipsisLoc
SourceLocation getEllipsisLoc() const
Definition: DeclSpec.h:1447
clang::DeclSpec::getConstSpecLoc
SourceLocation getConstSpecLoc() const
Definition: DeclSpec.h:568
clang::DeclaratorChunk::FunctionTypeInfo::getExceptionSpecType
ExceptionSpecificationType getExceptionSpecType() const
Get the type of exception specification this function has.
Definition: DeclSpec.h:1502
Identifier
StringRef Identifier
Definition: Format.cpp:2723
clang::DeclaratorChunk::FunctionTypeInfo::getTrailingReturnType
ParsedType getTrailingReturnType() const
Get the trailing-return-type for this function declarator.
Definition: DeclSpec.h:1524
clang::Declarator::getAttributePool
AttributePool & getAttributePool() const
Definition: DeclSpec.h:1978
clang::DeclaratorChunk::Arr
ArrayTypeInfo Arr
Definition: DeclSpec.h:1574
clang::DeclaratorChunk::FunctionTypeInfo::ExceptionSpecTokens
CachedTokens * ExceptionSpecTokens
Pointer to the cached tokens for an exception-specification that has not yet been parsed.
Definition: DeclSpec.h:1383
clang::DeclaratorChunk::Function
@ Function
Definition: DeclSpec.h:1200
clang::Declarator::isDecompositionDeclarator
bool isDecompositionDeclarator() const
Return whether this declarator is a decomposition declarator.
Definition: DeclSpec.h:2247
clang::DeclSpec::getTypeSpecComplexLoc
SourceLocation getTypeSpecComplexLoc() const
Definition: DeclSpec.h:531
clang::DeclaratorContext::ForInit
@ ForInit
clang::TST_auto_type
@ TST_auto_type
Definition: Specifiers.h:91
clang::DeclaratorChunk::MemberPointerTypeInfo::ScopeMem
char ScopeMem[sizeof(CXXScopeSpec)]
Definition: DeclSpec.h:1552
clang::UnqualifiedId::setConstructorTemplateId
void setConstructorTemplateId(TemplateIdAnnotation *TemplateId)
Specify that this unqualified-id was parsed as a template-id that names a constructor.
Definition: DeclSpec.cpp:43
clang::ImplicitTypenameContext::No
@ No
clang::DeclSpec::getSpecifierName
static const char * getSpecifierName(DeclSpec::TST T, const PrintingPolicy &Policy)
Turn a type-specifier-type into a string like "_Bool" or "union".
Definition: DeclSpec.cpp:545
Bindings
llvm::SmallVector< std::pair< const MemRegion *, SVal >, 4 > Bindings
Definition: RetainCountDiagnostics.cpp:613
clang::TST_unknown_anytype
@ TST_unknown_anytype
Definition: Specifiers.h:92
clang::ParsedAttributesView::begin
iterator begin()
Definition: ParsedAttr.h:985
clang::DeclSpec::TST
TypeSpecifierType TST
Definition: DeclSpec.h:260
clang::DeclaratorChunk::FunctionTypeInfo::QualAttrFactory
AttributeFactory * QualAttrFactory
AttributeFactory for the MethodQualifiers.
Definition: DeclSpec.h:1369
clang::DeclaratorChunk::FunctionTypeInfo::EllipsisLoc
SourceLocation EllipsisLoc
When isVariadic is true, the location of the ellipsis in the source.
Definition: DeclSpec.h:1331
clang::Declarator::getTrailingReturnType
ParsedType getTrailingReturnType() const
Get the trailing return type appearing (at any level) within this declarator.
Definition: DeclSpec.h:2522
clang::DeclSpec::SetFriendSpec
bool SetFriendSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:1070
clang::Declarator::getIdentifierLoc
SourceLocation getIdentifierLoc() const
Definition: DeclSpec.h:2257
clang::Declarator::getDeclarationAttributes
const ParsedAttributesView & getDeclarationAttributes() const
Definition: DeclSpec.h:2591
clang::LambdaCaptureInitKind::DirectInit
@ DirectInit
[a(b)]
clang::DeclaratorContext::TemplateArg
@ TemplateArg
clang::DeclSpec::getTypeSpecTypeLoc
SourceLocation getTypeSpecTypeLoc() const
Definition: DeclSpec.h:533
clang::Declarator::getFunctionTypeInfo
const DeclaratorChunk::FunctionTypeInfo & getFunctionTypeInfo() const
getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses).
Definition: DeclSpec.h:2401
clang::DeclaratorChunk::getFunction
static DeclaratorChunk getFunction(bool HasProto, bool IsAmbiguous, SourceLocation LParenLoc, ParamInfo *Params, unsigned NumParams, SourceLocation EllipsisLoc, SourceLocation RParenLoc, bool RefQualifierIsLvalueRef, SourceLocation RefQualifierLoc, SourceLocation MutableLoc, ExceptionSpecificationType ESpecType, SourceRange ESpecRange, ParsedType *Exceptions, SourceRange *ExceptionRanges, unsigned NumExceptions, Expr *NoexceptExpr, CachedTokens *ExceptionSpecTokens, ArrayRef< NamedDecl * > DeclsInPrototype, SourceLocation LocalRangeBegin, SourceLocation LocalRangeEnd, Declarator &TheDeclarator, TypeResult TrailingReturnType=TypeResult(), SourceLocation TrailingReturnTypeLoc=SourceLocation(), DeclSpec *MethodQualifiers=nullptr)
DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
Definition: DeclSpec.cpp:161
clang::DeclSpec::TSCS_unspecified
static const TSCS TSCS_unspecified
Definition: DeclSpec.h:248
clang::DeclSpec::getFriendSpecLoc
SourceLocation getFriendSpecLoc() const
Definition: DeclSpec.h:772
clang::CXXScopeSpec::MakeSuper
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
Definition: DeclSpec.cpp:114
clang::VirtSpecifiers::VS_Override
@ VS_Override
Definition: DeclSpec.h:2691
clang::ObjCDeclSpec::ObjCDeclQualifier
ObjCDeclQualifier
ObjCDeclQualifier - Qualifier used on types in method declarations.
Definition: DeclSpec.h:853
clang::Declarator::getTrailingRequiresClause
Expr * getTrailingRequiresClause()
Sets a trailing requires clause for this declarator.
Definition: DeclSpec.h:2538
clang::VirtSpecifiers::VS_Sealed
@ VS_Sealed
Definition: DeclSpec.h:2693
clang::DeclSpec::getExplicitSpecifier
ExplicitSpecifier getExplicitSpecifier() const
Definition: DeclSpec.h:594
clang::Declarator::isStaticMember
bool isStaticMember()
Returns true if this declares a static member.
Definition: DeclSpec.cpp:415
clang::DecompositionDeclarator::Binding
Definition: DeclSpec.h:1727
clang::ObjCDeclSpec::clearObjCDeclQualifier
void clearObjCDeclQualifier(ObjCDeclQualifier DQVal)
Definition: DeclSpec.h:875
clang::Declarator::getEllipsisLoc
SourceLocation getEllipsisLoc() const
Definition: DeclSpec.h:2639
clang::CXXScopeSpec::clear
void clear()
Definition: DeclSpec.h:213
clang::DeclSpec::TST_float
static const TST TST_float
Definition: DeclSpec.h:273
clang::UnqualifiedId::StartLocation
SourceLocation StartLocation
The location of the first token that describes this unqualified-id, which will be the location of the...
Definition: DeclSpec.h:1031
clang::UnqualifiedId::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: DeclSpec.h:1185
clang::CXXScopeSpec::isSet
bool isSet() const
Deprecated.
Definition: DeclSpec.h:211
clang::DecompositionDeclarator::~DecompositionDeclarator
~DecompositionDeclarator()
Definition: DeclSpec.h:1748
clang::Declarator::mayHaveIdentifier
bool mayHaveIdentifier() const
mayHaveIdentifier - Return true if the identifier is either optional or required.
Definition: DeclSpec.h:2094
clang::DeclSpec::No
@ No
Definition: DeclSpec.h:332
clang::Declarator::takeAttributes
void takeAttributes(ParsedAttributes &attrs)
takeAttributes - Takes attributes from the given parsed-attributes set and add them to this declarato...
Definition: DeclSpec.h:2581
clang::DeclaratorChunk::FunctionTypeInfo::destroy
void destroy()
Definition: DeclSpec.h:1412
clang::DeclSpec::TST_char8
static const TST TST_char8
Definition: DeclSpec.h:265
clang::DeclSpec::PQ_TypeSpecifier
@ PQ_TypeSpecifier
Definition: DeclSpec.h:325
clang::DeclSpec::SetRangeStart
void SetRangeStart(SourceLocation Loc)
Definition: DeclSpec.h:658
clang::DeclSpec::FriendSpecified
FriendSpecified
Definition: DeclSpec.h:331
clang::Declarator::isObjCWeakProperty
bool isObjCWeakProperty() const
Definition: DeclSpec.h:2624
clang::Declarator::getDeclSpec
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
Definition: DeclSpec.h:1969
clang::DeclSpec::getAttributes
const ParsedAttributes & getAttributes() const
Definition: DeclSpec.h:819
clang::Declarator::setInventedTemplateParameterList
void setInventedTemplateParameterList(TemplateParameterList *Invented)
Sets the template parameter list generated from the explicit template parameters along with any inven...
Definition: DeclSpec.h:2561
clang::DeclSpec::TST_accum
static const TST TST_accum
Definition: DeclSpec.h:276
clang::AttributePool::takeAllFrom
void takeAllFrom(AttributePool &pool)
Take the given pool's allocations and add them to this pool.
Definition: ParsedAttr.h:834
clang::DeclSpec::SetTypeSpecSign
bool SetTypeSpecSign(TypeSpecifierSign S, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:729
clang::Declarator::getOutermostNonParenChunk
const DeclaratorChunk * getOutermostNonParenChunk() const
Return the outermost (furthest from the declarator) chunk of this declarator that is not a parens chu...
Definition: DeclSpec.h:2340
clang::DeclaratorContext::TemplateParam
@ TemplateParam
clang::DeclSpec::setFunctionSpecForceInline
bool setFunctionSpecForceInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:1009
clang::DeclaratorContext::Association
@ Association
clang::Declarator::getCommaLoc
SourceLocation getCommaLoc() const
Definition: DeclSpec.h:2635
clang::AttributeFactory
A factory, from which one makes pools, from which one creates individual attributes which are dealloc...
Definition: ParsedAttr.h:738
clang::TST_typeof_unqualType
@ TST_typeof_unqualType
Definition: Specifiers.h:84
clang::VirtSpecifiers::isUnset
bool isUnset() const
Definition: DeclSpec.h:2704
clang::DeclSpec::isNoreturnSpecified
bool isNoreturnSpecified() const
Definition: DeclSpec.h:611
clang::VirtSpecifiers::isFinalSpecified
bool isFinalSpecified() const
Definition: DeclSpec.h:2709
clang::DeclaratorChunk::ReferenceTypeInfo::HasRestrict
bool HasRestrict
The type qualifier: restrict. [GNU] C++ extension.
Definition: DeclSpec.h:1241
clang::DeclSpec::isTypeSpecPipe
bool isTypeSpecPipe() const
Definition: DeclSpec.h:501
clang::DeclSpec::SetConstexprSpec
bool SetConstexprSpec(ConstexprSpecKind ConstexprKind, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:1100
clang::DeclaratorChunk::BlockPointer
@ BlockPointer
Definition: DeclSpec.h:1200
clang::DeclSpec::getTypeSpecSign
TypeSpecifierSign getTypeSpecSign() const
Definition: DeclSpec.h:492
clang::DeclaratorContext::CXXCatch
@ CXXCatch
clang::DeclSpec::getVolatileSpecLoc
SourceLocation getVolatileSpecLoc() const
Definition: DeclSpec.h:570
clang::DeclaratorChunk::Cls
BlockPointerTypeInfo Cls
Definition: DeclSpec.h:1576
clang::DeclaratorChunk::FunctionTypeInfo::Exceptions
TypeAndRange * Exceptions
Pointer to a new[]'d array of TypeAndRange objects that contain the types in the function's dynamic e...
Definition: DeclSpec.h:1375
clang::VirtSpecifiers::getLastSpecifier
Specifier getLastSpecifier() const
Definition: DeclSpec.h:2720
clang::Declarator::hasGroupingParens
bool hasGroupingParens() const
Definition: DeclSpec.h:2632
clang::DeclSpec::hasTypeSpecifier
bool hasTypeSpecifier() const
Return true if any type-specifier has been found.
Definition: DeclSpec.h:641
clang::Declarator::hasTrailingReturnType
bool hasTrailingReturnType() const
Determine whether a trailing return type was written (at any level) within this declarator.
Definition: DeclSpec.h:2513
clang::DecompositionDeclarator::getRSquareLoc
SourceLocation getRSquareLoc() const
Definition: DeclSpec.h:1769
clang::Declarator::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: DeclSpec.h:2005
clang::DeclSpec::isExternInLinkageSpec
bool isExternInLinkageSpec() const
Definition: DeclSpec.h:463
clang::ThreadStorageClassSpecifier
ThreadStorageClassSpecifier
Thread storage-class-specifier.
Definition: Specifiers.h:223
clang::DeclaratorChunk::TypeAndRange
Definition: DeclSpec.h:1294
clang::DeclaratorChunk::PointerTypeInfo::RestrictQualLoc
SourceLocation RestrictQualLoc
The location of the restrict-qualifier, if any.
Definition: DeclSpec.h:1227
clang::DeclaratorChunk::ReferenceTypeInfo::destroy
void destroy()
Definition: DeclSpec.h:1244
clang::DeclSpec::getTypeSpecType
TST getTypeSpecType() const
Definition: DeclSpec.h:495
clang::ExceptionSpecificationType
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
Definition: ExceptionSpecificationType.h:20
clang::AttributeCommonInfo::isStandardAttributeSyntax
bool isStandardAttributeSyntax() const
The attribute is spelled [[]] in either C or C++ mode, including standard attributes spelled with a k...
Definition: AttributeCommonInfo.h:179
clang::ObjCDeclSpec::DQ_In
@ DQ_In
Definition: DeclSpec.h:855
clang::VirtSpecifiers::getAbstractLoc
SourceLocation getAbstractLoc() const
Definition: DeclSpec.h:2712
Id
int Id
Definition: ASTDiff.cpp:189
ExceptionSpecificationType.h
clang::DeclSpec::UpdateTypeRep
void UpdateTypeRep(ParsedType Rep)
Definition: DeclSpec.h:735
clang::TST_decltype
@ TST_decltype
Definition: Specifiers.h:86
clang::DeclaratorChunk::MemberPointerTypeInfo::destroy
void destroy()
Definition: DeclSpec.h:1559
clang::DeclSpec::UpdateExprRep
void UpdateExprRep(Expr *Rep)
Definition: DeclSpec.h:739
clang::CXXScopeSpec::SetInvalid
void SetInvalid(SourceRange R)
Indicate that this nested-name-specifier is invalid.
Definition: DeclSpec.h:201
clang::Declarator::getAsmLabel
Expr * getAsmLabel() const
Definition: DeclSpec.h:2615
clang::CXXScopeSpec::Extend
void Extend(ASTContext &Context, SourceLocation TemplateKWLoc, TypeLoc TL, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'type...
Definition: DeclSpec.cpp:54
clang::Declarator::hasName
bool hasName() const
hasName - Whether this declarator has a name, which might be an identifier (accessible via getIdentif...
Definition: DeclSpec.h:2241
clang::ObjCDeclSpec::getNullability
NullabilityKind getNullability() const
Definition: DeclSpec.h:887
clang::CXXScopeSpec::isValid
bool isValid() const
A scope specifier is present, and it refers to a real scope.
Definition: DeclSpec.h:198
OperatorKinds.h
clang::DeclSpec::TST_interface
static const TST TST_interface
Definition: DeclSpec.h:287
clang::DeclSpec::TST_char
static const TST TST_char
Definition: DeclSpec.h:263
clang::ObjCDeclSpec::ObjCDeclSpec
ObjCDeclSpec()
Definition: DeclSpec.h:864
clang::SourceRange::getEnd
SourceLocation getEnd() const
Definition: SourceLocation.h:220
clang::Declarator::isFirstDeclarationOfMember
bool isFirstDeclarationOfMember()
Returns true if this declares a real member and not a friend.
Definition: DeclSpec.h:2658
clang::DeclSpec::TST_double
static const TST TST_double
Definition: DeclSpec.h:274
clang::DeclaratorChunk::FunctionTypeInfo::isKNRPrototype
bool isKNRPrototype() const
isKNRPrototype - Return true if this is a K&R style identifier list, like "void foo(a,...
Definition: DeclSpec.h:1443
clang::DeclSpec::PQ_TypeQualifier
@ PQ_TypeQualifier
Definition: DeclSpec.h:326
clang::Declarator::isPrototypeContext
bool isPrototypeContext() const
Definition: DeclSpec.h:1996
clang::DeclSpec::getUnalignedSpecLoc
SourceLocation getUnalignedSpecLoc() const
Definition: DeclSpec.h:572
clang::DeclSpec::TST_BFloat16
static const TST TST_BFloat16
Definition: DeclSpec.h:272
clang::DeclSpec::getWrittenBuiltinSpecs
const WrittenBuiltinSpecs & getWrittenBuiltinSpecs() const
Definition: DeclSpec.h:830
clang::Declarator::isFunctionDeclarationContext
bool isFunctionDeclarationContext() const
Return true if this declaration appears in a context where a function declarator would be a function ...
Definition: DeclSpec.h:2415
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:209
clang::LambdaIntroducer::LambdaCapture::InitCaptureType
ParsedType InitCaptureType
Definition: DeclSpec.h:2748
clang::VirtSpecifiers::VS_Abstract
@ VS_Abstract
Definition: DeclSpec.h:2696
NestedNameSpecifier.h
clang::DeclaratorContext::Member
@ Member
clang::DeclaratorChunk::destroy
void destroy()
Definition: DeclSpec.h:1581
clang::DeclaratorChunk::FunctionTypeInfo::getNumExceptions
unsigned getNumExceptions() const
Get the number of dynamic exception specifications.
Definition: DeclSpec.h:1507
clang::DeclaratorChunk::FunctionTypeInfo::getOrCreateMethodQualifiers
DeclSpec & getOrCreateMethodQualifiers()
Definition: DeclSpec.h:1432
clang::DeclaratorChunk::FunctionTypeInfo::DeclsInPrototype
NamedDecl ** DeclsInPrototype
Pointer to a new[]'d array of declarations that need to be available for lookup inside the function b...
Definition: DeclSpec.h:1388
clang::Declarator::Declarator
Declarator(const DeclSpec &DS, const ParsedAttributesView &DeclarationAttrs, DeclaratorContext C)
DS and DeclarationAttrs must outlive the Declarator.
Definition: DeclSpec.h:1945
clang::DeclaratorChunk::TypeAndRange::Ty
ParsedType Ty
Definition: DeclSpec.h:1295
clang::DeclaratorChunk::FunctionTypeInfo::isVariadic
unsigned isVariadic
isVariadic - If this function has a prototype, and if that proto ends with ',...)',...
Definition: DeclSpec.h:1308
clang::DeclaratorChunk::FunctionTypeInfo
Definition: DeclSpec.h:1299
clang::Declarator::getDecompositionDeclarator
const DecompositionDeclarator & getDecompositionDeclarator() const
Definition: DeclSpec.h:1990
clang::DeclaratorContext::LambdaExpr
@ LambdaExpr
clang::DeclSpec::hasConstexprSpecifier
bool hasConstexprSpecifier() const
Definition: DeclSpec.h:782
clang::DeclSpec::ClearStorageClassSpecs
void ClearStorageClassSpecs()
Definition: DeclSpec.h:473
clang::DeclaratorChunk::FunctionTypeInfo::getConstQualifierLoc
SourceLocation getConstQualifierLoc() const
Retrieve the location of the 'const' qualifier.
Definition: DeclSpec.h:1467
clang::TST_atomic
@ TST_atomic
Definition: Specifiers.h:93
clang::DeclaratorChunk::Array
@ Array
Definition: DeclSpec.h:1200
clang::DeclaratorContext::SelectionInit
@ SelectionInit
clang::DeclaratorChunk::Ref
ReferenceTypeInfo Ref
Definition: DeclSpec.h:1573
clang::DeclaratorChunk::FunctionTypeInfo::NoexceptExpr
Expr * NoexceptExpr
Pointer to the expression in the noexcept-specifier of this function, if it has one.
Definition: DeclSpec.h:1379
clang::DeclaratorChunk::getParen
static DeclaratorChunk getParen(SourceLocation LParenLoc, SourceLocation RParenLoc)
Return a DeclaratorChunk for a paren.
Definition: DeclSpec.h:1709
clang::ObjCDeclSpec::getGetterNameLoc
SourceLocation getGetterNameLoc() const
Definition: DeclSpec.h:914
clang::DeclSpec::TST_decimal32
static const TST TST_decimal32
Definition: DeclSpec.h:281
clang::VirtSpecifiers::isFinalSpelledSealed
bool isFinalSpelledSealed() const
Definition: DeclSpec.h:2710
clang::UnqualifiedId::setDestructorName
void setDestructorName(SourceLocation TildeLoc, ParsedType ClassType, SourceLocation EndLoc)
Specify that this unqualified-id was parsed as a destructor name.
Definition: DeclSpec.h:1143
clang::DeclSpec::TST_class
static const TST TST_class
Definition: DeclSpec.h:288
clang::DeclSpec::SCS_typedef
@ SCS_typedef
Definition: DeclSpec.h:236
clang::RISCV::Policy
Policy
Definition: RISCVVIntrinsicUtils.h:96
clang::Declarator::AddTypeInfo
void AddTypeInfo(const DeclaratorChunk &TI, ParsedAttributes &&attrs, SourceLocation EndLoc)
AddTypeInfo - Add a chunk to this declarator.
Definition: DeclSpec.h:2274
clang::ParsedAttributesView::addAll
void addAll(iterator B, iterator E)
Definition: ParsedAttr.h:969
clang::UnqualifiedIdKind::IK_LiteralOperatorId
@ IK_LiteralOperatorId
A user-defined literal name, e.g., operator "" _i.
clang::DeclaratorContext::BlockLiteral
@ BlockLiteral
clang::DeclSpec::isTypeAltiVecVector
bool isTypeAltiVecVector() const
Definition: DeclSpec.h:496
clang::LambdaCaptureDefault
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
Definition: Lambda.h:22
clang::DeclSpec::hasTagDefinition
bool hasTagDefinition() const
Definition: DeclSpec.cpp:446
clang::DeclaratorChunk::MemberPointer
@ MemberPointer
Definition: DeclSpec.h:1200
clang::TypeSpecifierSign::Unspecified
@ Unspecified
clang::LambdaIntroducer::LambdaIntroducer
LambdaIntroducer()
Definition: DeclSpec.h:2766
clang::DeclSpec::TST_fract
static const TST TST_fract
Definition: DeclSpec.h:277
clang::Stmt::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.cpp:348
clang::DeclaratorChunk::PipeTypeInfo::AccessWrites
unsigned AccessWrites
The access writes.
Definition: DeclSpec.h:1566
clang::DeclaratorChunk::TypeAndRange::Range
SourceRange Range
Definition: DeclSpec.h:1296
clang::DeclSpec::SetTypePipe
bool SetTypePipe(bool isPipe, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
Definition: DeclSpec.cpp:884
clang::DeclaratorChunk::ArrayTypeInfo::NumElts
Expr * NumElts
This is the size of the array, or null if [] or [*] was specified.
Definition: DeclSpec.h:1262
clang::DeclSpec::isTypeSpecOwned
bool isTypeSpecOwned() const
Definition: DeclSpec.h:499
clang::Declarator::setInvalidType
void setInvalidType(bool Val=true)
Definition: DeclSpec.h:2626
clang::ParsedAttr
ParsedAttr - Represents a syntactic attribute.
Definition: ParsedAttr.h:233
clang::LambdaIntroducer::LambdaCapture
An individual capture in a lambda introducer.
Definition: DeclSpec.h:2741
clang::DeclaratorChunk::getPointer
static DeclaratorChunk getPointer(unsigned TypeQuals, SourceLocation Loc, SourceLocation ConstQualLoc, SourceLocation VolatileQualLoc, SourceLocation RestrictQualLoc, SourceLocation AtomicQualLoc, SourceLocation UnalignedQualLoc)
Return a DeclaratorChunk for a pointer.
Definition: DeclSpec.h:1600
clang::UnqualifiedIdKind::IK_ConstructorName
@ IK_ConstructorName
A constructor name.
clang::Declarator::clear
void clear()
Reset the contents of this Declarator.
Definition: DeclSpec.h:2032
clang::DeclaratorChunk::BlockPointerTypeInfo::TypeQuals
unsigned TypeQuals
For now, sema will catch these as invalid.
Definition: DeclSpec.h:1539
clang::DeclaratorChunk::MemberPointerTypeInfo::Scope
const CXXScopeSpec & Scope() const
Definition: DeclSpec.h:1556
clang::NumObjCPropertyAttrsBits
@ NumObjCPropertyAttrsBits
Number of bits fitting all the property attributes.
Definition: DeclObjCCommon.h:50
clang::ObjCDeclSpec::setObjCDeclQualifier
void setObjCDeclQualifier(ObjCDeclQualifier DQVal)
Definition: DeclSpec.h:872
clang::DeclSpec::setFunctionSpecVirtual
bool setFunctionSpecVirtual(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:1021
clang::VirtSpecifiers::VS_Final
@ VS_Final
Definition: DeclSpec.h:2692
clang::LambdaIntroducer::addCapture
void addCapture(LambdaCaptureKind Kind, SourceLocation Loc, IdentifierInfo *Id, SourceLocation EllipsisLoc, LambdaCaptureInitKind InitKind, ExprResult Init, ParsedType InitCaptureType, SourceRange ExplicitRange)
Append a capture in a lambda introducer.
Definition: DeclSpec.h:2774
clang::DeclaratorChunk::FunctionTypeInfo::getDeclsInPrototype
ArrayRef< NamedDecl * > getDeclsInPrototype() const
Get the non-parameter decls defined within this function prototype.
Definition: DeclSpec.h:1514
clang::CXXScopeSpec::getEndLoc
SourceLocation getEndLoc() const
Definition: DeclSpec.h:75
clang::DeclSpec::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: DeclSpec.h:527
clang::DeclaratorChunk::Ptr
PointerTypeInfo Ptr
Definition: DeclSpec.h:1572
clang::DeclSpec::TST_typeof_unqualType
static const TST TST_typeof_unqualType
Definition: DeclSpec.h:292
clang::LambdaCaptureInitKind
LambdaCaptureInitKind
Definition: DeclSpec.h:2731
clang::ObjCDeclSpec::getGetterName
const IdentifierInfo * getGetterName() const
Definition: DeclSpec.h:912
clang::Declarator::setFunctionDefinitionKind
void setFunctionDefinitionKind(FunctionDefinitionKind Val)
Definition: DeclSpec.h:2642
clang::FieldDeclarator::D
Declarator D
Definition: DeclSpec.h:2678
clang::LambdaIntroducer::Default
LambdaCaptureDefault Default
Definition: DeclSpec.h:2763
clang::DeclaratorChunk::MemberPointerTypeInfo
Definition: DeclSpec.h:1545
clang::Declarator::hasInitializer
bool hasInitializer() const
Definition: DeclSpec.h:2655
clang::TemplateParameterList
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:70
clang::ObjCDeclSpec::DQ_Out
@ DQ_Out
Definition: DeclSpec.h:857
clang::DeclSpec::getStorageClassSpec
SCS getStorageClassSpec() const
Definition: DeclSpec.h:459
clang::TST_char
@ TST_char
Definition: Specifiers.h:55
clang::UnqualifiedId::OFI
Definition: DeclSpec.h:982
clang::TST_int
@ TST_int
Definition: Specifiers.h:60
clang::DeclSpec::getNoreturnSpecLoc
SourceLocation getNoreturnSpecLoc() const
Definition: DeclSpec.h:612
clang::DeclaratorChunk::getAttrs
ParsedAttributesView & getAttrs()
Definition: DeclSpec.h:1597
clang::DeclSpec::hasAttributes
bool hasAttributes() const
Definition: DeclSpec.h:816
clang::TST_int128
@ TST_int128
Definition: Specifiers.h:61
clang::DeclSpec::SetStorageClassSpec
bool SetStorageClassSpec(Sema &S, SCS SC, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
These methods set the specified attribute of the DeclSpec and return false if there was no error.
Definition: DeclSpec.cpp:626
clang::DeclSpec::TST_union
static const TST TST_union
Definition: DeclSpec.h:285
clang::DeclaratorChunk::getSourceRange
SourceRange getSourceRange() const
Definition: DeclSpec.h:1208
clang::DeclaratorChunk::FunctionTypeInfo::getExceptionSpecRange
SourceRange getExceptionSpecRange() const
Definition: DeclSpec.h:1459
clang::ParsedType
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
Definition: Ownership.h:243
clang::VirtSpecifiers::clear
void clear()
Definition: DeclSpec.h:2714
clang::DeclaratorContext::ObjCCatch
@ ObjCCatch
clang::NestedNameSpecifierLoc
A C++ nested-name-specifier augmented with source location information.
Definition: NestedNameSpecifier.h:243
clang::Declarator::setObjCIvar
void setObjCIvar(bool Val=true)
Definition: DeclSpec.h:2620
clang::DeclSpec::SCS_register
@ SCS_register
Definition: DeclSpec.h:240
clang::UnqualifiedId::clear
void clear()
Clear out this unqualified-id, setting it to default (invalid) state.
Definition: DeclSpec.h:1041
clang::ObjCDeclSpec::setNullability
void setNullability(SourceLocation loc, NullabilityKind kind)
Definition: DeclSpec.h:903
clang::LCD_None
@ LCD_None
Definition: Lambda.h:23
clang::Declarator::SetSourceRange
void SetSourceRange(SourceRange R)
Definition: DeclSpec.h:2008
clang::DecompositionDeclarator::DecompositionDeclarator
DecompositionDeclarator()
Definition: DeclSpec.h:1744
clang::DeclSpec::ClearTypeQualifiers
void ClearTypeQualifiers()
Clear out all of the type qualifiers.
Definition: DeclSpec.h:576
clang::DeclaratorChunk::FunctionTypeInfo::Params
ParamInfo * Params
Params - This is a pointer to a new[]'d array of ParamInfo objects that describe the parameters speci...
Definition: DeclSpec.h:1363
clang::Declarator::setTemplateParameterLists
void setTemplateParameterLists(ArrayRef< TemplateParameterList * > TPLs)
Sets the template parameter lists that preceded the declarator.
Definition: DeclSpec.h:2549
clang::DeclaratorChunk::FunctionTypeInfo::freeParams
void freeParams()
Reset the parameter list to having zero parameters.
Definition: DeclSpec.h:1402
clang::ObjCDeclSpec::DQ_Inout
@ DQ_Inout
Definition: DeclSpec.h:856
clang::DeclSpec::ClearConstexprSpec
void ClearConstexprSpec()
Definition: DeclSpec.h:786
clang::NestedNameSpecifierLocBuilder
Class that aids in the construction of nested-name-specifiers along with source-location information ...
Definition: NestedNameSpecifier.h:356
clang::DeclSpec::getThreadStorageClassSpecLoc
SourceLocation getThreadStorageClassSpecLoc() const
Definition: DeclSpec.h:469
clang::DeclaratorChunk::FunctionTypeInfo::getExceptionSpecLocEnd
SourceLocation getExceptionSpecLocEnd() const
Definition: DeclSpec.h:1455
clang::DeclSpec::SCS_mutable
@ SCS_mutable
Definition: DeclSpec.h:242
clang::ObjCDeclSpec::DQ_Oneway
@ DQ_Oneway
Definition: DeclSpec.h:860
clang::DeclSpec::isTypeRep
bool isTypeRep() const
Definition: DeclSpec.h:500
clang::Declarator::isFunctionDeclarator
bool isFunctionDeclarator(unsigned &idx) const
isFunctionDeclarator - This method returns true if the declarator is a function declarator (looking t...
Definition: DeclSpec.h:2361
clang::DeclSpec::setFunctionSpecNoreturn
bool setFunctionSpecNoreturn(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:1055
clang::DeclaratorChunk::FunctionTypeInfo::isAmbiguous
unsigned isAmbiguous
Can this declaration be a constructor-style initializer?
Definition: DeclSpec.h:1311
clang::DeclaratorChunk::FunctionTypeInfo::hasRefQualifier
bool hasRefQualifier() const
Determine whether this function declaration contains a ref-qualifier.
Definition: DeclSpec.h:1489
clang::CXXScopeSpec::getWithLocInContext
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
Definition: DeclSpec.cpp:152
clang::DeclaratorContext::ObjCResult
@ ObjCResult
clang::OverloadedOperatorKind
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:21
clang::DeclaratorChunk::ParamInfo::Param
Decl * Param
Definition: DeclSpec.h:1277
clang::FunctionDefinitionKind::Declaration
@ Declaration
clang::ObjCDeclSpec::getNullabilityLoc
SourceLocation getNullabilityLoc() const
Definition: DeclSpec.h:895
clang::DecompositionDeclarator::getSourceRange
SourceRange getSourceRange() const
Definition: DeclSpec.h:1770
clang::Declarator::SetRangeBegin
void SetRangeBegin(SourceLocation Loc)
SetRangeBegin - Set the start of the source range to Loc, unless it's invalid.
Definition: DeclSpec.h:2011
clang::Declarator::~Declarator
~Declarator()
Definition: DeclSpec.h:1964
clang::DeclSpec::DeclRep
Decl * DeclRep
Definition: DeclSpec.h:372
clang::DeclSpec::TSC
TSC
Definition: DeclSpec.h:253
clang::LambdaIntroducer::LambdaCapture::Kind
LambdaCaptureKind Kind
Definition: DeclSpec.h:2742
clang::Declarator::SetIdentifier
void SetIdentifier(IdentifierInfo *Id, SourceLocation IdLoc)
Set the name of this declarator to be the given identifier.
Definition: DeclSpec.h:2260
clang::DeclSpec::TST_decimal64
static const TST TST_decimal64
Definition: DeclSpec.h:282
clang::UnqualifiedIdKind
UnqualifiedIdKind
Describes the kind of unqualified-id parsed.
Definition: DeclSpec.h:949
clang::DeclSpec::TST_ibm128
static const TST TST_ibm128
Definition: DeclSpec.h:279
clang::TST_decimal32
@ TST_decimal32
Definition: Specifiers.h:73
clang::ParsedAttributesView::empty
bool empty() const
Definition: ParsedAttr.h:932
clang::OpaquePtr< QualType >
clang::Declarator::setRedeclaration
void setRedeclaration(bool Val)
Definition: DeclSpec.h:2671
clang::DeclSpec::TST_int
static const TST TST_int
Definition: DeclSpec.h:268
clang::ExplicitSpecifier::getExpr
const Expr * getExpr() const
Definition: DeclCXX.h:1839
clang::DeclSpec::getStorageClassSpecLoc
SourceLocation getStorageClassSpecLoc() const
Definition: DeclSpec.h:468
clang::ParsedAttributesView::Range
SourceRange Range
Definition: ParsedAttr.h:925
clang::ConstexprSpecKind
ConstexprSpecKind
Define the kind of constexpr specifier.
Definition: Specifiers.h:32
clang::ParsedAttributes::takeAllFrom
void takeAllFrom(ParsedAttributes &Other)
Definition: ParsedAttr.h:1030
clang::DeclaratorChunk::BlockPointerTypeInfo::destroy
void destroy()
Definition: DeclSpec.h:1541
clang::TST_float
@ TST_float
Definition: Specifiers.h:68
clang::DeclSpec::TST_int128
static const TST TST_int128
Definition: DeclSpec.h:269
clang::Declarator::setHasInitializer
void setHasInitializer(bool Val=true)
Definition: DeclSpec.h:2654
clang::DecompositionDeclarator::getLSquareLoc
SourceLocation getLSquareLoc() const
Definition: DeclSpec.h:1768
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:254
clang::DeclaratorChunk::FunctionTypeInfo::TrailingReturnTypeLoc
SourceLocation TrailingReturnTypeLoc
If HasTrailingReturnType is true, this is the location of the trailing return type.
Definition: DeclSpec.h:1397
clang::DecompositionDeclarator::clear
void clear()
Definition: DeclSpec.h:1753
clang::TST_typeofExpr
@ TST_typeofExpr
Definition: Specifiers.h:83
clang::DeclaratorChunk::ParamInfo
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed.
Definition: DeclSpec.h:1274
clang::DeclaratorContext::RequiresExpr
@ RequiresExpr
clang::UnqualifiedIdKind::IK_TemplateId
@ IK_TemplateId
A template-id, e.g., f<int>.
clang::Declarator::getTemplateParameterLists
ArrayRef< TemplateParameterList * > getTemplateParameterLists() const
The template parameter lists that preceded the declarator.
Definition: DeclSpec.h:2554
clang::CXXScopeSpec::setRange
void setRange(SourceRange R)
Definition: DeclSpec.h:71
clang::DecompositionDeclarator::Binding::Name
IdentifierInfo * Name
Definition: DeclSpec.h:1728
clang::Declarator::getCXXScopeSpec
const CXXScopeSpec & getCXXScopeSpec() const
getCXXScopeSpec - Return the C++ scope specifier (global scope or nested-name-specifier) that is part...
Definition: DeclSpec.h:1984
clang::DeclaratorContext
DeclaratorContext
Definition: DeclSpec.h:1784
clang::DeclaratorChunk::ArrayTypeInfo::hasStatic
unsigned hasStatic
True if this dimension included the 'static' keyword.
Definition: DeclSpec.h:1254
clang::DeclaratorChunk::FunctionTypeInfo::MethodQualifiers
DeclSpec * MethodQualifiers
DeclSpec for the function with the qualifier related info.
Definition: DeclSpec.h:1366
clang::DeclaratorChunk::Paren
@ Paren
Definition: DeclSpec.h:1200
clang::LambdaCaptureKind
LambdaCaptureKind
The different capture forms in a lambda introducer.
Definition: Lambda.h:33
clang::DeclSpec::isTypeAltiVecPixel
bool isTypeAltiVecPixel() const
Definition: DeclSpec.h:497
clang::Declarator::SetRangeEnd
void SetRangeEnd(SourceLocation Loc)
SetRangeEnd - Set the end of the source range to Loc, unless it's invalid.
Definition: DeclSpec.h:2016
clang::Declarator::setTrailingRequiresClause
void setTrailingRequiresClause(Expr *TRC)
Sets a trailing requires clause for this declarator.
Definition: DeclSpec.h:2531
clang::DeclSpec::getAltiVecLoc
SourceLocation getAltiVecLoc() const
Definition: DeclSpec.h:534
clang::TST_Accum
@ TST_Accum
Definition: Specifiers.h:65
clang::LambdaCaptureInitKind::ListInit
@ ListInit
[a{b}]
clang::Declarator::getFunctionTypeInfo
DeclaratorChunk::FunctionTypeInfo & getFunctionTypeInfo()
getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses).
Definition: DeclSpec.h:2392
clang::DeclSpec::TST_bitint
static const TST TST_bitint
Definition: DeclSpec.h:270
false
#define false
Definition: stdbool.h:22
clang::DeclSpec::TST_decimal128
static const TST TST_decimal128
Definition: DeclSpec.h:283
clang::ObjCPropertyAttribute::kind_noattr
@ kind_noattr
Definition: DeclObjCCommon.h:23
clang::DeclSpec::isDeclRep
static bool isDeclRep(TST T)
Definition: DeclSpec.h:427
clang::DeclaratorChunk::ArrayTypeInfo::isStar
unsigned isStar
True if this dimension was [*]. In this case, NumElts is null.
Definition: DeclSpec.h:1257
clang::DecompositionDeclarator::isSet
bool isSet() const
Definition: DeclSpec.h:1766
clang::ObjCDeclSpec::getSetterName
const IdentifierInfo * getSetterName() const
Definition: DeclSpec.h:920
clang::ExplicitSpecifier::isSpecified
bool isSpecified() const
Determine if the declaration had an explicit specifier of any kind.
Definition: DeclCXX.h:1843
clang::ObjCDeclSpec::setGetterName
void setGetterName(IdentifierInfo *name, SourceLocation loc)
Definition: DeclSpec.h:915
clang::ActionResult::get
PtrTy get() const
Definition: Ownership.h:169
clang::syntax::NodeRole::Declarator
@ Declarator
clang::Declarator::type_object_iterator
SmallVectorImpl< DeclaratorChunk >::const_iterator type_object_iterator
Definition: DeclSpec.h:2312
clang::DeclaratorChunk::DeclaratorChunk
DeclaratorChunk()
Definition: DeclSpec.h:1197
clang::InventedTemplateParameterInfo::TemplateParams
SmallVector< NamedDecl *, 4 > TemplateParams
Store the list of the template parameters for a generic lambda or an abbreviated function template.
Definition: DeclSpec.h:2804
clang::DeclSpec::isModulePrivateSpecified
bool isModulePrivateSpecified() const
Definition: DeclSpec.h:774
clang::TemplateName
Represents a C++ template name within the type system.
Definition: TemplateName.h:201
clang::UnqualifiedId::ConstructorName
UnionParsedType ConstructorName
When Kind == IK_ConstructorName, the class-name of the type whose constructor is being referenced.
Definition: DeclSpec.h:1013
clang::CXXScopeSpec::location_data
char * location_data() const
Retrieve the data associated with the source-location information.
Definition: DeclSpec.h:219
clang::DeclSpec::isMissingDeclaratorOk
bool isMissingDeclaratorOk()
Checks if this DeclSpec can stand alone, without a Declarator.
Definition: DeclSpec.cpp:1451
clang::Declarator::mayBeFollowedByCXXDirectInit
bool mayBeFollowedByCXXDirectInit() const
mayBeFollowedByCXXDirectInit - Return true if the declarator can be followed by a C++ direct initiali...
Definition: DeclSpec.h:2177
clang::DeclaratorChunk::FunctionTypeInfo::LParenLoc
SourceLocation LParenLoc
The location of the left parenthesis in the source.
Definition: DeclSpec.h:1328
clang::Declarator::getInventedTemplateParameterList
TemplateParameterList * getInventedTemplateParameterList() const
The template parameter list generated from the explicit template parameters along with any invented t...
Definition: DeclSpec.h:2568
clang::DeclSpec::forEachQualifier
void forEachQualifier(llvm::function_ref< void(TQ, StringRef, SourceLocation)> Handle)
This method calls the passed in handler on each qual being set.
Definition: DeclSpec.cpp:440
clang::ObjCDeclSpec::getObjCDeclQualifier
ObjCDeclQualifier getObjCDeclQualifier() const
Definition: DeclSpec.h:869
clang::UnqualifiedId::setLiteralOperatorId
void setLiteralOperatorId(const IdentifierInfo *Id, SourceLocation OpLoc, SourceLocation IdLoc)
Specific that this unqualified-id was parsed as a literal-operator-id.
Definition: DeclSpec.h:1105
clang::Declarator::isPastIdentifier
bool isPastIdentifier() const
isPastIdentifier - Return true if we have parsed beyond the point where the name would appear.
Definition: DeclSpec.h:2235
clang::TST_decimal64
@ TST_decimal64
Definition: Specifiers.h:74
clang::DeclSpec::TST_float16
static const TST TST_float16
Definition: DeclSpec.h:275
llvm::ArrayRef
Definition: LLVM.h:34
clang::DeclSpec::TST_typename
static const TST TST_typename
Definition: DeclSpec.h:289
clang::DeclSpec::getTypeSpecTypeNameLoc
SourceLocation getTypeSpecTypeNameLoc() const
Definition: DeclSpec.h:537
Value
Value
Definition: UninitializedValues.cpp:103
clang::DeclaratorChunk::getPipe
static DeclaratorChunk getPipe(unsigned TypeQuals, SourceLocation Loc)
Return a DeclaratorChunk for a block.
Definition: DeclSpec.h:1684
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:83
clang::Declarator::isFunctionDefinition
bool isFunctionDefinition() const
Definition: DeclSpec.h:2646
clang::TypeLoc
Base wrapper for a particular "section" of type source info.
Definition: TypeLoc.h:58
clang::DeclSpec::isTypeAltiVecBool
bool isTypeAltiVecBool() const
Definition: DeclSpec.h:498
clang::DeclSpec::PQ_FunctionSpecifier
@ PQ_FunctionSpecifier
Definition: DeclSpec.h:327
clang::DeclSpec::TST_typeofType
static const TST TST_typeofType
Definition: DeclSpec.h:290
clang::DeclaratorChunk::PointerTypeInfo::UnalignedQualLoc
SourceLocation UnalignedQualLoc
The location of the __unaligned-qualifier, if any.
Definition: DeclSpec.h:1233
clang::DeclSpec::getInlineSpecLoc
SourceLocation getInlineSpecLoc() const
Definition: DeclSpec.h:590
clang::Declarator::type_object_range
llvm::iterator_range< type_object_iterator > type_object_range
Definition: DeclSpec.h:2313
clang::DeclSpec::TST_half
static const TST TST_half
Definition: DeclSpec.h:271
clang::UnqualifiedId::setDeductionGuideName
void setDeductionGuideName(ParsedTemplateTy Template, SourceLocation TemplateLoc)
Specify that this unqualified-id was parsed as a template-name for a deduction-guide.
Definition: DeclSpec.h:1164
clang::DeclSpec::TST_decltype_auto
static const TST TST_decltype_auto
Definition: DeclSpec.h:295
clang::DeclSpec::getTypeSpecWidth
TypeSpecifierWidth getTypeSpecWidth() const
Definition: DeclSpec.h:488
clang::Sema
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:358
clang::ActionResult::isInvalid
bool isInvalid() const
Definition: Ownership.h:165
clang::DeclSpec::SCS_private_extern
@ SCS_private_extern
Definition: DeclSpec.h:241
clang::UnqualifiedIdKind::IK_DestructorName
@ IK_DestructorName
A destructor name.
clang::DeclaratorChunk::Loc
SourceLocation Loc
Loc - The place where this type was defined.
Definition: DeclSpec.h:1204
clang::FieldDeclarator::BitfieldSize
Expr * BitfieldSize
Definition: DeclSpec.h:2679
clang::FunctionDefinitionKind::Definition
@ Definition
clang::DeclaratorChunk::ReferenceTypeInfo::LValueRef
bool LValueRef
True if this is an lvalue reference, false if it's an rvalue reference.
Definition: DeclSpec.h:1243
clang::Declarator::setDecompositionBindings
void setDecompositionBindings(SourceLocation LSquareLoc, ArrayRef< DecompositionDeclarator::Binding > Bindings, SourceLocation RSquareLoc)
Set the decomposition bindings for this declarator.
Definition: DeclSpec.cpp:294
clang::CXXScopeSpec::MakeGlobal
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
Definition: DeclSpec.cpp:104
clang::DeclaratorContext::ObjCParameter
@ ObjCParameter
clang::DeclSpec::TST_decltype
static const TST TST_decltype
Definition: DeclSpec.h:294
clang::Declarator::isInvalidType
bool isInvalidType() const
Definition: DeclSpec.h:2627
clang::TST_wchar
@ TST_wchar
Definition: Specifiers.h:56
clang::DeclSpec::getTypeSpecWidthLoc
SourceLocation getTypeSpecWidthLoc() const
Definition: DeclSpec.h:529
clang::DeclSpec::SetTypeSpecSat
bool SetTypeSpecSat(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:856
clang::ParsedAttributes
ParsedAttributes - A collection of parsed attributes.
Definition: ParsedAttr.h:1023
clang::DeclSpec::getConstexprSpecifier
ConstexprSpecKind getConstexprSpecifier() const
Definition: DeclSpec.h:777
clang::InventedTemplateParameterInfo::AutoTemplateParameterDepth
unsigned AutoTemplateParameterDepth
If this is a generic lambda or abbreviated function template, use this as the depth of each 'auto' pa...
Definition: DeclSpec.h:2795
clang::Declarator::isFunctionDeclaratorAFunctionDeclaration
bool isFunctionDeclaratorAFunctionDeclaration() const
Return true if a function declarator at this position would be a function declaration.
Definition: DeclSpec.h:2500
clang::DeclaratorChunk::getAttrs
const ParsedAttributesView & getAttrs() const
If there are attributes applied to this declaratorchunk, return them.
Definition: DeclSpec.h:1596
clang::UnqualifiedId::EndLocation
SourceLocation EndLocation
The location of the last token that describes this unqualified-id.
Definition: DeclSpec.h:1034
clang::Declarator::setExtension
void setExtension(bool Val=true)
Definition: DeclSpec.h:2617
clang::DeclSpec::ParsedSpecifiers
ParsedSpecifiers
ParsedSpecifiers - Flags to query which specifiers were applied.
Definition: DeclSpec.h:322
clang::TST_typeof_unqualExpr
@ TST_typeof_unqualExpr
Definition: Specifiers.h:85
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:85
clang::DeclaratorChunk::PointerTypeInfo::VolatileQualLoc
SourceLocation VolatileQualLoc
The location of the volatile-qualifier, if any.
Definition: DeclSpec.h:1224
clang::DeclaratorContext::Prototype
@ Prototype
clang::DeclaratorChunk::FunctionTypeInfo::getLParenLoc
SourceLocation getLParenLoc() const
Definition: DeclSpec.h:1445
clang::TST_decimal128
@ TST_decimal128
Definition: Specifiers.h:75
clang::DeclSpec::setModulePrivateSpec
bool setModulePrivateSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:1088
clang::TypeSpecifierWidth
TypeSpecifierWidth
Specifies the width of a type, e.g., short, long, or long long.
Definition: Specifiers.h:44
clang::LambdaIntroducer::LambdaCapture::EllipsisLoc
SourceLocation EllipsisLoc
Definition: DeclSpec.h:2745
clang::LambdaIntroducer::hasLambdaCapture
bool hasLambdaCapture() const
Definition: DeclSpec.h:2769
clang::ObjCDeclSpec::setSetterName
void setSetterName(IdentifierInfo *name, SourceLocation loc)
Definition: DeclSpec.h:923
clang::DeclSpec::TST_float128
static const TST TST_float128
Definition: DeclSpec.h:278
clang::DeclaratorChunk::FunctionTypeInfo::RParenLoc
SourceLocation RParenLoc
The location of the right parenthesis in the source.
Definition: DeclSpec.h:1334
clang::ObjCDeclSpec::DQ_Bycopy
@ DQ_Bycopy
Definition: DeclSpec.h:858
clang::DeclaratorChunk::MemberPointerTypeInfo::Scope
CXXScopeSpec & Scope()
Definition: DeclSpec.h:1553
Lambda.h
clang::LangOptions
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:81
clang::ObjCPropertyAttribute::Kind
Kind
Definition: DeclObjCCommon.h:22
clang::DeclaratorChunk::FunctionTypeInfo::getTrailingReturnTypeLoc
SourceLocation getTrailingReturnTypeLoc() const
Get the trailing-return-type location for this function declarator.
Definition: DeclSpec.h:1530
clang::ActionResult
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc.
Definition: Ownership.h:152
clang::TST_ibm128
@ TST_ibm128
Definition: Specifiers.h:71
clang::DeclSpec::getRepAsDecl
Decl * getRepAsDecl() const
Definition: DeclSpec.h:509
clang::DeclSpec::TST_void
static const TST TST_void
Definition: DeclSpec.h:262
clang::LambdaCaptureInitKind::NoInit
@ NoInit
[a]
clang::Declarator::setCommaLoc
void setCommaLoc(SourceLocation CL)
Definition: DeclSpec.h:2636
clang::DeclaratorChunk::FunctionTypeInfo::RefQualifierIsLValueRef
unsigned RefQualifierIsLValueRef
Whether the ref-qualifier (if any) is an lvalue reference.
Definition: DeclSpec.h:1315
std
Definition: Format.h:4477
clang::DeclaratorChunk::FunctionTypeInfo::HasTrailingReturnType
unsigned HasTrailingReturnType
HasTrailingReturnType - If this is true, a trailing return type was specified.
Definition: DeclSpec.h:1325
clang::DeclSpec::TST_bool
static const TST TST_bool
Definition: DeclSpec.h:280
clang::TST_class
@ TST_class
Definition: Specifiers.h:79
clang::DeclSpec::TST_char32
static const TST TST_char32
Definition: DeclSpec.h:267
clang::DeclaratorChunk::BlockPointerTypeInfo
Definition: DeclSpec.h:1536
clang::NullabilityKind
NullabilityKind
Describes the nullability of a particular type.
Definition: Specifiers.h:320
clang::DeclSpec::TST_unspecified
static const TST TST_unspecified
Definition: DeclSpec.h:261
clang::DeclSpec::getPipeLoc
SourceLocation getPipeLoc() const
Definition: DeclSpec.h:573
clang::DecompositionDeclarator
A parsed C++17 decomposition declarator of the form '[' identifier-list ']'.
Definition: DeclSpec.h:1725
clang::DeclSpec::takeAttributesFrom
void takeAttributesFrom(ParsedAttributes &attrs)
Definition: DeclSpec.h:821
clang::UnqualifiedId::OFI::SymbolLocations
SourceLocation SymbolLocations[3]
The source locations of the individual tokens that name the operator, e.g., the "new",...
Definition: DeclSpec.h:993
clang::DeclSpec::TSCS___thread
static const TSCS TSCS___thread
Definition: DeclSpec.h:249
clang::LambdaIntroducer::DefaultLoc
SourceLocation DefaultLoc
Definition: DeclSpec.h:2762
clang::DeclSpec::SetStorageClassSpecThread
bool SetStorageClassSpecThread(TSCS TSC, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:688
clang::TST_char32
@ TST_char32
Definition: Specifiers.h:59
clang::DeclaratorContext::TypeName
@ TypeName
clang::DeclSpec::TQ
TQ
Definition: DeclSpec.h:309
clang::DeclaratorChunk::ArrayTypeInfo::TypeQuals
unsigned TypeQuals
The type qualifiers for the array: const/volatile/restrict/__unaligned/_Atomic.
Definition: DeclSpec.h:1251
clang::UnqualifiedId::setConversionFunctionId
void setConversionFunctionId(SourceLocation OperatorLoc, ParsedType Ty, SourceLocation EndLoc)
Specify that this unqualified-id was parsed as a conversion-function-id.
Definition: DeclSpec.h:1088
clang::SourceLocation::isInvalid
bool isInvalid() const
Definition: SourceLocation.h:111
clang::DeclaratorChunk::PointerTypeInfo::destroy
void destroy()
Definition: DeclSpec.h:1235
clang::UnqualifiedId::ConversionFunctionId
UnionParsedType ConversionFunctionId
When Kind == IK_ConversionFunctionId, the type that the conversion function names.
Definition: DeclSpec.h:1009
clang::DeclSpec::getTypeSpecSatLoc
SourceLocation getTypeSpecSatLoc() const
Definition: DeclSpec.h:535
clang::TSCS__Thread_local
@ TSCS__Thread_local
C11 _Thread_local.
Definition: Specifiers.h:232
clang
Definition: CalledOnceCheck.h:17
clang::Declarator::mayOmitIdentifier
bool mayOmitIdentifier() const
mayOmitIdentifier - Return true if the identifier is either optional or not allowed.
Definition: DeclSpec.h:2054
clang::UnqualifiedIdKind::IK_ConversionFunctionId
@ IK_ConversionFunctionId
A conversion function name, e.g., operator int.
clang::transformer::range
RangeSelector range(RangeSelector Begin, RangeSelector End)
DEPRECATED. Use enclose.
Definition: RangeSelector.h:41
clang::TypeResult
ActionResult< ParsedType > TypeResult
Definition: Ownership.h:264
clang::DeclaratorChunk::AttrList
ParsedAttributesView AttrList
Definition: DeclSpec.h:1214
clang::DeclSpec::TST_atomic
static const TST TST_atomic
Definition: DeclSpec.h:302
clang::DeclaratorChunk::FunctionTypeInfo::getRefQualifierLoc
SourceLocation getRefQualifierLoc() const
Retrieve the location of the ref-qualifier, if any.
Definition: DeclSpec.h:1464
clang::DeclaratorContext::Block
@ Block
clang::Declarator::InlineBindings
DecompositionDeclarator::Binding InlineBindings[16]
Definition: DeclSpec.h:1913
clang::TST_bitint
@ TST_bitint
Definition: Specifiers.h:62
clang::DeclSpec::TST_auto_type
static const TST TST_auto_type
Definition: DeclSpec.h:300
clang::Declarator::isCtorOrDtor
bool isCtorOrDtor()
Returns true if this declares a constructor or a destructor.
Definition: DeclSpec.cpp:423
clang::Declarator
Information about one declarator, including the parsed type information and the identifier.
Definition: DeclSpec.h:1834
clang::DeclaratorContext::Condition
@ Condition
clang::LambdaCaptureInitKind::CopyInit
@ CopyInit
[a = b], [a = {b}]
clang::DeclSpec::forEachCVRUQualifier
void forEachCVRUQualifier(llvm::function_ref< void(TQ, StringRef, SourceLocation)> Handle)
This method calls the passed in handler on each CVRU qual being set.
Definition: DeclSpec.cpp:428
clang::TST_char16
@ TST_char16
Definition: Specifiers.h:58
clang::DeclaratorChunk::FunctionTypeInfo::MutableLoc
SourceLocation MutableLoc
The location of the 'mutable' qualifer in a lambda-declarator, if any.
Definition: DeclSpec.h:1352
clang::DeclSpec::TSC_imaginary
@ TSC_imaginary
Definition: DeclSpec.h:255
clang::Declarator::DropFirstTypeObject
void DropFirstTypeObject()
Definition: DeclSpec.h:2320
clang::DeclSpec::ClearFunctionSpecs
void ClearFunctionSpecs()
Definition: DeclSpec.h:614
clang::FieldDeclarator
This little struct is used to capture information about structure field declarators,...
Definition: DeclSpec.h:2677
clang::DeclaratorChunk::Reference
@ Reference
Definition: DeclSpec.h:1200
clang::CXXScopeSpec::getScopeRep
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
Definition: DeclSpec.h:78
clang::SourceLocation::isValid
bool isValid() const
Return true if this is a valid SourceLocation object.
Definition: SourceLocation.h:110
clang::DeclaratorContext::FunctionalCast
@ FunctionalCast
clang::DeclSpec::getTypeofParensRange
SourceRange getTypeofParensRange() const
Definition: DeclSpec.h:543
clang::DeclSpec::getTypeQualifiers
unsigned getTypeQualifiers() const
getTypeQualifiers - Return a set of TQs.
Definition: DeclSpec.h:567
clang::Declarator::getTypeObject
const DeclaratorChunk & getTypeObject(unsigned i) const
Return the specified TypeInfo from this declarator.
Definition: DeclSpec.h:2303
clang::DeclSpec::getTypeSpecScope
const CXXScopeSpec & getTypeSpecScope() const
Definition: DeclSpec.h:523
clang::CXXScopeSpec::getLastQualifierNameLoc
SourceLocation getLastQualifierNameLoc() const
Retrieve the location of the name in the last qualifier in this nested name specifier.
Definition: DeclSpec.cpp:145
unsigned
clang::DeclSpec::isVirtualSpecified
bool isVirtualSpecified() const
Definition: DeclSpec.h:598
clang::Declarator::mayHaveDecompositionDeclarator
bool mayHaveDecompositionDeclarator() const
Return true if the context permits a C++17 decomposition declarator.
Definition: DeclSpec.h:2132
clang::DeclaratorChunk
One instance of this struct is used for each type in a declarator that is parsed.
Definition: DeclSpec.h:1196
clang::UnqualifiedId::setOperatorFunctionId
void setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3])
Specify that this unqualified-id was parsed as an operator-function-id.
Definition: DeclSpec.cpp:1457
clang::TSCS___thread
@ TSCS___thread
GNU __thread.
Definition: Specifiers.h:226
clang::VirtSpecifiers::getLastLocation
SourceLocation getLastLocation() const
Definition: DeclSpec.h:2719
clang::ObjCDeclSpec::getPropertyAttributes
ObjCPropertyAttribute::Kind getPropertyAttributes() const
Definition: DeclSpec.h:879
clang::FunctionDefinitionKind
FunctionDefinitionKind
Described the kind of function definition (if any) provided for a function.
Definition: DeclSpec.h:1777
clang::TST_BFloat16
@ TST_BFloat16
Definition: Specifiers.h:67
clang::DeclaratorChunk::ParamInfo::ParamInfo
ParamInfo(IdentifierInfo *ident, SourceLocation iloc, Decl *param, std::unique_ptr< CachedTokens > DefArgTokens=nullptr)
Definition: DeclSpec.h:1287
clang::Declarator::hasTrailingRequiresClause
bool hasTrailingRequiresClause() const
Determine whether a trailing requires clause was written in this declarator.
Definition: DeclSpec.h:2544
clang::DeclaratorContext::KNRTypeList
@ KNRTypeList
clang::DeclSpec::TST_struct
static const TST TST_struct
Definition: DeclSpec.h:286
clang::ObjCPropertyAttribute::kind_nullability
@ kind_nullability
Indicates that the nullability of the type was spelled with a property attribute rather than a type q...
Definition: DeclObjCCommon.h:38
clang::DeclSpec::TQ_restrict
@ TQ_restrict
Definition: DeclSpec.h:312
clang::DeclaratorContext::ConversionId
@ ConversionId
clang::DeclSpec::ExprRep
Expr * ExprRep
Definition: DeclSpec.h:373
clang::DeclaratorChunk::ParamInfo::IdentLoc
SourceLocation IdentLoc
Definition: DeclSpec.h:1276
clang::DeclaratorContext::CXXNew
@ CXXNew
clang::ImplicitTypenameContext::Yes
@ Yes
clang::TST_typeofType
@ TST_typeofType
Definition: Specifiers.h:82
clang::DeclSpec::SetTypeAltiVecVector
bool SetTypeAltiVecVector(bool isAltiVecVector, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
Definition: DeclSpec.cpp:869
clang::DeclaratorChunk::ArrayTypeInfo
Definition: DeclSpec.h:1248
clang::DeclSpec::TQ_const
@ TQ_const
Definition: DeclSpec.h:311
clang::TST_float128
@ TST_float128
Definition: Specifiers.h:70
clang::CXXScopeSpec::MakeTrivial
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
Definition: DeclSpec.cpp:126
clang::DeclaratorChunk::FunctionTypeInfo::ExceptionSpecLocEnd
SourceLocation ExceptionSpecLocEnd
The end location of the exception specification, if any.
Definition: DeclSpec.h:1358
clang::DeclSpec::getModulePrivateSpecLoc
SourceLocation getModulePrivateSpecLoc() const
Definition: DeclSpec.h:775
clang::DeclaratorChunk::isParen
bool isParen() const
Definition: DeclSpec.h:1718
clang::DeclSpec::TSCS
ThreadStorageClassSpecifier TSCS
Definition: DeclSpec.h:247
clang::DeclSpec::getRepAsTemplateId
TemplateIdAnnotation * getRepAsTemplateId() const
Definition: DeclSpec.h:517
clang::Declarator::setObjCWeakProperty
void setObjCWeakProperty(bool Val=true)
Definition: DeclSpec.h:2623
clang::DeclSpec::TST_typeofExpr
static const TST TST_typeofExpr
Definition: DeclSpec.h:291
clang::UnionOpaquePtr< QualType >
clang::DeclaratorContext::TemplateTypeArg
@ TemplateTypeArg
clang::Declarator::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: DeclSpec.h:2006
clang::Declarator::AddTypeInfo
void AddTypeInfo(const DeclaratorChunk &TI, SourceLocation EndLoc)
AddTypeInfo - Add a chunk to this declarator.
Definition: DeclSpec.h:2286
llvm::SmallVectorImpl
Definition: Randstruct.h:18
clang::DeclSpec::getTypeSpecSignLoc
SourceLocation getTypeSpecSignLoc() const
Definition: DeclSpec.h:532
clang::DeclSpec::isTransformTypeTrait
static bool isTransformTypeTrait(TST T)
Definition: DeclSpec.h:432
clang::Declarator::isFunctionDeclarator
bool isFunctionDeclarator() const
isFunctionDeclarator - Once this declarator is fully parsed and formed, this method returns true if t...
Definition: DeclSpec.h:2385
clang::ParsedAttributes::clear
void clear()
Definition: ParsedAttr.h:1047
clang::DeclaratorContext::TrailingReturn
@ TrailingReturn
clang::InventedTemplateParameterInfo::NumExplicitTemplateParams
unsigned NumExplicitTemplateParams
The number of parameters in the template parameter list that were explicitly specified by the user,...
Definition: DeclSpec.h:2791
clang::DeclSpec::Finish
void Finish(Sema &S, const PrintingPolicy &Policy)
Finish - This does final analysis of the declspec, issuing diagnostics for things like "_Imaginary" (...
Definition: DeclSpec.cpp:1122
clang::LambdaIntroducer::LambdaCapture::ExplicitRange
SourceRange ExplicitRange
Definition: DeclSpec.h:2749
clang::DeclSpec::isEmpty
bool isEmpty() const
isEmpty - Return true if this declaration specifier is completely empty: no tokens were parsed in the...
Definition: DeclSpec.h:654
clang::ObjCDeclSpec::setPropertyAttributes
void setPropertyAttributes(ObjCPropertyAttribute::Kind PRVal)
Definition: DeclSpec.h:882
clang::ObjCDeclSpec::DQ_CSNullability
@ DQ_CSNullability
Definition: DeclSpec.h:861
clang::Declarator::hasEllipsis
bool hasEllipsis() const
Definition: DeclSpec.h:2638
clang::UnqualifiedId::isValid
bool isValid() const
Determine whether this unqualified-id refers to a valid name.
Definition: DeclSpec.h:1049
clang::ParsedAttributes::getPool
AttributePool & getPool() const
Definition: ParsedAttr.h:1028
clang::ParsedAttributesView
Definition: ParsedAttr.h:920
clang::Expr
This represents one expression.
Definition: Expr.h:109
clang::ObjCDeclSpec::getSetterName
IdentifierInfo * getSetterName()
Definition: DeclSpec.h:921
clang::DeclSpec::TST_wchar
static const TST TST_wchar
Definition: DeclSpec.h:264
clang::CXXScopeSpec::isEmpty
bool isEmpty() const
No scope specifier.
Definition: DeclSpec.h:191
clang::DeclSpec::addAttributes
void addAttributes(const ParsedAttributesView &AL)
Concatenates two attribute lists.
Definition: DeclSpec.h:812
clang::DeclSpec::TypeRep
UnionParsedType TypeRep
Definition: DeclSpec.h:371
clang::Declarator::getAttributes
const ParsedAttributes & getAttributes() const
Definition: DeclSpec.h:2588
DeclObjCCommon.h
clang::UnqualifiedId::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
Return the source range that covers this unqualified-id.
Definition: DeclSpec.h:1182
clang::TST_Fract
@ TST_Fract
Definition: Specifiers.h:66
clang::CXXScopeSpec::getRange
SourceRange getRange() const
Definition: DeclSpec.h:70
Token.h
clang::DeclSpec::SetRangeEnd
void SetRangeEnd(SourceLocation Loc)
Definition: DeclSpec.h:659
clang::UnqualifiedId::isInvalid
bool isInvalid() const
Determine whether this unqualified-id refers to an invalid name.
Definition: DeclSpec.h:1052
clang::transformer::name
RangeSelector name(std::string ID)
Given a node with a "name", (like NamedDecl, DeclRefExpr, CxxCtorInitializer, and TypeLoc) selects th...
Definition: RangeSelector.cpp:200
clang::VirtSpecifiers::SetSpecifier
bool SetSpecifier(Specifier VS, SourceLocation Loc, const char *&PrevSpec)
Definition: DeclSpec.cpp:1473
clang::DeclaratorChunk::getArray
static DeclaratorChunk getArray(unsigned TypeQuals, bool isStatic, bool isStar, Expr *NumElts, SourceLocation LBLoc, SourceLocation RBLoc)
Return a DeclaratorChunk for an array.
Definition: DeclSpec.h:1631
clang::Declarator::hasAttributes
bool hasAttributes() const
hasAttributes - do we contain any attributes?
Definition: DeclSpec.h:2596
clang::UnqualifiedIdKind::IK_ImplicitSelfParam
@ IK_ImplicitSelfParam
An implicit 'self' parameter.
ParsedAttr.h
clang::CXXScopeSpec::getBeginLoc
SourceLocation getBeginLoc() const
Definition: DeclSpec.h:74
clang::Declarator::AddInnermostTypeInfo
void AddInnermostTypeInfo(const DeclaratorChunk &TI)
Add a new innermost chunk to this declarator.
Definition: DeclSpec.h:2294
clang::DeclaratorChunk::ParamInfo::DefaultArgTokens
std::unique_ptr< CachedTokens > DefaultArgTokens
DefaultArgTokens - When the parameter's default argument cannot be parsed immediately (because it occ...
Definition: DeclSpec.h:1284
clang::DeclaratorChunk::FunctionTypeInfo::getRestrictQualifierLoc
SourceLocation getRestrictQualifierLoc() const
Retrieve the location of the 'restrict' qualifier.
Definition: DeclSpec.h:1479
clang::DeclSpec::getConstexprSpecLoc
SourceLocation getConstexprSpecLoc() const
Definition: DeclSpec.h:781
clang::IdentifierLoc
Wraps an identifier and optional source location for the identifier.
Definition: ParsedAttr.h:211
clang::DeclSpec::TSCS__Thread_local
static const TSCS TSCS__Thread_local
Definition: DeclSpec.h:251
clang::TST_decltype_auto
@ TST_decltype_auto
Definition: Specifiers.h:90
clang::DeclSpec::TST_auto
static const TST TST_auto
Definition: DeclSpec.h:299
clang::CachedTokens
SmallVector< Token, 4 > CachedTokens
A set of tokens that has been cached for later parsing.
Definition: DeclSpec.h:1190
clang::Declarator::setEllipsisLoc
void setEllipsisLoc(SourceLocation EL)
Definition: DeclSpec.h:2640
clang::TST_union
@ TST_union
Definition: Specifiers.h:77
clang::TST_double
@ TST_double
Definition: Specifiers.h:69
clang::TSCS_unspecified
@ TSCS_unspecified
Definition: Specifiers.h:224
clang::DeclSpec::TST_char16
static const TST TST_char16
Definition: DeclSpec.h:266
clang::NamespaceDecl
Represent a C++ namespace.
Definition: Decl.h:542
clang::ObjCDeclSpec::DQ_Byref
@ DQ_Byref
Definition: DeclSpec.h:859
clang::DeclaratorChunk::FunctionTypeInfo::NumExceptionsOrDecls
unsigned NumExceptionsOrDecls
NumExceptionsOrDecls - This is the number of types in the dynamic-exception-decl, if the function has...
Definition: DeclSpec.h:1343
clang::DeclaratorChunk::PipeInfo
PipeTypeInfo PipeInfo
Definition: DeclSpec.h:1578
clang::DeclaratorChunk::ParamInfo::Ident
IdentifierInfo * Ident
Definition: DeclSpec.h:1275
clang::DeclSpec::getAttributePool
AttributePool & getAttributePool() const
Definition: DeclSpec.h:791
clang::DeclSpec::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: DeclSpec.h:526
clang::DeclSpec::UpdateDeclRep
void UpdateDeclRep(Decl *Rep)
Definition: DeclSpec.h:731
clang::DeclSpec::SetTypeSpecWidth
bool SetTypeSpecWidth(TypeSpecifierWidth W, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
These methods set the specified attribute of the DeclSpec, but return true and ignore the request if ...
Definition: DeclSpec.cpp:702
clang::diag::kind
unsigned kind
All of the diagnostics that can be emitted by the frontend.
Definition: DiagnosticIDs.h:62
clang::UnqualifiedId::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: DeclSpec.h:1186
clang::Declarator::isObjCIvar
bool isObjCIvar() const
Definition: DeclSpec.h:2621
clang::VirtSpecifiers::getFirstLocation
SourceLocation getFirstLocation() const
Definition: DeclSpec.h:2718
clang::UnqualifiedId::getKind
UnqualifiedIdKind getKind() const
Determine what kind of name we have.
Definition: DeclSpec.h:1055
clang::Declarator::isFirstDeclarator
bool isFirstDeclarator() const
Definition: DeclSpec.h:2634
clang::CXXScopeSpec::isNotEmpty
bool isNotEmpty() const
A scope specifier is present, but may be valid or invalid.
Definition: DeclSpec.h:193
clang::DeclSpec::SetTypeSpecType
bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
Definition: DeclSpec.cpp:832
clang::Declarator::getInnermostNonParenChunk
const DeclaratorChunk * getInnermostNonParenChunk() const
Return the innermost (closest to the declarator) chunk of this declarator that is not a parens chunk,...
Definition: DeclSpec.h:2329
clang::DeclaratorContext::AliasDecl
@ AliasDecl
clang::DeclSpec::getAtomicSpecLoc
SourceLocation getAtomicSpecLoc() const
Definition: DeclSpec.h:571
clang::WrittenBuiltinSpecs
Structure that packs information about the type specifiers that were written in a particular type spe...
Definition: Specifiers.h:101
clang::DeclSpec::isTypeSpecSat
bool isTypeSpecSat() const
Definition: DeclSpec.h:502
clang::DeclSpec
Captures information about "declaration specifiers".
Definition: DeclSpec.h:230
clang::DeclaratorChunk::PointerTypeInfo::AtomicQualLoc
SourceLocation AtomicQualLoc
The location of the _Atomic-qualifier, if any.
Definition: DeclSpec.h:1230
clang::DeclSpec::getTypeSpecScope
CXXScopeSpec & getTypeSpecScope()
Definition: DeclSpec.h:522
clang::Declarator::isRedeclaration
bool isRedeclaration() const
Definition: DeclSpec.h:2672
clang::DeclSpec::SCS_extern
@ SCS_extern
Definition: DeclSpec.h:237
clang::LambdaIntroducer::LambdaCapture::InitKind
LambdaCaptureInitKind InitKind
Definition: DeclSpec.h:2746
clang::DeclSpec::TSCS_thread_local
static const TSCS TSCS_thread_local
Definition: DeclSpec.h:250
clang::DeclSpec::getRepAsType
ParsedType getRepAsType() const
Definition: DeclSpec.h:505
clang::Declarator::isExpressionContext
bool isExpressionContext() const
Determine whether this declaration appears in a context where an expression could appear.
Definition: DeclSpec.h:2457
clang::UnqualifiedIdKind::IK_ConstructorTemplateId
@ IK_ConstructorTemplateId
A constructor named via a template-id.
clang::VirtSpecifiers
Represents a C++11 virt-specifier-seq.
Definition: DeclSpec.h:2687
clang::UnqualifiedId::setImplicitSelfParam
void setImplicitSelfParam(const IdentifierInfo *Id)
Specify that this unqualified-id is an implicit 'self' parameter.
Definition: DeclSpec.h:1175
clang::DeclaratorChunk::Kind
enum clang::DeclaratorChunk::@212 Kind
clang::LambdaIntroducer::Range
SourceRange Range
Definition: DeclSpec.h:2761
clang::CXXScopeSpec::isInvalid
bool isInvalid() const
An error occurred during parsing of the scope specifier.
Definition: DeclSpec.h:196
clang::DeclaratorChunk::PipeTypeInfo
Definition: DeclSpec.h:1564
clang::Declarator::getMutableDeclSpec
DeclSpec & getMutableDeclSpec()
getMutableDeclSpec - Return a non-const version of the DeclSpec.
Definition: DeclSpec.h:1976
clang::DeclaratorChunk::Pipe
@ Pipe
Definition: DeclSpec.h:1200
clang::TypeSpecifierType
TypeSpecifierType
Specifies the kind of type.
Definition: Specifiers.h:52
clang::ConstexprSpecKind::Unspecified
@ Unspecified
clang::DeclSpec::SetTypeAltiVecBool
bool SetTypeAltiVecBool(bool isAltiVecBool, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
Definition: DeclSpec.cpp:918
clang::DeclSpec::TemplateIdRep
TemplateIdAnnotation * TemplateIdRep
Definition: DeclSpec.h:374
clang::DeclaratorChunk::FunctionTypeInfo::getExceptionSpecLocBeg
SourceLocation getExceptionSpecLocBeg() const
Definition: DeclSpec.h:1451
clang::DeclSpec::PQ_StorageClassSpecifier
@ PQ_StorageClassSpecifier
Definition: DeclSpec.h:324
clang::DeclSpec::getThreadStorageClassSpec
TSCS getThreadStorageClassSpec() const
Definition: DeclSpec.h:460