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