clang  14.0.0git
DeclSpec.cpp
Go to the documentation of this file.
1 //===--- DeclSpec.cpp - Declaration Specifier Semantic Analysis -----------===//
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 // This file implements semantic analysis for declaration specifiers.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "clang/Sema/DeclSpec.h"
14 #include "clang/AST/ASTContext.h"
15 #include "clang/AST/DeclCXX.h"
16 #include "clang/AST/Expr.h"
17 #include "clang/AST/LocInfoType.h"
18 #include "clang/AST/TypeLoc.h"
21 #include "clang/Basic/TargetInfo.h"
23 #include "clang/Sema/Sema.h"
25 #include "llvm/ADT/STLExtras.h"
26 #include "llvm/ADT/SmallString.h"
27 #include <cstring>
28 using namespace clang;
29 
30 
32  assert(TemplateId && "NULL template-id annotation?");
33  assert(!TemplateId->isInvalid() &&
34  "should not convert invalid template-ids to unqualified-ids");
35 
37  this->TemplateId = TemplateId;
40 }
41 
43  assert(TemplateId && "NULL template-id annotation?");
44  assert(!TemplateId->isInvalid() &&
45  "should not convert invalid template-ids to unqualified-ids");
46 
48  this->TemplateId = TemplateId;
51 }
52 
53 void CXXScopeSpec::Extend(ASTContext &Context, SourceLocation TemplateKWLoc,
54  TypeLoc TL, SourceLocation ColonColonLoc) {
55  Builder.Extend(Context, TemplateKWLoc, TL, ColonColonLoc);
56  if (Range.getBegin().isInvalid())
57  Range.setBegin(TL.getBeginLoc());
58  Range.setEnd(ColonColonLoc);
59 
60  assert(Range == Builder.getSourceRange() &&
61  "NestedNameSpecifierLoc range computation incorrect");
62 }
63 
66  SourceLocation ColonColonLoc) {
67  Builder.Extend(Context, Identifier, IdentifierLoc, ColonColonLoc);
68 
69  if (Range.getBegin().isInvalid())
70  Range.setBegin(IdentifierLoc);
71  Range.setEnd(ColonColonLoc);
72 
73  assert(Range == Builder.getSourceRange() &&
74  "NestedNameSpecifierLoc range computation incorrect");
75 }
76 
77 void CXXScopeSpec::Extend(ASTContext &Context, NamespaceDecl *Namespace,
78  SourceLocation NamespaceLoc,
79  SourceLocation ColonColonLoc) {
80  Builder.Extend(Context, Namespace, NamespaceLoc, ColonColonLoc);
81 
82  if (Range.getBegin().isInvalid())
83  Range.setBegin(NamespaceLoc);
84  Range.setEnd(ColonColonLoc);
85 
86  assert(Range == Builder.getSourceRange() &&
87  "NestedNameSpecifierLoc range computation incorrect");
88 }
89 
91  SourceLocation AliasLoc,
92  SourceLocation ColonColonLoc) {
93  Builder.Extend(Context, Alias, AliasLoc, ColonColonLoc);
94 
95  if (Range.getBegin().isInvalid())
96  Range.setBegin(AliasLoc);
97  Range.setEnd(ColonColonLoc);
98 
99  assert(Range == Builder.getSourceRange() &&
100  "NestedNameSpecifierLoc range computation incorrect");
101 }
102 
104  SourceLocation ColonColonLoc) {
105  Builder.MakeGlobal(Context, ColonColonLoc);
106 
107  Range = SourceRange(ColonColonLoc);
108 
109  assert(Range == Builder.getSourceRange() &&
110  "NestedNameSpecifierLoc range computation incorrect");
111 }
112 
114  SourceLocation SuperLoc,
115  SourceLocation ColonColonLoc) {
116  Builder.MakeSuper(Context, RD, SuperLoc, ColonColonLoc);
117 
118  Range.setBegin(SuperLoc);
119  Range.setEnd(ColonColonLoc);
120 
121  assert(Range == Builder.getSourceRange() &&
122  "NestedNameSpecifierLoc range computation incorrect");
123 }
124 
126  NestedNameSpecifier *Qualifier, SourceRange R) {
127  Builder.MakeTrivial(Context, Qualifier, R);
128  Range = R;
129 }
130 
132  if (!Other) {
133  Range = SourceRange();
134  Builder.Clear();
135  return;
136  }
137 
138  Range = Other.getSourceRange();
139  Builder.Adopt(Other);
140  assert(Range == Builder.getSourceRange() &&
141  "NestedNameSpecifierLoc range computation incorrect");
142 }
143 
145  if (!Builder.getRepresentation())
146  return SourceLocation();
147  return Builder.getTemporary().getLocalBeginLoc();
148 }
149 
152  if (!Builder.getRepresentation())
153  return NestedNameSpecifierLoc();
154 
155  return Builder.getWithLocInContext(Context);
156 }
157 
158 /// DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
159 /// "TheDeclarator" is the declarator that this will be added to.
161  bool isAmbiguous,
162  SourceLocation LParenLoc,
163  ParamInfo *Params,
164  unsigned NumParams,
165  SourceLocation EllipsisLoc,
166  SourceLocation RParenLoc,
167  bool RefQualifierIsLvalueRef,
168  SourceLocation RefQualifierLoc,
169  SourceLocation MutableLoc,
171  ESpecType,
172  SourceRange ESpecRange,
173  ParsedType *Exceptions,
174  SourceRange *ExceptionRanges,
175  unsigned NumExceptions,
176  Expr *NoexceptExpr,
177  CachedTokens *ExceptionSpecTokens,
179  DeclsInPrototype,
180  SourceLocation LocalRangeBegin,
181  SourceLocation LocalRangeEnd,
182  Declarator &TheDeclarator,
183  TypeResult TrailingReturnType,
185  TrailingReturnTypeLoc,
186  DeclSpec *MethodQualifiers) {
187  assert(!(MethodQualifiers && MethodQualifiers->getTypeQualifiers() & DeclSpec::TQ_atomic) &&
188  "function cannot have _Atomic qualifier");
189 
190  DeclaratorChunk I;
191  I.Kind = Function;
192  I.Loc = LocalRangeBegin;
193  I.EndLoc = LocalRangeEnd;
194  new (&I.Fun) FunctionTypeInfo;
195  I.Fun.hasPrototype = hasProto;
196  I.Fun.isVariadic = EllipsisLoc.isValid();
197  I.Fun.isAmbiguous = isAmbiguous;
198  I.Fun.LParenLoc = LParenLoc;
199  I.Fun.EllipsisLoc = EllipsisLoc;
200  I.Fun.RParenLoc = RParenLoc;
201  I.Fun.DeleteParams = false;
202  I.Fun.NumParams = NumParams;
203  I.Fun.Params = nullptr;
204  I.Fun.RefQualifierIsLValueRef = RefQualifierIsLvalueRef;
205  I.Fun.RefQualifierLoc = RefQualifierLoc;
206  I.Fun.MutableLoc = MutableLoc;
207  I.Fun.ExceptionSpecType = ESpecType;
208  I.Fun.ExceptionSpecLocBeg = ESpecRange.getBegin();
209  I.Fun.ExceptionSpecLocEnd = ESpecRange.getEnd();
211  I.Fun.Exceptions = nullptr;
212  I.Fun.NoexceptExpr = nullptr;
213  I.Fun.HasTrailingReturnType = TrailingReturnType.isUsable() ||
214  TrailingReturnType.isInvalid();
215  I.Fun.TrailingReturnType = TrailingReturnType.get();
216  I.Fun.TrailingReturnTypeLoc = TrailingReturnTypeLoc;
217  I.Fun.MethodQualifiers = nullptr;
218  I.Fun.QualAttrFactory = nullptr;
219 
220  if (MethodQualifiers && (MethodQualifiers->getTypeQualifiers() ||
221  MethodQualifiers->getAttributes().size())) {
222  auto &attrs = MethodQualifiers->getAttributes();
223  I.Fun.MethodQualifiers = new DeclSpec(attrs.getPool().getFactory());
224  MethodQualifiers->forEachCVRUQualifier(
225  [&](DeclSpec::TQ TypeQual, StringRef PrintName, SourceLocation SL) {
226  I.Fun.MethodQualifiers->SetTypeQual(TypeQual, SL);
227  });
229  I.Fun.MethodQualifiers->getAttributePool().takeAllFrom(attrs.getPool());
230  }
231 
232  assert(I.Fun.ExceptionSpecType == ESpecType && "bitfield overflow");
233 
234  // new[] a parameter array if needed.
235  if (NumParams) {
236  // If the 'InlineParams' in Declarator is unused and big enough, put our
237  // parameter list there (in an effort to avoid new/delete traffic). If it
238  // is already used (consider a function returning a function pointer) or too
239  // small (function with too many parameters), go to the heap.
240  if (!TheDeclarator.InlineStorageUsed &&
241  NumParams <= llvm::array_lengthof(TheDeclarator.InlineParams)) {
242  I.Fun.Params = TheDeclarator.InlineParams;
243  new (I.Fun.Params) ParamInfo[NumParams];
244  I.Fun.DeleteParams = false;
245  TheDeclarator.InlineStorageUsed = true;
246  } else {
247  I.Fun.Params = new DeclaratorChunk::ParamInfo[NumParams];
248  I.Fun.DeleteParams = true;
249  }
250  for (unsigned i = 0; i < NumParams; i++)
251  I.Fun.Params[i] = std::move(Params[i]);
252  }
253 
254  // Check what exception specification information we should actually store.
255  switch (ESpecType) {
256  default: break; // By default, save nothing.
257  case EST_Dynamic:
258  // new[] an exception array if needed
259  if (NumExceptions) {
260  I.Fun.NumExceptionsOrDecls = NumExceptions;
261  I.Fun.Exceptions = new DeclaratorChunk::TypeAndRange[NumExceptions];
262  for (unsigned i = 0; i != NumExceptions; ++i) {
263  I.Fun.Exceptions[i].Ty = Exceptions[i];
264  I.Fun.Exceptions[i].Range = ExceptionRanges[i];
265  }
266  }
267  break;
268 
270  case EST_NoexceptFalse:
271  case EST_NoexceptTrue:
272  I.Fun.NoexceptExpr = NoexceptExpr;
273  break;
274 
275  case EST_Unparsed:
276  I.Fun.ExceptionSpecTokens = ExceptionSpecTokens;
277  break;
278  }
279 
280  if (!DeclsInPrototype.empty()) {
281  assert(ESpecType == EST_None && NumExceptions == 0 &&
282  "cannot have exception specifiers and decls in prototype");
283  I.Fun.NumExceptionsOrDecls = DeclsInPrototype.size();
284  // Copy the array of decls into stable heap storage.
285  I.Fun.DeclsInPrototype = new NamedDecl *[DeclsInPrototype.size()];
286  for (size_t J = 0; J < DeclsInPrototype.size(); ++J)
287  I.Fun.DeclsInPrototype[J] = DeclsInPrototype[J];
288  }
289 
290  return I;
291 }
292 
294  SourceLocation LSquareLoc,
296  SourceLocation RSquareLoc) {
297  assert(!hasName() && "declarator given multiple names!");
298 
299  BindingGroup.LSquareLoc = LSquareLoc;
300  BindingGroup.RSquareLoc = RSquareLoc;
301  BindingGroup.NumBindings = Bindings.size();
302  Range.setEnd(RSquareLoc);
303 
304  // We're now past the identifier.
305  SetIdentifier(nullptr, LSquareLoc);
306  Name.EndLocation = RSquareLoc;
307 
308  // Allocate storage for bindings and stash them away.
309  if (Bindings.size()) {
310  if (!InlineStorageUsed &&
311  Bindings.size() <= llvm::array_lengthof(InlineBindings)) {
312  BindingGroup.Bindings = InlineBindings;
313  BindingGroup.DeleteBindings = false;
314  InlineStorageUsed = true;
315  } else {
316  BindingGroup.Bindings =
318  BindingGroup.DeleteBindings = true;
319  }
320  std::uninitialized_copy(Bindings.begin(), Bindings.end(),
321  BindingGroup.Bindings);
322  }
323 }
324 
326  for (unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
327  switch (DeclTypeInfo[i].Kind) {
329  return true;
331  continue;
338  return false;
339  }
340  llvm_unreachable("Invalid type chunk");
341  }
342 
343  switch (DS.getTypeSpecType()) {
344  case TST_atomic:
345  case TST_auto:
346  case TST_auto_type:
347  case TST_bool:
348  case TST_char:
349  case TST_char8:
350  case TST_char16:
351  case TST_char32:
352  case TST_class:
353  case TST_decimal128:
354  case TST_decimal32:
355  case TST_decimal64:
356  case TST_double:
357  case TST_Accum:
358  case TST_Fract:
359  case TST_Float16:
360  case TST_float128:
361  case TST_ibm128:
362  case TST_enum:
363  case TST_error:
364  case TST_float:
365  case TST_half:
366  case TST_int:
367  case TST_int128:
368  case TST_extint:
369  case TST_struct:
370  case TST_interface:
371  case TST_union:
372  case TST_unknown_anytype:
373  case TST_unspecified:
374  case TST_void:
375  case TST_wchar:
376  case TST_BFloat16:
377 #define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t:
378 #include "clang/Basic/OpenCLImageTypes.def"
379  return false;
380 
381  case TST_decltype_auto:
382  // This must have an initializer, so can't be a function declaration,
383  // even if the initializer has function type.
384  return false;
385 
386  case TST_decltype:
387  case TST_typeofExpr:
388  if (Expr *E = DS.getRepAsExpr())
389  return E->getType()->isFunctionType();
390  return false;
391 
392  case TST_underlyingType:
393  case TST_typename:
394  case TST_typeofType: {
395  QualType QT = DS.getRepAsType().get();
396  if (QT.isNull())
397  return false;
398 
399  if (const LocInfoType *LIT = dyn_cast<LocInfoType>(QT))
400  QT = LIT->getType();
401 
402  if (QT.isNull())
403  return false;
404 
405  return QT->isFunctionType();
406  }
407  }
408 
409  llvm_unreachable("Invalid TypeSpecType!");
410 }
411 
417  getName().OperatorFunctionId.Operator));
418 }
419 
423 }
424 
426  llvm::function_ref<void(TQ, StringRef, SourceLocation)> Handle) {
427  if (TypeQualifiers & TQ_const)
428  Handle(TQ_const, "const", TQ_constLoc);
429  if (TypeQualifiers & TQ_volatile)
430  Handle(TQ_volatile, "volatile", TQ_volatileLoc);
431  if (TypeQualifiers & TQ_restrict)
432  Handle(TQ_restrict, "restrict", TQ_restrictLoc);
433  if (TypeQualifiers & TQ_unaligned)
434  Handle(TQ_unaligned, "unaligned", TQ_unalignedLoc);
435 }
436 
438  llvm::function_ref<void(TQ, StringRef, SourceLocation)> Handle) {
439  forEachCVRUQualifier(Handle);
440  // FIXME: Add code below to iterate through the attributes and call Handle.
441 }
442 
444  if (!TypeSpecOwned)
445  return false;
446  return cast<TagDecl>(getRepAsDecl())->isCompleteDefinition();
447 }
448 
449 /// getParsedSpecifiers - Return a bitmask of which flavors of specifiers this
450 /// declaration specifier includes.
451 ///
453  unsigned Res = 0;
454  if (StorageClassSpec != SCS_unspecified ||
455  ThreadStorageClassSpec != TSCS_unspecified)
457 
458  if (TypeQualifiers != TQ_unspecified)
459  Res |= PQ_TypeQualifier;
460 
461  if (hasTypeSpecifier())
462  Res |= PQ_TypeSpecifier;
463 
464  if (FS_inline_specified || FS_virtual_specified || hasExplicitSpecifier() ||
465  FS_noreturn_specified || FS_forceinline_specified)
466  Res |= PQ_FunctionSpecifier;
467  return Res;
468 }
469 
470 template <class T> static bool BadSpecifier(T TNew, T TPrev,
471  const char *&PrevSpec,
472  unsigned &DiagID,
473  bool IsExtension = true) {
474  PrevSpec = DeclSpec::getSpecifierName(TPrev);
475  if (TNew != TPrev)
476  DiagID = diag::err_invalid_decl_spec_combination;
477  else
478  DiagID = IsExtension ? diag::ext_warn_duplicate_declspec :
479  diag::warn_duplicate_declspec;
480  return true;
481 }
482 
484  switch (S) {
485  case DeclSpec::SCS_unspecified: return "unspecified";
486  case DeclSpec::SCS_typedef: return "typedef";
487  case DeclSpec::SCS_extern: return "extern";
488  case DeclSpec::SCS_static: return "static";
489  case DeclSpec::SCS_auto: return "auto";
490  case DeclSpec::SCS_register: return "register";
491  case DeclSpec::SCS_private_extern: return "__private_extern__";
492  case DeclSpec::SCS_mutable: return "mutable";
493  }
494  llvm_unreachable("Unknown typespec!");
495 }
496 
498  switch (S) {
499  case DeclSpec::TSCS_unspecified: return "unspecified";
500  case DeclSpec::TSCS___thread: return "__thread";
501  case DeclSpec::TSCS_thread_local: return "thread_local";
502  case DeclSpec::TSCS__Thread_local: return "_Thread_local";
503  }
504  llvm_unreachable("Unknown typespec!");
505 }
506 
508  switch (W) {
510  return "unspecified";
512  return "short";
514  return "long";
516  return "long long";
517  }
518  llvm_unreachable("Unknown typespec!");
519 }
520 
522  switch (C) {
523  case TSC_unspecified: return "unspecified";
524  case TSC_imaginary: return "imaginary";
525  case TSC_complex: return "complex";
526  }
527  llvm_unreachable("Unknown typespec!");
528 }
529 
531  switch (S) {
533  return "unspecified";
535  return "signed";
537  return "unsigned";
538  }
539  llvm_unreachable("Unknown typespec!");
540 }
541 
543  const PrintingPolicy &Policy) {
544  switch (T) {
545  case DeclSpec::TST_unspecified: return "unspecified";
546  case DeclSpec::TST_void: return "void";
547  case DeclSpec::TST_char: return "char";
548  case DeclSpec::TST_wchar: return Policy.MSWChar ? "__wchar_t" : "wchar_t";
549  case DeclSpec::TST_char8: return "char8_t";
550  case DeclSpec::TST_char16: return "char16_t";
551  case DeclSpec::TST_char32: return "char32_t";
552  case DeclSpec::TST_int: return "int";
553  case DeclSpec::TST_int128: return "__int128";
554  case DeclSpec::TST_extint: return "_ExtInt";
555  case DeclSpec::TST_half: return "half";
556  case DeclSpec::TST_float: return "float";
557  case DeclSpec::TST_double: return "double";
558  case DeclSpec::TST_accum: return "_Accum";
559  case DeclSpec::TST_fract: return "_Fract";
560  case DeclSpec::TST_float16: return "_Float16";
561  case DeclSpec::TST_float128: return "__float128";
562  case DeclSpec::TST_ibm128: return "__ibm128";
563  case DeclSpec::TST_bool: return Policy.Bool ? "bool" : "_Bool";
564  case DeclSpec::TST_decimal32: return "_Decimal32";
565  case DeclSpec::TST_decimal64: return "_Decimal64";
566  case DeclSpec::TST_decimal128: return "_Decimal128";
567  case DeclSpec::TST_enum: return "enum";
568  case DeclSpec::TST_class: return "class";
569  case DeclSpec::TST_union: return "union";
570  case DeclSpec::TST_struct: return "struct";
571  case DeclSpec::TST_interface: return "__interface";
572  case DeclSpec::TST_typename: return "type-name";
574  case DeclSpec::TST_typeofExpr: return "typeof";
575  case DeclSpec::TST_auto: return "auto";
576  case DeclSpec::TST_auto_type: return "__auto_type";
577  case DeclSpec::TST_decltype: return "(decltype)";
578  case DeclSpec::TST_decltype_auto: return "decltype(auto)";
579  case DeclSpec::TST_underlyingType: return "__underlying_type";
580  case DeclSpec::TST_unknown_anytype: return "__unknown_anytype";
581  case DeclSpec::TST_atomic: return "_Atomic";
582  case DeclSpec::TST_BFloat16: return "__bf16";
583 #define GENERIC_IMAGE_TYPE(ImgType, Id) \
584  case DeclSpec::TST_##ImgType##_t: \
585  return #ImgType "_t";
586 #include "clang/Basic/OpenCLImageTypes.def"
587  case DeclSpec::TST_error: return "(error)";
588  }
589  llvm_unreachable("Unknown typespec!");
590 }
591 
593  switch (C) {
595  return "unspecified";
597  return "constexpr";
599  return "consteval";
601  return "constinit";
602  }
603  llvm_unreachable("Unknown ConstexprSpecKind");
604 }
605 
607  switch (T) {
608  case DeclSpec::TQ_unspecified: return "unspecified";
609  case DeclSpec::TQ_const: return "const";
610  case DeclSpec::TQ_restrict: return "restrict";
611  case DeclSpec::TQ_volatile: return "volatile";
612  case DeclSpec::TQ_atomic: return "_Atomic";
613  case DeclSpec::TQ_unaligned: return "__unaligned";
614  }
615  llvm_unreachable("Unknown typespec!");
616 }
617 
619  const char *&PrevSpec,
620  unsigned &DiagID,
621  const PrintingPolicy &Policy) {
622  // OpenCL v1.1 s6.8g: "The extern, static, auto and register storage-class
623  // specifiers are not supported.
624  // It seems sensible to prohibit private_extern too
625  // The cl_clang_storage_class_specifiers extension enables support for
626  // these storage-class specifiers.
627  // OpenCL v1.2 s6.8 changes this to "The auto and register storage-class
628  // specifiers are not supported."
629  if (S.getLangOpts().OpenCL &&
631  "cl_clang_storage_class_specifiers", S.getLangOpts())) {
632  switch (SC) {
633  case SCS_extern:
634  case SCS_private_extern:
635  case SCS_static:
636  if (S.getLangOpts().getOpenCLCompatibleVersion() < 120) {
637  DiagID = diag::err_opencl_unknown_type_specifier;
638  PrevSpec = getSpecifierName(SC);
639  return true;
640  }
641  break;
642  case SCS_auto:
643  case SCS_register:
644  DiagID = diag::err_opencl_unknown_type_specifier;
645  PrevSpec = getSpecifierName(SC);
646  return true;
647  default:
648  break;
649  }
650  }
651 
652  if (StorageClassSpec != SCS_unspecified) {
653  // Maybe this is an attempt to use C++11 'auto' outside of C++11 mode.
654  bool isInvalid = true;
655  if (TypeSpecType == TST_unspecified && S.getLangOpts().CPlusPlus) {
656  if (SC == SCS_auto)
657  return SetTypeSpecType(TST_auto, Loc, PrevSpec, DiagID, Policy);
658  if (StorageClassSpec == SCS_auto) {
659  isInvalid = SetTypeSpecType(TST_auto, StorageClassSpecLoc,
660  PrevSpec, DiagID, Policy);
661  assert(!isInvalid && "auto SCS -> TST recovery failed");
662  }
663  }
664 
665  // Changing storage class is allowed only if the previous one
666  // was the 'extern' that is part of a linkage specification and
667  // the new storage class is 'typedef'.
668  if (isInvalid &&
669  !(SCS_extern_in_linkage_spec &&
670  StorageClassSpec == SCS_extern &&
671  SC == SCS_typedef))
672  return BadSpecifier(SC, (SCS)StorageClassSpec, PrevSpec, DiagID);
673  }
674  StorageClassSpec = SC;
675  StorageClassSpecLoc = Loc;
676  assert((unsigned)SC == StorageClassSpec && "SCS constants overflow bitfield");
677  return false;
678 }
679 
681  const char *&PrevSpec,
682  unsigned &DiagID) {
683  if (ThreadStorageClassSpec != TSCS_unspecified)
684  return BadSpecifier(TSC, (TSCS)ThreadStorageClassSpec, PrevSpec, DiagID);
685 
686  ThreadStorageClassSpec = TSC;
687  ThreadStorageClassSpecLoc = Loc;
688  return false;
689 }
690 
691 /// These methods set the specified attribute of the DeclSpec, but return true
692 /// and ignore the request if invalid (e.g. "extern" then "auto" is
693 /// specified).
695  const char *&PrevSpec, unsigned &DiagID,
696  const PrintingPolicy &Policy) {
697  // Overwrite TSWRange.Begin only if TypeSpecWidth was unspecified, so that
698  // for 'long long' we will keep the source location of the first 'long'.
700  TSWRange.setBegin(Loc);
701  // Allow turning long -> long long.
702  else if (W != TypeSpecifierWidth::LongLong ||
704  return BadSpecifier(W, getTypeSpecWidth(), PrevSpec, DiagID);
705  TypeSpecWidth = static_cast<unsigned>(W);
706  // Remember location of the last 'long'
707  TSWRange.setEnd(Loc);
708  return false;
709 }
710 
712  const char *&PrevSpec,
713  unsigned &DiagID) {
714  if (TypeSpecComplex != TSC_unspecified)
715  return BadSpecifier(C, (TSC)TypeSpecComplex, PrevSpec, DiagID);
716  TypeSpecComplex = C;
717  TSCLoc = Loc;
718  return false;
719 }
720 
722  const char *&PrevSpec, unsigned &DiagID) {
724  return BadSpecifier(S, getTypeSpecSign(), PrevSpec, DiagID);
725  TypeSpecSign = static_cast<unsigned>(S);
726  TSSLoc = Loc;
727  return false;
728 }
729 
731  const char *&PrevSpec,
732  unsigned &DiagID,
733  ParsedType Rep,
734  const PrintingPolicy &Policy) {
735  return SetTypeSpecType(T, Loc, Loc, PrevSpec, DiagID, Rep, Policy);
736 }
737 
739  SourceLocation TagNameLoc,
740  const char *&PrevSpec,
741  unsigned &DiagID,
742  ParsedType Rep,
743  const PrintingPolicy &Policy) {
744  assert(isTypeRep(T) && "T does not store a type");
745  assert(Rep && "no type provided!");
746  if (TypeSpecType == TST_error)
747  return false;
748  if (TypeSpecType != TST_unspecified) {
749  PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType, Policy);
750  DiagID = diag::err_invalid_decl_spec_combination;
751  return true;
752  }
753  TypeSpecType = T;
754  TypeRep = Rep;
755  TSTLoc = TagKwLoc;
756  TSTNameLoc = TagNameLoc;
757  TypeSpecOwned = false;
758  return false;
759 }
760 
762  const char *&PrevSpec,
763  unsigned &DiagID,
764  Expr *Rep,
765  const PrintingPolicy &Policy) {
766  assert(isExprRep(T) && "T does not store an expr");
767  assert(Rep && "no expression provided!");
768  if (TypeSpecType == TST_error)
769  return false;
770  if (TypeSpecType != TST_unspecified) {
771  PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType, Policy);
772  DiagID = diag::err_invalid_decl_spec_combination;
773  return true;
774  }
775  TypeSpecType = T;
776  ExprRep = Rep;
777  TSTLoc = Loc;
778  TSTNameLoc = Loc;
779  TypeSpecOwned = false;
780  return false;
781 }
782 
784  const char *&PrevSpec,
785  unsigned &DiagID,
786  Decl *Rep, bool Owned,
787  const PrintingPolicy &Policy) {
788  return SetTypeSpecType(T, Loc, Loc, PrevSpec, DiagID, Rep, Owned, Policy);
789 }
790 
792  SourceLocation TagNameLoc,
793  const char *&PrevSpec,
794  unsigned &DiagID,
795  Decl *Rep, bool Owned,
796  const PrintingPolicy &Policy) {
797  assert(isDeclRep(T) && "T does not store a decl");
798  // Unlike the other cases, we don't assert that we actually get a decl.
799 
800  if (TypeSpecType == TST_error)
801  return false;
802  if (TypeSpecType != TST_unspecified) {
803  PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType, Policy);
804  DiagID = diag::err_invalid_decl_spec_combination;
805  return true;
806  }
807  TypeSpecType = T;
808  DeclRep = Rep;
809  TSTLoc = TagKwLoc;
810  TSTNameLoc = TagNameLoc;
811  TypeSpecOwned = Owned && Rep != nullptr;
812  return false;
813 }
814 
815 bool DeclSpec::SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec,
816  unsigned &DiagID, TemplateIdAnnotation *Rep,
817  const PrintingPolicy &Policy) {
818  assert(T == TST_auto || T == TST_decltype_auto);
819  ConstrainedAuto = true;
820  TemplateIdRep = Rep;
821  return SetTypeSpecType(T, Loc, PrevSpec, DiagID, Policy);
822 }
823 
825  const char *&PrevSpec,
826  unsigned &DiagID,
827  const PrintingPolicy &Policy) {
828  assert(!isDeclRep(T) && !isTypeRep(T) && !isExprRep(T) &&
829  "rep required for these type-spec kinds!");
830  if (TypeSpecType == TST_error)
831  return false;
832  if (TypeSpecType != TST_unspecified) {
833  PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType, Policy);
834  DiagID = diag::err_invalid_decl_spec_combination;
835  return true;
836  }
837  TSTLoc = Loc;
838  TSTNameLoc = Loc;
839  if (TypeAltiVecVector && (T == TST_bool) && !TypeAltiVecBool) {
840  TypeAltiVecBool = true;
841  return false;
842  }
843  TypeSpecType = T;
844  TypeSpecOwned = false;
845  return false;
846 }
847 
848 bool DeclSpec::SetTypeSpecSat(SourceLocation Loc, const char *&PrevSpec,
849  unsigned &DiagID) {
850  // Cannot set twice
851  if (TypeSpecSat) {
852  DiagID = diag::warn_duplicate_declspec;
853  PrevSpec = "_Sat";
854  return true;
855  }
856  TypeSpecSat = true;
857  TSSatLoc = Loc;
858  return false;
859 }
860 
861 bool DeclSpec::SetTypeAltiVecVector(bool isAltiVecVector, SourceLocation Loc,
862  const char *&PrevSpec, unsigned &DiagID,
863  const PrintingPolicy &Policy) {
864  if (TypeSpecType == TST_error)
865  return false;
866  if (TypeSpecType != TST_unspecified) {
867  PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType, Policy);
868  DiagID = diag::err_invalid_vector_decl_spec_combination;
869  return true;
870  }
871  TypeAltiVecVector = isAltiVecVector;
872  AltiVecLoc = Loc;
873  return false;
874 }
875 
876 bool DeclSpec::SetTypePipe(bool isPipe, SourceLocation Loc,
877  const char *&PrevSpec, unsigned &DiagID,
878  const PrintingPolicy &Policy) {
879  if (TypeSpecType == TST_error)
880  return false;
881  if (TypeSpecType != TST_unspecified) {
882  PrevSpec = DeclSpec::getSpecifierName((TST)TypeSpecType, Policy);
883  DiagID = diag::err_invalid_decl_spec_combination;
884  return true;
885  }
886 
887  if (isPipe) {
888  TypeSpecPipe = static_cast<unsigned>(TypeSpecifiersPipe::Pipe);
889  }
890  return false;
891 }
892 
893 bool DeclSpec::SetTypeAltiVecPixel(bool isAltiVecPixel, SourceLocation Loc,
894  const char *&PrevSpec, unsigned &DiagID,
895  const PrintingPolicy &Policy) {
896  if (TypeSpecType == TST_error)
897  return false;
898  if (!TypeAltiVecVector || TypeAltiVecPixel ||
899  (TypeSpecType != TST_unspecified)) {
900  PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType, Policy);
901  DiagID = diag::err_invalid_pixel_decl_spec_combination;
902  return true;
903  }
904  TypeAltiVecPixel = isAltiVecPixel;
905  TSTLoc = Loc;
906  TSTNameLoc = Loc;
907  return false;
908 }
909 
910 bool DeclSpec::SetTypeAltiVecBool(bool isAltiVecBool, SourceLocation Loc,
911  const char *&PrevSpec, unsigned &DiagID,
912  const PrintingPolicy &Policy) {
913  if (TypeSpecType == TST_error)
914  return false;
915  if (!TypeAltiVecVector || TypeAltiVecBool ||
916  (TypeSpecType != TST_unspecified)) {
917  PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType, Policy);
918  DiagID = diag::err_invalid_vector_bool_decl_spec;
919  return true;
920  }
921  TypeAltiVecBool = isAltiVecBool;
922  TSTLoc = Loc;
923  TSTNameLoc = Loc;
924  return false;
925 }
926 
928  TypeSpecType = TST_error;
929  TypeSpecOwned = false;
930  TSTLoc = SourceLocation();
931  TSTNameLoc = SourceLocation();
932  return false;
933 }
934 
936  const char *&PrevSpec, unsigned &DiagID,
937  const PrintingPolicy &Policy) {
938  assert(BitsExpr && "no expression provided!");
939  if (TypeSpecType == TST_error)
940  return false;
941 
942  if (TypeSpecType != TST_unspecified) {
943  PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType, Policy);
944  DiagID = diag::err_invalid_decl_spec_combination;
945  return true;
946  }
947 
948  TypeSpecType = TST_extint;
949  ExprRep = BitsExpr;
950  TSTLoc = KWLoc;
951  TSTNameLoc = KWLoc;
952  TypeSpecOwned = false;
953  return false;
954 }
955 
956 bool DeclSpec::SetTypeQual(TQ T, SourceLocation Loc, const char *&PrevSpec,
957  unsigned &DiagID, const LangOptions &Lang) {
958  // Duplicates are permitted in C99 onwards, but are not permitted in C89 or
959  // C++. However, since this is likely not what the user intended, we will
960  // always warn. We do not need to set the qualifier's location since we
961  // already have it.
962  if (TypeQualifiers & T) {
963  bool IsExtension = true;
964  if (Lang.C99)
965  IsExtension = false;
966  return BadSpecifier(T, T, PrevSpec, DiagID, IsExtension);
967  }
968 
969  return SetTypeQual(T, Loc);
970 }
971 
973  TypeQualifiers |= T;
974 
975  switch (T) {
976  case TQ_unspecified: break;
977  case TQ_const: TQ_constLoc = Loc; return false;
978  case TQ_restrict: TQ_restrictLoc = Loc; return false;
979  case TQ_volatile: TQ_volatileLoc = Loc; return false;
980  case TQ_unaligned: TQ_unalignedLoc = Loc; return false;
981  case TQ_atomic: TQ_atomicLoc = Loc; return false;
982  }
983 
984  llvm_unreachable("Unknown type qualifier!");
985 }
986 
987 bool DeclSpec::setFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec,
988  unsigned &DiagID) {
989  // 'inline inline' is ok. However, since this is likely not what the user
990  // intended, we will always warn, similar to duplicates of type qualifiers.
991  if (FS_inline_specified) {
992  DiagID = diag::warn_duplicate_declspec;
993  PrevSpec = "inline";
994  return true;
995  }
996  FS_inline_specified = true;
997  FS_inlineLoc = Loc;
998  return false;
999 }
1000 
1002  unsigned &DiagID) {
1003  if (FS_forceinline_specified) {
1004  DiagID = diag::warn_duplicate_declspec;
1005  PrevSpec = "__forceinline";
1006  return true;
1007  }
1008  FS_forceinline_specified = true;
1009  FS_forceinlineLoc = Loc;
1010  return false;
1011 }
1012 
1014  const char *&PrevSpec,
1015  unsigned &DiagID) {
1016  // 'virtual virtual' is ok, but warn as this is likely not what the user
1017  // intended.
1018  if (FS_virtual_specified) {
1019  DiagID = diag::warn_duplicate_declspec;
1020  PrevSpec = "virtual";
1021  return true;
1022  }
1023  FS_virtual_specified = true;
1024  FS_virtualLoc = Loc;
1025  return false;
1026 }
1027 
1029  const char *&PrevSpec, unsigned &DiagID,
1030  ExplicitSpecifier ExplicitSpec,
1031  SourceLocation CloseParenLoc) {
1032  // 'explicit explicit' is ok, but warn as this is likely not what the user
1033  // intended.
1034  if (hasExplicitSpecifier()) {
1035  DiagID = (ExplicitSpec.getExpr() || FS_explicit_specifier.getExpr())
1036  ? diag::err_duplicate_declspec
1037  : diag::ext_warn_duplicate_declspec;
1038  PrevSpec = "explicit";
1039  return true;
1040  }
1041  FS_explicit_specifier = ExplicitSpec;
1042  FS_explicitLoc = Loc;
1043  FS_explicitCloseParenLoc = CloseParenLoc;
1044  return false;
1045 }
1046 
1048  const char *&PrevSpec,
1049  unsigned &DiagID) {
1050  // '_Noreturn _Noreturn' is ok, but warn as this is likely not what the user
1051  // intended.
1052  if (FS_noreturn_specified) {
1053  DiagID = diag::warn_duplicate_declspec;
1054  PrevSpec = "_Noreturn";
1055  return true;
1056  }
1057  FS_noreturn_specified = true;
1058  FS_noreturnLoc = Loc;
1059  return false;
1060 }
1061 
1062 bool DeclSpec::SetFriendSpec(SourceLocation Loc, const char *&PrevSpec,
1063  unsigned &DiagID) {
1064  if (Friend_specified) {
1065  PrevSpec = "friend";
1066  // Keep the later location, so that we can later diagnose ill-formed
1067  // declarations like 'friend class X friend;'. Per [class.friend]p3,
1068  // 'friend' must be the first token in a friend declaration that is
1069  // not a function declaration.
1070  FriendLoc = Loc;
1071  DiagID = diag::warn_duplicate_declspec;
1072  return true;
1073  }
1074 
1075  Friend_specified = true;
1076  FriendLoc = Loc;
1077  return false;
1078 }
1079 
1080 bool DeclSpec::setModulePrivateSpec(SourceLocation Loc, const char *&PrevSpec,
1081  unsigned &DiagID) {
1082  if (isModulePrivateSpecified()) {
1083  PrevSpec = "__module_private__";
1084  DiagID = diag::ext_warn_duplicate_declspec;
1085  return true;
1086  }
1087 
1088  ModulePrivateLoc = Loc;
1089  return false;
1090 }
1091 
1093  SourceLocation Loc, const char *&PrevSpec,
1094  unsigned &DiagID) {
1096  return BadSpecifier(ConstexprKind, getConstexprSpecifier(), PrevSpec,
1097  DiagID);
1098  ConstexprSpecifier = static_cast<unsigned>(ConstexprKind);
1099  ConstexprLoc = Loc;
1100  return false;
1101 }
1102 
1103 void DeclSpec::SaveWrittenBuiltinSpecs() {
1104  writtenBS.Sign = static_cast<int>(getTypeSpecSign());
1105  writtenBS.Width = static_cast<int>(getTypeSpecWidth());
1106  writtenBS.Type = getTypeSpecType();
1107  // Search the list of attributes for the presence of a mode attribute.
1108  writtenBS.ModeAttr = getAttributes().hasAttribute(ParsedAttr::AT_Mode);
1109 }
1110 
1111 /// Finish - This does final analysis of the declspec, rejecting things like
1112 /// "_Imaginary" (lacking an FP type). This returns a diagnostic to issue or
1113 /// diag::NUM_DIAGNOSTICS if there is no error. After calling this method,
1114 /// DeclSpec is guaranteed self-consistent, even if an error occurred.
1115 void DeclSpec::Finish(Sema &S, const PrintingPolicy &Policy) {
1116  // Before possibly changing their values, save specs as written.
1117  SaveWrittenBuiltinSpecs();
1118 
1119  // Check the type specifier components first. No checking for an invalid
1120  // type.
1121  if (TypeSpecType == TST_error)
1122  return;
1123 
1124  // If decltype(auto) is used, no other type specifiers are permitted.
1125  if (TypeSpecType == TST_decltype_auto &&
1127  TypeSpecComplex != TSC_unspecified ||
1129  TypeAltiVecVector || TypeAltiVecPixel || TypeAltiVecBool ||
1130  TypeQualifiers)) {
1131  const unsigned NumLocs = 9;
1132  SourceLocation ExtraLocs[NumLocs] = {
1133  TSWRange.getBegin(), TSCLoc, TSSLoc,
1134  AltiVecLoc, TQ_constLoc, TQ_restrictLoc,
1135  TQ_volatileLoc, TQ_atomicLoc, TQ_unalignedLoc};
1136  FixItHint Hints[NumLocs];
1137  SourceLocation FirstLoc;
1138  for (unsigned I = 0; I != NumLocs; ++I) {
1139  if (ExtraLocs[I].isValid()) {
1140  if (FirstLoc.isInvalid() ||
1142  FirstLoc))
1143  FirstLoc = ExtraLocs[I];
1144  Hints[I] = FixItHint::CreateRemoval(ExtraLocs[I]);
1145  }
1146  }
1147  TypeSpecWidth = static_cast<unsigned>(TypeSpecifierWidth::Unspecified);
1148  TypeSpecComplex = TSC_unspecified;
1149  TypeSpecSign = static_cast<unsigned>(TypeSpecifierSign::Unspecified);
1150  TypeAltiVecVector = TypeAltiVecPixel = TypeAltiVecBool = false;
1151  TypeQualifiers = 0;
1152  S.Diag(TSTLoc, diag::err_decltype_auto_cannot_be_combined)
1153  << Hints[0] << Hints[1] << Hints[2] << Hints[3]
1154  << Hints[4] << Hints[5] << Hints[6] << Hints[7];
1155  }
1156 
1157  // Validate and finalize AltiVec vector declspec.
1158  if (TypeAltiVecVector) {
1159  if (TypeAltiVecBool) {
1160  // Sign specifiers are not allowed with vector bool. (PIM 2.1)
1162  S.Diag(TSSLoc, diag::err_invalid_vector_bool_decl_spec)
1164  }
1165  // Only char/int are valid with vector bool prior to Power10.
1166  // Power10 adds instructions that produce vector bool data
1167  // for quadwords as well so allow vector bool __int128.
1168  if (((TypeSpecType != TST_unspecified) && (TypeSpecType != TST_char) &&
1169  (TypeSpecType != TST_int) && (TypeSpecType != TST_int128)) ||
1170  TypeAltiVecPixel) {
1171  S.Diag(TSTLoc, diag::err_invalid_vector_bool_decl_spec)
1172  << (TypeAltiVecPixel ? "__pixel" :
1173  getSpecifierName((TST)TypeSpecType, Policy));
1174  }
1175  // vector bool __int128 requires Power10.
1176  if ((TypeSpecType == TST_int128) &&
1177  (!S.Context.getTargetInfo().hasFeature("power10-vector")))
1178  S.Diag(TSTLoc, diag::err_invalid_vector_bool_int128_decl_spec);
1179 
1180  // Only 'short' and 'long long' are valid with vector bool. (PIM 2.1)
1184  S.Diag(TSWRange.getBegin(), diag::err_invalid_vector_bool_decl_spec)
1186 
1187  // vector bool long long requires VSX support or ZVector.
1189  (!S.Context.getTargetInfo().hasFeature("vsx")) &&
1190  (!S.Context.getTargetInfo().hasFeature("power8-vector")) &&
1191  !S.getLangOpts().ZVector)
1192  S.Diag(TSTLoc, diag::err_invalid_vector_long_long_decl_spec);
1193 
1194  // Elements of vector bool are interpreted as unsigned. (PIM 2.1)
1195  if ((TypeSpecType == TST_char) || (TypeSpecType == TST_int) ||
1196  (TypeSpecType == TST_int128) ||
1198  TypeSpecSign = static_cast<unsigned>(TypeSpecifierSign::Unsigned);
1199  } else if (TypeSpecType == TST_double) {
1200  // vector long double and vector long long double are never allowed.
1201  // vector double is OK for Power7 and later, and ZVector.
1204  S.Diag(TSWRange.getBegin(),
1205  diag::err_invalid_vector_long_double_decl_spec);
1206  else if (!S.Context.getTargetInfo().hasFeature("vsx") &&
1207  !S.getLangOpts().ZVector)
1208  S.Diag(TSTLoc, diag::err_invalid_vector_double_decl_spec);
1209  } else if (TypeSpecType == TST_float) {
1210  // vector float is unsupported for ZVector unless we have the
1211  // vector-enhancements facility 1 (ISA revision 12).
1212  if (S.getLangOpts().ZVector &&
1213  !S.Context.getTargetInfo().hasFeature("arch12"))
1214  S.Diag(TSTLoc, diag::err_invalid_vector_float_decl_spec);
1215  } else if (getTypeSpecWidth() == TypeSpecifierWidth::Long) {
1216  // vector long is unsupported for ZVector and deprecated for AltiVec.
1217  // It has also been historically deprecated on AIX (as an alias for
1218  // "vector int" in both 32-bit and 64-bit modes). It was then made
1219  // unsupported in the Clang-based XL compiler since the deprecated type
1220  // has a number of conflicting semantics and continuing to support it
1221  // is a disservice to users.
1222  if (S.getLangOpts().ZVector ||
1223  S.Context.getTargetInfo().getTriple().isOSAIX())
1224  S.Diag(TSWRange.getBegin(), diag::err_invalid_vector_long_decl_spec);
1225  else
1226  S.Diag(TSWRange.getBegin(),
1227  diag::warn_vector_long_decl_spec_combination)
1228  << getSpecifierName((TST)TypeSpecType, Policy);
1229  }
1230 
1231  if (TypeAltiVecPixel) {
1232  //TODO: perform validation
1233  TypeSpecType = TST_int;
1234  TypeSpecSign = static_cast<unsigned>(TypeSpecifierSign::Unsigned);
1235  TypeSpecWidth = static_cast<unsigned>(TypeSpecifierWidth::Short);
1236  TypeSpecOwned = false;
1237  }
1238  }
1239 
1240  bool IsFixedPointType =
1241  TypeSpecType == TST_accum || TypeSpecType == TST_fract;
1242 
1243  // signed/unsigned are only valid with int/char/wchar_t/_Accum.
1245  if (TypeSpecType == TST_unspecified)
1246  TypeSpecType = TST_int; // unsigned -> unsigned int, signed -> signed int.
1247  else if (TypeSpecType != TST_int && TypeSpecType != TST_int128 &&
1248  TypeSpecType != TST_char && TypeSpecType != TST_wchar &&
1249  !IsFixedPointType && TypeSpecType != TST_extint) {
1250  S.Diag(TSSLoc, diag::err_invalid_sign_spec)
1251  << getSpecifierName((TST)TypeSpecType, Policy);
1252  // signed double -> double.
1253  TypeSpecSign = static_cast<unsigned>(TypeSpecifierSign::Unspecified);
1254  }
1255  }
1256 
1257  // Validate the width of the type.
1258  switch (getTypeSpecWidth()) {
1260  break;
1261  case TypeSpecifierWidth::Short: // short int
1262  case TypeSpecifierWidth::LongLong: // long long int
1263  if (TypeSpecType == TST_unspecified)
1264  TypeSpecType = TST_int; // short -> short int, long long -> long long int.
1265  else if (!(TypeSpecType == TST_int ||
1266  (IsFixedPointType &&
1268  S.Diag(TSWRange.getBegin(), diag::err_invalid_width_spec)
1269  << (int)TypeSpecWidth << getSpecifierName((TST)TypeSpecType, Policy);
1270  TypeSpecType = TST_int;
1271  TypeSpecSat = false;
1272  TypeSpecOwned = false;
1273  }
1274  break;
1275  case TypeSpecifierWidth::Long: // long double, long int
1276  if (TypeSpecType == TST_unspecified)
1277  TypeSpecType = TST_int; // long -> long int.
1278  else if (TypeSpecType != TST_int && TypeSpecType != TST_double &&
1279  !IsFixedPointType) {
1280  S.Diag(TSWRange.getBegin(), diag::err_invalid_width_spec)
1281  << (int)TypeSpecWidth << getSpecifierName((TST)TypeSpecType, Policy);
1282  TypeSpecType = TST_int;
1283  TypeSpecSat = false;
1284  TypeSpecOwned = false;
1285  }
1286  break;
1287  }
1288 
1289  // TODO: if the implementation does not implement _Complex or _Imaginary,
1290  // disallow their use. Need information about the backend.
1291  if (TypeSpecComplex != TSC_unspecified) {
1292  if (TypeSpecType == TST_unspecified) {
1293  S.Diag(TSCLoc, diag::ext_plain_complex)
1296  " double");
1297  TypeSpecType = TST_double; // _Complex -> _Complex double.
1298  } else if (TypeSpecType == TST_int || TypeSpecType == TST_char ||
1299  TypeSpecType == TST_extint) {
1300  // Note that this intentionally doesn't include _Complex _Bool.
1301  if (!S.getLangOpts().CPlusPlus)
1302  S.Diag(TSTLoc, diag::ext_integer_complex);
1303  } else if (TypeSpecType != TST_float && TypeSpecType != TST_double &&
1304  TypeSpecType != TST_float128 && TypeSpecType != TST_float16) {
1305  // FIXME: __fp16?
1306  S.Diag(TSCLoc, diag::err_invalid_complex_spec)
1307  << getSpecifierName((TST)TypeSpecType, Policy);
1308  TypeSpecComplex = TSC_unspecified;
1309  }
1310  }
1311 
1312  // C11 6.7.1/3, C++11 [dcl.stc]p1, GNU TLS: __thread, thread_local and
1313  // _Thread_local can only appear with the 'static' and 'extern' storage class
1314  // specifiers. We also allow __private_extern__ as an extension.
1315  if (ThreadStorageClassSpec != TSCS_unspecified) {
1316  switch (StorageClassSpec) {
1317  case SCS_unspecified:
1318  case SCS_extern:
1319  case SCS_private_extern:
1320  case SCS_static:
1321  break;
1322  default:
1326  diag::err_invalid_decl_spec_combination)
1329  else
1331  diag::err_invalid_decl_spec_combination)
1334  // Discard the thread storage class specifier to recover.
1335  ThreadStorageClassSpec = TSCS_unspecified;
1336  ThreadStorageClassSpecLoc = SourceLocation();
1337  }
1338  }
1339 
1340  // If no type specifier was provided and we're parsing a language where
1341  // the type specifier is not optional, but we got 'auto' as a storage
1342  // class specifier, then assume this is an attempt to use C++0x's 'auto'
1343  // type specifier.
1344  if (S.getLangOpts().CPlusPlus &&
1345  TypeSpecType == TST_unspecified && StorageClassSpec == SCS_auto) {
1346  TypeSpecType = TST_auto;
1347  StorageClassSpec = SCS_unspecified;
1348  TSTLoc = TSTNameLoc = StorageClassSpecLoc;
1349  StorageClassSpecLoc = SourceLocation();
1350  }
1351  // Diagnose if we've recovered from an ill-formed 'auto' storage class
1352  // specifier in a pre-C++11 dialect of C++.
1353  if (!S.getLangOpts().CPlusPlus11 && TypeSpecType == TST_auto)
1354  S.Diag(TSTLoc, diag::ext_auto_type_specifier);
1355  if (S.getLangOpts().CPlusPlus && !S.getLangOpts().CPlusPlus11 &&
1356  StorageClassSpec == SCS_auto)
1357  S.Diag(StorageClassSpecLoc, diag::warn_auto_storage_class)
1358  << FixItHint::CreateRemoval(StorageClassSpecLoc);
1359  if (TypeSpecType == TST_char8)
1360  S.Diag(TSTLoc, diag::warn_cxx17_compat_unicode_type);
1361  else if (TypeSpecType == TST_char16 || TypeSpecType == TST_char32)
1362  S.Diag(TSTLoc, diag::warn_cxx98_compat_unicode_type)
1363  << (TypeSpecType == TST_char16 ? "char16_t" : "char32_t");
1365  S.Diag(ConstexprLoc, diag::warn_cxx98_compat_constexpr);
1367  S.Diag(ConstexprLoc, diag::warn_cxx20_compat_consteval);
1369  S.Diag(ConstexprLoc, diag::warn_cxx20_compat_constinit);
1370  // C++ [class.friend]p6:
1371  // No storage-class-specifier shall appear in the decl-specifier-seq
1372  // of a friend declaration.
1373  if (isFriendSpecified() &&
1375  SmallString<32> SpecName;
1376  SourceLocation SCLoc;
1377  FixItHint StorageHint, ThreadHint;
1378 
1379  if (DeclSpec::SCS SC = getStorageClassSpec()) {
1380  SpecName = getSpecifierName(SC);
1381  SCLoc = getStorageClassSpecLoc();
1382  StorageHint = FixItHint::CreateRemoval(SCLoc);
1383  }
1384 
1386  if (!SpecName.empty()) SpecName += " ";
1387  SpecName += getSpecifierName(TSC);
1388  SCLoc = getThreadStorageClassSpecLoc();
1389  ThreadHint = FixItHint::CreateRemoval(SCLoc);
1390  }
1391 
1392  S.Diag(SCLoc, diag::err_friend_decl_spec)
1393  << SpecName << StorageHint << ThreadHint;
1394 
1396  }
1397 
1398  // C++11 [dcl.fct.spec]p5:
1399  // The virtual specifier shall be used only in the initial
1400  // declaration of a non-static class member function;
1401  // C++11 [dcl.fct.spec]p6:
1402  // The explicit specifier shall be used only in the declaration of
1403  // a constructor or conversion function within its class
1404  // definition;
1406  StringRef Keyword;
1407  FixItHint Hint;
1408  SourceLocation SCLoc;
1409 
1410  if (isVirtualSpecified()) {
1411  Keyword = "virtual";
1412  SCLoc = getVirtualSpecLoc();
1413  Hint = FixItHint::CreateRemoval(SCLoc);
1414  } else {
1415  Keyword = "explicit";
1416  SCLoc = getExplicitSpecLoc();
1418  }
1419 
1420  S.Diag(SCLoc, diag::err_friend_decl_spec)
1421  << Keyword << Hint;
1422 
1423  FS_virtual_specified = false;
1424  FS_explicit_specifier = ExplicitSpecifier();
1425  FS_virtualLoc = FS_explicitLoc = SourceLocation();
1426  }
1427 
1428  assert(!TypeSpecOwned || isDeclRep((TST) TypeSpecType));
1429 
1430  // Okay, now we can infer the real type.
1431 
1432  // TODO: return "auto function" and other bad things based on the real type.
1433 
1434  // 'data definition has no type or storage class'?
1435 }
1436 
1438  TST tst = getTypeSpecType();
1439  return isDeclRep(tst) && getRepAsDecl() != nullptr &&
1440  StorageClassSpec != DeclSpec::SCS_typedef;
1441 }
1442 
1445  SourceLocation SymbolLocations[3]) {
1447  StartLocation = OperatorLoc;
1448  EndLocation = OperatorLoc;
1449  new (&OperatorFunctionId) struct OFI;
1451  for (unsigned I = 0; I != 3; ++I) {
1452  OperatorFunctionId.SymbolLocations[I] = SymbolLocations[I];
1453 
1454  if (SymbolLocations[I].isValid())
1455  EndLocation = SymbolLocations[I];
1456  }
1457 }
1458 
1460  const char *&PrevSpec) {
1461  if (!FirstLocation.isValid())
1462  FirstLocation = Loc;
1463  LastLocation = Loc;
1464  LastSpecifier = VS;
1465 
1466  if (Specifiers & VS) {
1467  PrevSpec = getSpecifierName(VS);
1468  return true;
1469  }
1470 
1471  Specifiers |= VS;
1472 
1473  switch (VS) {
1474  default: llvm_unreachable("Unknown specifier!");
1475  case VS_Override: VS_overrideLoc = Loc; break;
1476  case VS_GNU_Final:
1477  case VS_Sealed:
1478  case VS_Final: VS_finalLoc = Loc; break;
1479  case VS_Abstract: VS_abstractLoc = Loc; break;
1480  }
1481 
1482  return false;
1483 }
1484 
1486  switch (VS) {
1487  default: llvm_unreachable("Unknown specifier");
1488  case VS_Override: return "override";
1489  case VS_Final: return "final";
1490  case VS_GNU_Final: return "__final";
1491  case VS_Sealed: return "sealed";
1492  case VS_Abstract: return "abstract";
1493  }
1494 }
clang::TypeSpecifierWidth::LongLong
@ LongLong
clang::SourceRange::setBegin
void setBegin(SourceLocation b)
Definition: SourceLocation.h:224
clang::ExplicitSpecifier
Store information needed for an explicit specifier.
Definition: DeclCXX.h:1795
clang::DeclSpec::getVirtualSpecLoc
SourceLocation getVirtualSpecLoc() const
Definition: DeclSpec.h:580
clang::TST_half
@ TST_half
Definition: Specifiers.h:54
clang::Declarator::isDeclarationOfFunction
bool isDeclarationOfFunction() const
Determine whether the declaration that will be produced from this declaration will be a function.
Definition: DeclSpec.cpp:325
clang::DeclaratorChunk::FunctionTypeInfo::NumParams
unsigned NumParams
NumParams - This is the number of formal parameters specified by the declarator.
Definition: DeclSpec.h:1316
clang::DeclSpec::SetTypeQual
bool SetTypeQual(TQ T, SourceLocation Loc)
Definition: DeclSpec.cpp:972
clang::DeclaratorChunk::EndLoc
SourceLocation EndLoc
EndLoc - If valid, the place where this chunck ends.
Definition: DeclSpec.h:1184
clang::DeclaratorChunk::FunctionTypeInfo::hasPrototype
unsigned hasPrototype
hasPrototype - This is true if the function had at least one typed parameter.
Definition: DeclSpec.h:1281
clang::Declarator::getName
UnqualifiedId & getName()
Retrieve the name specified by this declarator.
Definition: DeclSpec.h:1930
clang::OpaquePtr::get
PtrTy get() const
Definition: Ownership.h:80
clang::TST_Float16
@ TST_Float16
Definition: Specifiers.h:55
clang::DeclaratorChunk::FunctionTypeInfo::RefQualifierLoc
SourceLocation RefQualifierLoc
The location of the ref-qualifier, if any.
Definition: DeclSpec.h:1326
clang::TST_char8
@ TST_char8
Definition: Specifiers.h:48
clang::TST_bool
@ TST_bool
Definition: Specifiers.h:63
clang::VirtSpecifiers::VS_GNU_Final
@ VS_GNU_Final
Definition: DeclSpec.h:2624
clang::DeclSpec::TSC_unspecified
@ TSC_unspecified
Definition: DeclSpec.h:253
clang::UnqualifiedId::TemplateId
TemplateIdAnnotation * TemplateId
When Kind == IK_TemplateId or IK_ConstructorTemplateId, the template-id annotation that contains the ...
Definition: DeclSpec.h:1003
clang::DeclSpec::SetTypeSpecComplex
bool SetTypeSpecComplex(TSC C, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:711
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::DeclSpec::TQ_unspecified
@ TQ_unspecified
Definition: DeclSpec.h:305
clang::DeclSpec::TST_unknown_anytype
static const TST TST_unknown_anytype
Definition: DeclSpec.h:296
clang::LangOptions::getOpenCLCompatibleVersion
unsigned getOpenCLCompatibleVersion() const
Return the OpenCL version that kernel language is compatible with.
Definition: LangOptions.cpp:55
clang::CXXScopeSpec::Adopt
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Definition: DeclSpec.cpp:131
clang::TST_underlyingType
@ TST_underlyingType
Definition: Specifiers.h:76
clang::DeclaratorChunk::FunctionTypeInfo::ExceptionSpecType
unsigned ExceptionSpecType
ExceptionSpecType - An ExceptionSpecificationType value.
Definition: DeclSpec.h:1296
clang::DeclSpec::TST_enum
static const TST TST_enum
Definition: DeclSpec.h:283
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:212
clang::Declarator::InlineParams
DeclaratorChunk::ParamInfo InlineParams[16]
InlineParams - This is a local array used for the first function decl chunk to avoid going to the hea...
Definition: DeclSpec.h:1878
clang::UnqualifiedId::OperatorFunctionId
struct OFI OperatorFunctionId
When Kind == IK_OperatorFunctionId, the overloaded operator that we parsed.
Definition: DeclSpec.h:983
clang::TST_interface
@ TST_interface
Definition: Specifiers.h:71
clang::WrittenBuiltinSpecs::Sign
unsigned Sign
Definition: Specifiers.h:92
clang::FixItHint::CreateInsertion
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code string at a specific location.
Definition: Diagnostic.h:96
clang::NamespaceAliasDecl
Represents a C++ namespace alias.
Definition: DeclCXX.h:2986
clang::TypeSpecifierSign
TypeSpecifierSign
Specifies the signedness of a type, e.g., signed or unsigned.
Definition: Specifiers.h:38
clang::DeclSpec::getExplicitSpecLoc
SourceLocation getExplicitSpecLoc() const
Definition: DeclSpec.h:585
clang::TST_unspecified
@ TST_unspecified
Definition: Specifiers.h:44
clang::DeclSpec::getExplicitSpecRange
SourceRange getExplicitSpecRange() const
Definition: DeclSpec.h:586
clang::TST_typename
@ TST_typename
Definition: Specifiers.h:72
clang::DeclSpec::getAttributes
ParsedAttributes & getAttributes()
Definition: DeclSpec.h:796
clang::NestedNameSpecifierLocBuilder::Adopt
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Definition: NestedNameSpecifier.cpp:672
clang::DeclSpec::SetTypeSpecError
bool SetTypeSpecError()
Definition: DeclSpec.cpp:927
clang::UnqualifiedId::setTemplateId
void setTemplateId(TemplateIdAnnotation *TemplateId)
Specify that this unqualified-id was parsed as a template-id.
Definition: DeclSpec.cpp:31
clang::DeclSpec::SCS_static
@ SCS_static
Definition: DeclSpec.h:237
llvm::SmallVector< Token, 4 >
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:88
clang::DeclSpec::TST_error
static const TST TST_error
Definition: DeclSpec.h:301
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:249
clang::DeclSpec::setFunctionSpecInline
bool setFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:987
clang::SourceRange::getBegin
SourceLocation getBegin() const
Definition: SourceLocation.h:221
clang::TST_void
@ TST_void
Definition: Specifiers.h:45
clang::DeclSpec::TSC_complex
@ TSC_complex
Definition: DeclSpec.h:255
TargetInfo.h
clang::DeclSpec::getRepAsExpr
Expr * getRepAsExpr() const
Definition: DeclSpec.h:495
clang::DeclSpec::setFunctionSpecExplicit
bool setFunctionSpecExplicit(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, ExplicitSpecifier ExplicitSpec, SourceLocation CloseParenLoc)
Definition: DeclSpec.cpp:1028
clang::TypeSpecifierWidth::Unspecified
@ Unspecified
clang::DeclaratorChunk::FunctionTypeInfo::TrailingReturnType
UnionParsedType TrailingReturnType
If HasTrailingReturnType is true, this is the trailing return type specified.
Definition: DeclSpec.h:1371
clang::UnqualifiedId::OFI::Operator
OverloadedOperatorKind Operator
The kind of overloaded operator.
Definition: DeclSpec.h:962
clang::DeclSpec::SCS_auto
@ SCS_auto
Definition: DeclSpec.h:238
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:673
clang::DeclSpec::SetTypeAltiVecPixel
bool SetTypeAltiVecPixel(bool isAltiVecPixel, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
Definition: DeclSpec.cpp:893
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::DeclaratorChunk::BlockPointer
@ BlockPointer
Definition: DeclSpec.h:1178
clang::TST_struct
@ TST_struct
Definition: Specifiers.h:69
clang::DeclaratorChunk::Fun
FunctionTypeInfo Fun
Definition: DeclSpec.h:1553
clang::EST_Dynamic
@ EST_Dynamic
throw(T1, T2)
Definition: ExceptionSpecificationType.h:23
clang::Declarator::getContext
DeclaratorContext getContext() const
Definition: DeclSpec.h:1936
clang::Sema::Diag
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
Definition: Sema.cpp:1832
DeclCXX.h
int
__device__ int
Definition: __clang_hip_libdevice_declares.h:63
clang::VirtSpecifiers::Specifier
Specifier
Definition: DeclSpec.h:2618
clang::ParsedAttributesView::size
SizeType size() const
Definition: ParsedAttr.h:875
clang::VirtSpecifiers::getSpecifierName
static const char * getSpecifierName(Specifier VS)
Definition: DeclSpec.cpp:1485
clang::Sema::getSourceManager
SourceManager & getSourceManager() const
Definition: Sema.h:1567
clang::LocInfoType
Holds a QualType and a TypeSourceInfo* that came out of a declarator parsing.
Definition: LocInfoType.h:28
clang::TST_enum
@ TST_enum
Definition: Specifiers.h:67
clang::TST_error
@ TST_error
Definition: Specifiers.h:84
clang::NestedNameSpecifierLoc::getLocalBeginLoc
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
Definition: NestedNameSpecifier.h:311
clang::DeclSpec::SCS
SCS
storage-class-specifier
Definition: DeclSpec.h:233
clang::DeclSpec::SCS_unspecified
@ SCS_unspecified
Definition: DeclSpec.h:234
clang::TargetInfo::hasFeature
virtual bool hasFeature(StringRef Feature) const
Determine whether the given target has the given feature.
Definition: TargetInfo.h:1304
clang::DeclSpec::getParsedSpecifiers
unsigned getParsedSpecifiers() const
Return a bitmask of which flavors of specifiers this DeclSpec includes.
Definition: DeclSpec.cpp:452
clang::DeclSpec::hasExplicitSpecifier
bool hasExplicitSpecifier() const
Definition: DeclSpec.h:582
clang::DeclSpec::TQ_volatile
@ TQ_volatile
Definition: DeclSpec.h:308
SourceManager.h
clang::TST_auto
@ TST_auto
Definition: Specifiers.h:77
clang::DeclaratorChunk::Pipe
@ Pipe
Definition: DeclSpec.h:1178
clang::EST_Unparsed
@ EST_Unparsed
not parsed yet
Definition: ExceptionSpecificationType.h:32
clang::DeclaratorChunk::FunctionTypeInfo::DeleteParams
unsigned DeleteParams
DeleteParams - If this is true, we need to delete[] Params.
Definition: DeclSpec.h:1299
DeclSpec.h
clang::DeclaratorChunk::FunctionTypeInfo::ExceptionSpecLocBeg
SourceLocation ExceptionSpecLocBeg
The beginning location of the exception specification, if any.
Definition: DeclSpec.h:1333
clang::OpenCLOptions::isAvailableOption
bool isAvailableOption(llvm::StringRef Ext, const LangOptions &LO) const
Definition: OpenCLOptions.cpp:19
clang::DeclSpec::TQ_unaligned
@ TQ_unaligned
Definition: DeclSpec.h:309
clang::PrintingPolicy
Describes how types, statements, expressions, and declarations should be printed.
Definition: PrettyPrinter.h:59
clang::DeclSpec::TQ_atomic
@ TQ_atomic
Definition: DeclSpec.h:312
LocInfoType.h
clang::ParsedAttributesView::hasAttribute
bool hasAttribute(ParsedAttr::Kind K) const
Definition: ParsedAttr.h:949
Identifier
StringRef Identifier
Definition: Format.cpp:2341
clang::NestedNameSpecifierLocBuilder::MakeGlobal
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
Definition: NestedNameSpecifier.cpp:611
clang::DeclaratorChunk::FunctionTypeInfo::ExceptionSpecTokens
CachedTokens * ExceptionSpecTokens
Pointer to the cached tokens for an exception-specification that has not yet been parsed.
Definition: DeclSpec.h:1361
clang::DeclSpec::getTypeSpecComplexLoc
SourceLocation getTypeSpecComplexLoc() const
Definition: DeclSpec.h:513
clang::TST_auto_type
@ TST_auto_type
Definition: Specifiers.h:79
clang::UnqualifiedId::setConstructorTemplateId
void setConstructorTemplateId(TemplateIdAnnotation *TemplateId)
Specify that this unqualified-id was parsed as a template-id that names a constructor.
Definition: DeclSpec.cpp:42
clang::DeclaratorChunk::Pointer
@ Pointer
Definition: DeclSpec.h:1178
clang::DeclSpec::getSpecifierName
static const char * getSpecifierName(DeclSpec::TST T, const PrintingPolicy &Policy)
Turn a type-specifier-type into a string like "_Bool" or "union".
Definition: DeclSpec.cpp:542
clang::TST_unknown_anytype
@ TST_unknown_anytype
Definition: Specifiers.h:80
clang::PrintingPolicy::Bool
unsigned Bool
Whether we can use 'bool' rather than '_Bool' (even if the language doesn't actually have 'bool',...
Definition: PrettyPrinter.h:193
clang::DeclaratorChunk::FunctionTypeInfo::QualAttrFactory
AttributeFactory * QualAttrFactory
AtttibuteFactory for the MethodQualifiers.
Definition: DeclSpec.h:1347
clang::DeclaratorChunk::FunctionTypeInfo::EllipsisLoc
SourceLocation EllipsisLoc
When isVariadic is true, the location of the ellipsis in the source.
Definition: DeclSpec.h:1309
clang::DeclSpec::SetFriendSpec
bool SetFriendSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:1062
clang::DeclSpec::TSCS_unspecified
static const TSCS TSCS_unspecified
Definition: DeclSpec.h:247
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::CXXScopeSpec::MakeSuper
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
Definition: DeclSpec.cpp:113
clang::VirtSpecifiers::VS_Override
@ VS_Override
Definition: DeclSpec.h:2620
clang::Sema::Context
ASTContext & Context
Definition: Sema.h:411
clang::VirtSpecifiers::VS_Sealed
@ VS_Sealed
Definition: DeclSpec.h:2622
clang::Declarator::isStaticMember
bool isStaticMember()
Returns true if this declares a static member.
Definition: DeclSpec.cpp:412
clang::DecompositionDeclarator::Binding
Definition: DeclSpec.h:1705
clang::DeclSpec::TST_float
static const TST TST_float
Definition: DeclSpec.h:272
clang::UnqualifiedId::StartLocation
SourceLocation StartLocation
The location of the first token that describes this unqualified-id, which will be the location of the...
Definition: DeclSpec.h:1009
clang::ConstexprSpecKind::Constinit
@ Constinit
clang::TypeLoc::getBeginLoc
SourceLocation getBeginLoc() const
Get the begin source location.
Definition: TypeLoc.cpp:191
clang::FixItHint
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
Definition: Diagnostic.h:70
clang::Sema::getLangOpts
const LangOptions & getLangOpts() const
Definition: Sema.h:1562
clang::DeclSpec::TST_underlyingType
static const TST TST_underlyingType
Definition: DeclSpec.h:293
clang::EST_DependentNoexcept
@ EST_DependentNoexcept
noexcept(expression), value-dependent
Definition: ExceptionSpecificationType.h:27
clang::DeclSpec::TST_char8
static const TST TST_char8
Definition: DeclSpec.h:264
clang::DeclSpec::PQ_TypeSpecifier
@ PQ_TypeSpecifier
Definition: DeclSpec.h:320
clang::Declarator::getDeclSpec
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
Definition: DeclSpec.h:1911
clang::DeclaratorChunk::Kind
enum clang::DeclaratorChunk::@207 Kind
clang::EST_NoexceptTrue
@ EST_NoexceptTrue
noexcept(expression), evals to 'true'
Definition: ExceptionSpecificationType.h:29
clang::DeclSpec::TST_accum
static const TST TST_accum
Definition: DeclSpec.h:275
clang::AttributePool::takeAllFrom
void takeAllFrom(AttributePool &pool)
Take the given pool's allocations and add them to this pool.
Definition: ParsedAttr.h:783
clang::DeclSpec::SetTypeSpecSign
bool SetTypeSpecSign(TypeSpecifierSign S, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:721
clang::DeclSpec::setFunctionSpecForceInline
bool setFunctionSpecForceInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:1001
clang::NestedNameSpecifierLocBuilder::Clear
void Clear()
Clear out this builder, and prepare it to build another nested-name-specifier with source-location in...
Definition: NestedNameSpecifier.h:505
clang::DeclSpec::SetConstexprSpec
bool SetConstexprSpec(ConstexprSpecKind ConstexprKind, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:1092
clang::DeclaratorChunk::Reference
@ Reference
Definition: DeclSpec.h:1178
clang::DeclSpec::getTypeSpecSign
TypeSpecifierSign getTypeSpecSign() const
Definition: DeclSpec.h:474
BadSpecifier
static bool BadSpecifier(T TNew, T TPrev, const char *&PrevSpec, unsigned &DiagID, bool IsExtension=true)
Definition: DeclSpec.cpp:470
clang::DeclaratorChunk::FunctionTypeInfo::Exceptions
TypeAndRange * Exceptions
Pointer to a new[]'d array of TypeAndRange objects that contain the types in the function's dynamic e...
Definition: DeclSpec.h:1353
clang::DeclSpec::hasTypeSpecifier
bool hasTypeSpecifier() const
Return true if any type-specifier has been found.
Definition: DeclSpec.h:622
clang::ThreadStorageClassSpecifier
ThreadStorageClassSpecifier
Thread storage-class-specifier.
Definition: Specifiers.h:211
clang::DeclaratorChunk::TypeAndRange
Definition: DeclSpec.h:1272
clang::DeclSpec::getTypeSpecType
TST getTypeSpecType() const
Definition: DeclSpec.h:477
clang::ConstexprSpecKind::Consteval
@ Consteval
clang::UnqualifiedId::Kind
UnqualifiedIdKind Kind
Describes the kind of unqualified-id parsed.
Definition: DeclSpec.h:958
clang::ExceptionSpecificationType
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
Definition: ExceptionSpecificationType.h:20
clang::PrintingPolicy::MSWChar
unsigned MSWChar
When true, print the built-in wchar_t type as __wchar_t.
Definition: PrettyPrinter.h:234
clang::TST_decltype
@ TST_decltype
Definition: Specifiers.h:75
clang::TypeSpecifierSign::Signed
@ Signed
clang::TemplateIdAnnotation::RAngleLoc
SourceLocation RAngleLoc
The location of the '>' after the template argument list.
Definition: ParsedTemplate.h:183
clang::CXXScopeSpec::Extend
void Extend(ASTContext &Context, SourceLocation TemplateKWLoc, TypeLoc TL, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'type...
Definition: DeclSpec.cpp:53
clang::Declarator::hasName
bool hasName() const
hasName - Whether this declarator has a name, which might be an identifier (accessible via getIdentif...
Definition: DeclSpec.h:2179
clang::DeclSpec::TST_interface
static const TST TST_interface
Definition: DeclSpec.h:286
clang::DeclSpec::TST_char
static const TST TST_char
Definition: DeclSpec.h:262
clang::SourceRange::getEnd
SourceLocation getEnd() const
Definition: SourceLocation.h:222
clang::DeclSpec::TST_double
static const TST TST_double
Definition: DeclSpec.h:273
clang::DeclSpec::PQ_TypeQualifier
@ PQ_TypeQualifier
Definition: DeclSpec.h:321
clang::DeclSpec::TST_BFloat16
static const TST TST_BFloat16
Definition: DeclSpec.h:271
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:211
clang::VirtSpecifiers::VS_Abstract
@ VS_Abstract
Definition: DeclSpec.h:2625
clang::DeclaratorContext::Member
@ Member
LangOptions.h
clang::DeclaratorChunk::FunctionTypeInfo::DeclsInPrototype
NamedDecl ** DeclsInPrototype
Pointer to a new[]'d array of declarations that need to be available for lookup inside the function b...
Definition: DeclSpec.h:1366
clang::DeclaratorChunk::TypeAndRange::Ty
ParsedType Ty
Definition: DeclSpec.h:1273
clang::NestedNameSpecifierLoc::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
Definition: NestedNameSpecifier.cpp:410
clang::DeclaratorChunk::FunctionTypeInfo::isVariadic
unsigned isVariadic
isVariadic - If this function has a prototype, and if that proto ends with ',...)',...
Definition: DeclSpec.h:1286
clang::DeclaratorChunk::FunctionTypeInfo
Definition: DeclSpec.h:1277
clang::DeclSpec::ClearStorageClassSpecs
void ClearStorageClassSpecs()
Definition: DeclSpec.h:455
clang::TST_atomic
@ TST_atomic
Definition: Specifiers.h:81
clang::DeclaratorChunk::FunctionTypeInfo::NoexceptExpr
Expr * NoexceptExpr
Pointer to the expression in the noexcept-specifier of this function, if it has one.
Definition: DeclSpec.h:1357
clang::DeclSpec::TST_decimal32
static const TST TST_decimal32
Definition: DeclSpec.h:280
clang::DeclSpec::TST_class
static const TST TST_class
Definition: DeclSpec.h:287
clang::DeclSpec::SCS_typedef
@ SCS_typedef
Definition: DeclSpec.h:235
clang::DeclSpec::hasTagDefinition
bool hasTagDefinition() const
Definition: DeclSpec.cpp:443
clang::TypeSpecifierSign::Unspecified
@ Unspecified
clang::WrittenBuiltinSpecs::Type
unsigned Type
Definition: Specifiers.h:90
clang::DeclSpec::TST_fract
static const TST TST_fract
Definition: DeclSpec.h:276
clang::DeclaratorChunk::TypeAndRange::Range
SourceRange Range
Definition: DeclSpec.h:1274
clang::DeclSpec::SetTypePipe
bool SetTypePipe(bool isPipe, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
Definition: DeclSpec.cpp:876
clang::NestedNameSpecifierLocBuilder::MakeSuper
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
Definition: NestedNameSpecifier.cpp:620
clang::Type::isFunctionType
bool isFunctionType() const
Definition: Type.h:6669
clang::UnqualifiedIdKind::IK_ConstructorName
@ IK_ConstructorName
A constructor name.
Expr.h
llvm::SmallString< 32 >
clang::DeclSpec::setFunctionSpecVirtual
bool setFunctionSpecVirtual(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:1013
ASTContext.h
clang::VirtSpecifiers::VS_Final
@ VS_Final
Definition: DeclSpec.h:2621
clang::DeclSpec::isFriendSpecified
bool isFriendSpecified() const
Definition: DeclSpec.h:749
clang::ConstexprSpecKind::Constexpr
@ Constexpr
clang::NestedNameSpecifierLocBuilder::getTemporary
NestedNameSpecifierLoc getTemporary() const
Retrieve a nested-name-specifier with location information based on the information in this builder.
Definition: NestedNameSpecifier.h:499
clang::SourceRange::setEnd
void setEnd(SourceLocation e)
Definition: SourceLocation.h:225
clang::DeclSpec::getStorageClassSpec
SCS getStorageClassSpec() const
Definition: DeclSpec.h:441
isInvalid
static bool isInvalid(LocType Loc, bool *Invalid)
Definition: SourceManager.cpp:1230
clang::TST_char
@ TST_char
Definition: Specifiers.h:46
clang::UnqualifiedId::OFI
Definition: DeclSpec.h:960
clang::Sema::getLocForEndOfToken
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
Definition: Sema.cpp:54
clang::TST_int
@ TST_int
Definition: Specifiers.h:51
clang::TST_int128
@ TST_int128
Definition: Specifiers.h:52
clang::DeclSpec::SetStorageClassSpec
bool SetStorageClassSpec(Sema &S, SCS SC, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
These methods set the specified attribute of the DeclSpec and return false if there was no error.
Definition: DeclSpec.cpp:618
clang::DeclSpec::TST_union
static const TST TST_union
Definition: DeclSpec.h:284
clang::NestedNameSpecifierLoc
A C++ nested-name-specifier augmented with source location information.
Definition: NestedNameSpecifier.h:243
clang::DeclSpec::SCS_register
@ SCS_register
Definition: DeclSpec.h:239
clang::DeclaratorChunk::FunctionTypeInfo::Params
ParamInfo * Params
Params - This is a pointer to a new[]'d array of ParamInfo objects that describe the parameters speci...
Definition: DeclSpec.h:1341
clang::DeclSpec::getThreadStorageClassSpecLoc
SourceLocation getThreadStorageClassSpecLoc() const
Definition: DeclSpec.h:451
getKind
static Decl::Kind getKind(const Decl *D)
Definition: DeclBase.cpp:998
clang::DeclSpec::SCS_mutable
@ SCS_mutable
Definition: DeclSpec.h:241
Sema.h
clang::DeclSpec::isTypeRep
bool isTypeRep() const
Definition: DeclSpec.h:482
clang::DeclSpec::setFunctionSpecNoreturn
bool setFunctionSpecNoreturn(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:1047
clang::DeclaratorChunk::FunctionTypeInfo::isAmbiguous
unsigned isAmbiguous
Can this declaration be a constructor-style initializer?
Definition: DeclSpec.h:1289
clang::Sema::getOpenCLOptions
OpenCLOptions & getOpenCLOptions()
Definition: Sema.h:1563
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::OverloadedOperatorKind
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:21
clang::NestedNameSpecifierLocBuilder::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: NestedNameSpecifier.cpp:563
clang::DeclSpec::DeclRep
Decl * DeclRep
Definition: DeclSpec.h:362
clang::DeclSpec::TSC
TSC
Definition: DeclSpec.h:252
clang::Declarator::SetIdentifier
void SetIdentifier(IdentifierInfo *Id, SourceLocation IdLoc)
Set the name of this declarator to be the given identifier.
Definition: DeclSpec.h:2198
clang::DeclSpec::TST_decimal64
static const TST TST_decimal64
Definition: DeclSpec.h:281
clang::SourceManager::isBeforeInTranslationUnit
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
Definition: SourceManager.cpp:2019
clang::DeclSpec::TST_ibm128
static const TST TST_ibm128
Definition: DeclSpec.h:278
clang::TST_decimal32
@ TST_decimal32
Definition: Specifiers.h:64
clang::OpaquePtr< QualType >
clang::DeclSpec::TST_int
static const TST TST_int
Definition: DeclSpec.h:267
clang::ExplicitSpecifier::getExpr
const Expr * getExpr() const
Definition: DeclCXX.h:1804
clang::DeclSpec::getStorageClassSpecLoc
SourceLocation getStorageClassSpecLoc() const
Definition: DeclSpec.h:450
clang::DeclSpec::TST_extint
static const TST TST_extint
Definition: DeclSpec.h:269
clang::ConstexprSpecKind
ConstexprSpecKind
Define the kind of constexpr specifier.
Definition: Specifiers.h:32
clang::TargetInfo::getTriple
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
Definition: TargetInfo.h:1129
clang::TST_float
@ TST_float
Definition: Specifiers.h:59
clang::DeclSpec::TST_int128
static const TST TST_int128
Definition: DeclSpec.h:268
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:255
clang::DeclaratorChunk::FunctionTypeInfo::TrailingReturnTypeLoc
SourceLocation TrailingReturnTypeLoc
If HasTrailingReturnType is true, this is the location of the trailing return type.
Definition: DeclSpec.h:1375
clang::TST_typeofExpr
@ TST_typeofExpr
Definition: Specifiers.h:74
clang::DeclaratorChunk::ParamInfo
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed.
Definition: DeclSpec.h:1252
clang::TypeSpecifiersPipe::Pipe
@ Pipe
clang::UnqualifiedIdKind::IK_TemplateId
@ IK_TemplateId
A template-id, e.g., f<int>.
clang::DeclaratorChunk::FunctionTypeInfo::MethodQualifiers
DeclSpec * MethodQualifiers
DeclSpec for the function with the qualifier related info.
Definition: DeclSpec.h:1344
clang::TemplateIdAnnotation::TemplateNameLoc
SourceLocation TemplateNameLoc
TemplateNameLoc - The location of the template name within the source.
Definition: ParsedTemplate.h:160
clang::TST_Accum
@ TST_Accum
Definition: Specifiers.h:56
clang::DeclSpec::TST_decimal128
static const TST TST_decimal128
Definition: DeclSpec.h:282
clang::DeclSpec::isDeclRep
static bool isDeclRep(TST T)
Definition: DeclSpec.h:416
clang::ActionResult::get
PtrTy get() const
Definition: Ownership.h:169
SemaDiagnostic.h
clang::DeclSpec::isModulePrivateSpecified
bool isModulePrivateSpecified() const
Definition: DeclSpec.h:752
clang::DeclSpec::isMissingDeclaratorOk
bool isMissingDeclaratorOk()
Checks if this DeclSpec can stand alone, without a Declarator.
Definition: DeclSpec.cpp:1437
clang::DeclaratorChunk::FunctionTypeInfo::LParenLoc
SourceLocation LParenLoc
The location of the left parenthesis in the source.
Definition: DeclSpec.h:1306
clang::DeclSpec::forEachQualifier
void forEachQualifier(llvm::function_ref< void(TQ, StringRef, SourceLocation)> Handle)
This method calls the passed in handler on each qual being set.
Definition: DeclSpec.cpp:437
clang::QualType::isNull
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Definition: Type.h:738
clang::TST_decimal64
@ TST_decimal64
Definition: Specifiers.h:65
clang::DeclSpec::TST_float16
static const TST TST_float16
Definition: DeclSpec.h:274
llvm::ArrayRef
Definition: LLVM.h:34
clang::DeclSpec::TST_typename
static const TST TST_typename
Definition: DeclSpec.h:288
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:89
clang::TypeLoc
Base wrapper for a particular "section" of type source info.
Definition: TypeLoc.h:58
clang::DeclSpec::PQ_FunctionSpecifier
@ PQ_FunctionSpecifier
Definition: DeclSpec.h:322
clang::DeclSpec::TST_typeofType
static const TST TST_typeofType
Definition: DeclSpec.h:289
clang::DeclSpec::TST_half
static const TST TST_half
Definition: DeclSpec.h:270
clang::DeclSpec::TST_decltype_auto
static const TST TST_decltype_auto
Definition: DeclSpec.h:292
clang::DeclSpec::getTypeSpecWidth
TypeSpecifierWidth getTypeSpecWidth() const
Definition: DeclSpec.h:470
clang::Sema
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:355
clang::ActionResult::isInvalid
bool isInvalid() const
Definition: Ownership.h:165
clang::DeclSpec::SCS_private_extern
@ SCS_private_extern
Definition: DeclSpec.h:240
clang::UnqualifiedIdKind::IK_DestructorName
@ IK_DestructorName
A destructor name.
clang::DeclaratorChunk::Loc
SourceLocation Loc
Loc - The place where this type was defined.
Definition: DeclSpec.h:1182
clang::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::CXXMethodDecl::isStaticOverloadedOperator
static bool isStaticOverloadedOperator(OverloadedOperatorKind OOK)
Returns true if the given operator is implicitly static in a record context.
Definition: DeclCXX.h:1979
clang::NestedNameSpecifierLocBuilder::getRepresentation
NestedNameSpecifier * getRepresentation() const
Retrieve the representation of the nested-name-specifier.
Definition: NestedNameSpecifier.h:390
clang::DeclSpec::TST_decltype
static const TST TST_decltype
Definition: DeclSpec.h:291
clang::TST_wchar
@ TST_wchar
Definition: Specifiers.h:47
clang::DeclSpec::SetTypeSpecSat
bool SetTypeSpecSat(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:848
clang::DeclSpec::getConstexprSpecifier
ConstexprSpecKind getConstexprSpecifier() const
Definition: DeclSpec.h:755
clang::UnqualifiedId::EndLocation
SourceLocation EndLocation
The location of the last token that describes this unqualified-id.
Definition: DeclSpec.h:1012
clang::NestedNameSpecifierLocBuilder::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covered by this nested-name-specifier.
Definition: NestedNameSpecifier.h:483
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:67
clang::DeclaratorChunk::MemberPointer
@ MemberPointer
Definition: DeclSpec.h:1178
clang::TST_decimal128
@ TST_decimal128
Definition: Specifiers.h:66
clang::ASTContext::getTargetInfo
const TargetInfo & getTargetInfo() const
Definition: ASTContext.h:740
clang::DeclSpec::setModulePrivateSpec
bool setModulePrivateSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:1080
clang::TypeSpecifierWidth
TypeSpecifierWidth
Specifies the width of a type, e.g., short, long, or long long.
Definition: Specifiers.h:35
clang::DeclSpec::TST_float128
static const TST TST_float128
Definition: DeclSpec.h:277
clang::DeclaratorChunk::FunctionTypeInfo::RParenLoc
SourceLocation RParenLoc
The location of the right parenthesis in the source.
Definition: DeclSpec.h:1312
clang::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::ActionResult
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc.
Definition: Ownership.h:152
clang::TST_ibm128
@ TST_ibm128
Definition: Specifiers.h:62
clang::DeclSpec::getRepAsDecl
Decl * getRepAsDecl() const
Definition: DeclSpec.h:491
clang::DeclSpec::TST_void
static const TST TST_void
Definition: DeclSpec.h:261
clang::DeclaratorChunk::FunctionTypeInfo::RefQualifierIsLValueRef
unsigned RefQualifierIsLValueRef
Whether the ref-qualifier (if any) is an lvalue reference.
Definition: DeclSpec.h:1293
clang::DeclaratorChunk::FunctionTypeInfo::HasTrailingReturnType
unsigned HasTrailingReturnType
HasTrailingReturnType - If this is true, a trailing return type was specified.
Definition: DeclSpec.h:1303
clang::DeclSpec::TST_bool
static const TST TST_bool
Definition: DeclSpec.h:279
clang::TST_class
@ TST_class
Definition: Specifiers.h:70
clang::DeclSpec::TST_char32
static const TST TST_char32
Definition: DeclSpec.h:266
clang::DeclSpec::TST_unspecified
static const TST TST_unspecified
Definition: DeclSpec.h:260
clang::TypeSpecifierSign::Unsigned
@ Unsigned
clang::UnqualifiedId::OFI::SymbolLocations
SourceLocation SymbolLocations[3]
The source locations of the individual tokens that name the operator, e.g., the "new",...
Definition: DeclSpec.h:971
clang::DeclSpec::TSCS___thread
static const TSCS TSCS___thread
Definition: DeclSpec.h:248
clang::DeclSpec::SetStorageClassSpecThread
bool SetStorageClassSpecThread(TSCS TSC, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:680
clang::TST_char32
@ TST_char32
Definition: Specifiers.h:50
clang::DeclSpec::TQ
TQ
Definition: DeclSpec.h:304
clang::SourceLocation::isInvalid
bool isInvalid() const
Definition: SourceLocation.h:113
clang
Definition: CalledOnceCheck.h:17
clang::TST_extint
@ TST_extint
Definition: Specifiers.h:53
clang::DeclSpec::TST_atomic
static const TST TST_atomic
Definition: DeclSpec.h:297
clang::Declarator::InlineBindings
DecompositionDeclarator::Binding InlineBindings[16]
Definition: DeclSpec.h:1879
clang::DeclSpec::TST_auto_type
static const TST TST_auto_type
Definition: DeclSpec.h:295
clang::Declarator::isCtorOrDtor
bool isCtorOrDtor()
Returns true if this declares a constructor or a destructor.
Definition: DeclSpec.cpp:420
clang::Declarator
Information about one declarator, including the parsed type information and the identifier.
Definition: DeclSpec.h:1804
clang::DeclSpec::forEachCVRUQualifier
void forEachCVRUQualifier(llvm::function_ref< void(TQ, StringRef, SourceLocation)> Handle)
This method calls the passed in handler on each CVRU qual being set.
Definition: DeclSpec.cpp:425
clang::TST_char16
@ TST_char16
Definition: Specifiers.h:49
clang::DeclaratorChunk::FunctionTypeInfo::MutableLoc
SourceLocation MutableLoc
The location of the 'mutable' qualifer in a lambda-declarator, if any.
Definition: DeclSpec.h:1330
clang::DeclSpec::TSC_imaginary
@ TSC_imaginary
Definition: DeclSpec.h:254
clang::DeclaratorChunk::Function
@ Function
Definition: DeclSpec.h:1178
clang::SourceLocation::isValid
bool isValid() const
Return true if this is a valid SourceLocation object.
Definition: SourceLocation.h:112
clang::FixItHint::CreateRemoval
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
Definition: Diagnostic.h:122
clang::DeclSpec::getTypeQualifiers
unsigned getTypeQualifiers() const
getTypeQualifiers - Return a set of TQs.
Definition: DeclSpec.h:548
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
clang::DeclSpec::isVirtualSpecified
bool isVirtualSpecified() const
Definition: DeclSpec.h:579
clang::DeclaratorChunk
One instance of this struct is used for each type in a declarator that is parsed.
Definition: DeclSpec.h:1174
clang::UnqualifiedId::setOperatorFunctionId
void setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3])
Specify that this unqualified-id was parsed as an operator-function-id.
Definition: DeclSpec.cpp:1443
clang::NestedNameSpecifierLocBuilder::MakeTrivial
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
Definition: NestedNameSpecifier.cpp:631
clang::TemplateIdAnnotation::isInvalid
bool isInvalid() const
Definition: ParsedTemplate.h:234
clang::TST_BFloat16
@ TST_BFloat16
Definition: Specifiers.h:58
clang::DeclSpec::TST_struct
static const TST TST_struct
Definition: DeclSpec.h:285
clang::DeclSpec::TQ_restrict
@ TQ_restrict
Definition: DeclSpec.h:307
clang::DeclSpec::ExprRep
Expr * ExprRep
Definition: DeclSpec.h:363
clang::TST_typeofType
@ TST_typeofType
Definition: Specifiers.h:73
clang::DeclSpec::SetTypeAltiVecVector
bool SetTypeAltiVecVector(bool isAltiVecVector, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
Definition: DeclSpec.cpp:861
clang::DeclSpec::TQ_const
@ TQ_const
Definition: DeclSpec.h:306
clang::TST_float128
@ TST_float128
Definition: Specifiers.h:61
clang::CXXScopeSpec::MakeTrivial
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
Definition: DeclSpec.cpp:125
clang::DeclaratorChunk::FunctionTypeInfo::ExceptionSpecLocEnd
SourceLocation ExceptionSpecLocEnd
The end location of the exception specification, if any.
Definition: DeclSpec.h:1336
clang::DeclSpec::TST_typeofExpr
static const TST TST_typeofExpr
Definition: DeclSpec.h:290
clang::DeclSpec::Finish
void Finish(Sema &S, const PrintingPolicy &Policy)
Finish - This does final analysis of the declspec, issuing diagnostics for things like "_Imaginary" (...
Definition: DeclSpec.cpp:1115
clang::EST_NoexceptFalse
@ EST_NoexceptFalse
noexcept(expression), evals to 'false'
Definition: ExceptionSpecificationType.h:28
clang::UnqualifiedId::isValid
bool isValid() const
Determine whether this unqualified-id refers to a valid name.
Definition: DeclSpec.h:1027
clang::Expr
This represents one expression.
Definition: Expr.h:109
clang::DeclSpec::TST_wchar
static const TST TST_wchar
Definition: DeclSpec.h:263
clang::DeclaratorChunk::Paren
@ Paren
Definition: DeclSpec.h:1178
clang::DeclSpec::TypeRep
UnionParsedType TypeRep
Definition: DeclSpec.h:361
clang::TST_Fract
@ TST_Fract
Definition: Specifiers.h:57
clang::VirtSpecifiers::SetSpecifier
bool SetSpecifier(Specifier VS, SourceLocation Loc, const char *&PrevSpec)
Definition: DeclSpec.cpp:1459
clang::TypeSpecifierWidth::Short
@ Short
clang::WrittenBuiltinSpecs::Width
unsigned Width
Definition: Specifiers.h:93
clang::IdentifierLoc
Wraps an identifier and optional source location for the identifier.
Definition: ParsedAttr.h:187
clang::DeclSpec::TSCS__Thread_local
static const TSCS TSCS__Thread_local
Definition: DeclSpec.h:250
clang::TST_decltype_auto
@ TST_decltype_auto
Definition: Specifiers.h:78
clang::DeclSpec::TST_auto
static const TST TST_auto
Definition: DeclSpec.h:294
clang::TST_union
@ TST_union
Definition: Specifiers.h:68
clang::TST_double
@ TST_double
Definition: Specifiers.h:60
clang::DeclSpec::TST_char16
static const TST TST_char16
Definition: DeclSpec.h:265
clang::NamespaceDecl
Represent a C++ namespace.
Definition: Decl.h:542
clang::DeclaratorChunk::FunctionTypeInfo::NumExceptionsOrDecls
unsigned NumExceptionsOrDecls
NumExceptionsOrDecls - This is the number of types in the dynamic-exception-decl, if the function has...
Definition: DeclSpec.h:1321
clang::DeclaratorChunk::Array
@ Array
Definition: DeclSpec.h:1178
clang::DeclSpec::getAttributePool
AttributePool & getAttributePool() const
Definition: DeclSpec.h:769
clang::DeclSpec::SetTypeSpecWidth
bool SetTypeSpecWidth(TypeSpecifierWidth W, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
These methods set the specified attribute of the DeclSpec, but return true and ignore the request if ...
Definition: DeclSpec.cpp:694
clang::TypeSpecifierWidth::Long
@ Long
clang::WrittenBuiltinSpecs::ModeAttr
unsigned ModeAttr
Definition: Specifiers.h:94
clang::ActionResult::isUsable
bool isUsable() const
Definition: Ownership.h:166
clang::UnqualifiedId::getKind
UnqualifiedIdKind getKind() const
Determine what kind of name we have.
Definition: DeclSpec.h:1033
clang::DeclSpec::SetTypeSpecType
bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
Definition: DeclSpec.cpp:824
clang::DeclSpec
Captures information about "declaration specifiers".
Definition: DeclSpec.h:229
clang::DeclSpec::SCS_extern
@ SCS_extern
Definition: DeclSpec.h:236
clang::DeclSpec::TSCS_thread_local
static const TSCS TSCS_thread_local
Definition: DeclSpec.h:249
clang::DeclSpec::getRepAsType
ParsedType getRepAsType() const
Definition: DeclSpec.h:487
TypeLoc.h
clang::NestedNameSpecifierLocBuilder::getWithLocInContext
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
Definition: NestedNameSpecifier.cpp:692
clang::UnqualifiedIdKind::IK_ConstructorTemplateId
@ IK_ConstructorTemplateId
A constructor named via a template-id.
ParsedTemplate.h
clang::ParsedAttributes::takeAllFrom
void takeAllFrom(ParsedAttributes &attrs)
Definition: ParsedAttr.h:972
clang::TypeSpecifierType
TypeSpecifierType
Specifies the kind of type.
Definition: Specifiers.h:43
clang::ConstexprSpecKind::Unspecified
@ Unspecified
clang::DeclSpec::SetTypeAltiVecBool
bool SetTypeAltiVecBool(bool isAltiVecBool, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
Definition: DeclSpec.cpp:910
clang::DeclSpec::TemplateIdRep
TemplateIdAnnotation * TemplateIdRep
Definition: DeclSpec.h:364
clang::DeclSpec::PQ_StorageClassSpecifier
@ PQ_StorageClassSpecifier
Definition: DeclSpec.h:319
clang::DeclSpec::SetExtIntType
bool SetExtIntType(SourceLocation KWLoc, Expr *BitWidth, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
Definition: DeclSpec.cpp:935
clang::DeclSpec::getThreadStorageClassSpec
TSCS getThreadStorageClassSpec() const
Definition: DeclSpec.h:442