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