clang  3.9.0
DeclSpec.cpp
Go to the documentation of this file.
1 //===--- DeclSpec.cpp - Declaration Specifier Semantic Analysis -----------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements semantic analysis for declaration specifiers.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "clang/Sema/DeclSpec.h"
15 #include "clang/AST/ASTContext.h"
16 #include "clang/AST/DeclCXX.h"
17 #include "clang/AST/Expr.h"
18 #include "clang/AST/LocInfoType.h"
19 #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?");
34  this->TemplateId = TemplateId;
35  StartLocation = TemplateId->TemplateNameLoc;
36  EndLocation = TemplateId->RAngleLoc;
37 }
38 
40  assert(TemplateId && "NULL template-id annotation?");
42  this->TemplateId = TemplateId;
43  StartLocation = TemplateId->TemplateNameLoc;
44  EndLocation = TemplateId->RAngleLoc;
45 }
46 
48  TypeLoc TL, SourceLocation ColonColonLoc) {
49  Builder.Extend(Context, TemplateKWLoc, TL, ColonColonLoc);
50  if (Range.getBegin().isInvalid())
51  Range.setBegin(TL.getBeginLoc());
52  Range.setEnd(ColonColonLoc);
53 
54  assert(Range == Builder.getSourceRange() &&
55  "NestedNameSpecifierLoc range computation incorrect");
56 }
57 
60  SourceLocation ColonColonLoc) {
61  Builder.Extend(Context, Identifier, IdentifierLoc, ColonColonLoc);
62 
63  if (Range.getBegin().isInvalid())
64  Range.setBegin(IdentifierLoc);
65  Range.setEnd(ColonColonLoc);
66 
67  assert(Range == Builder.getSourceRange() &&
68  "NestedNameSpecifierLoc range computation incorrect");
69 }
70 
72  SourceLocation NamespaceLoc,
73  SourceLocation ColonColonLoc) {
74  Builder.Extend(Context, Namespace, NamespaceLoc, ColonColonLoc);
75 
76  if (Range.getBegin().isInvalid())
77  Range.setBegin(NamespaceLoc);
78  Range.setEnd(ColonColonLoc);
79 
80  assert(Range == Builder.getSourceRange() &&
81  "NestedNameSpecifierLoc range computation incorrect");
82 }
83 
85  SourceLocation AliasLoc,
86  SourceLocation ColonColonLoc) {
87  Builder.Extend(Context, Alias, AliasLoc, ColonColonLoc);
88 
89  if (Range.getBegin().isInvalid())
90  Range.setBegin(AliasLoc);
91  Range.setEnd(ColonColonLoc);
92 
93  assert(Range == Builder.getSourceRange() &&
94  "NestedNameSpecifierLoc range computation incorrect");
95 }
96 
98  SourceLocation ColonColonLoc) {
99  Builder.MakeGlobal(Context, ColonColonLoc);
100 
101  Range = SourceRange(ColonColonLoc);
102 
103  assert(Range == Builder.getSourceRange() &&
104  "NestedNameSpecifierLoc range computation incorrect");
105 }
106 
108  SourceLocation SuperLoc,
109  SourceLocation ColonColonLoc) {
110  Builder.MakeSuper(Context, RD, SuperLoc, ColonColonLoc);
111 
112  Range.setBegin(SuperLoc);
113  Range.setEnd(ColonColonLoc);
114 
115  assert(Range == Builder.getSourceRange() &&
116  "NestedNameSpecifierLoc range computation incorrect");
117 }
118 
120  NestedNameSpecifier *Qualifier, SourceRange R) {
121  Builder.MakeTrivial(Context, Qualifier, R);
122  Range = R;
123 }
124 
126  if (!Other) {
127  Range = SourceRange();
128  Builder.Clear();
129  return;
130  }
131 
132  Range = Other.getSourceRange();
133  Builder.Adopt(Other);
134 }
135 
137  if (!Builder.getRepresentation())
138  return SourceLocation();
139  return Builder.getTemporary().getLocalBeginLoc();
140 }
141 
144  if (!Builder.getRepresentation())
145  return NestedNameSpecifierLoc();
146 
147  return Builder.getWithLocInContext(Context);
148 }
149 
150 /// DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
151 /// "TheDeclarator" is the declarator that this will be added to.
153  bool isAmbiguous,
154  SourceLocation LParenLoc,
155  ParamInfo *Params,
156  unsigned NumParams,
157  SourceLocation EllipsisLoc,
158  SourceLocation RParenLoc,
159  unsigned TypeQuals,
160  bool RefQualifierIsLvalueRef,
161  SourceLocation RefQualifierLoc,
162  SourceLocation ConstQualifierLoc,
164  VolatileQualifierLoc,
166  RestrictQualifierLoc,
167  SourceLocation MutableLoc,
169  ESpecType,
170  SourceRange ESpecRange,
171  ParsedType *Exceptions,
172  SourceRange *ExceptionRanges,
173  unsigned NumExceptions,
174  Expr *NoexceptExpr,
175  CachedTokens *ExceptionSpecTokens,
176  SourceLocation LocalRangeBegin,
177  SourceLocation LocalRangeEnd,
178  Declarator &TheDeclarator,
179  TypeResult TrailingReturnType) {
180  assert(!(TypeQuals & DeclSpec::TQ_atomic) &&
181  "function cannot have _Atomic qualifier");
182 
184  I.Kind = Function;
185  I.Loc = LocalRangeBegin;
186  I.EndLoc = LocalRangeEnd;
187  I.Fun.AttrList = nullptr;
188  I.Fun.hasPrototype = hasProto;
189  I.Fun.isVariadic = EllipsisLoc.isValid();
190  I.Fun.isAmbiguous = isAmbiguous;
191  I.Fun.LParenLoc = LParenLoc.getRawEncoding();
192  I.Fun.EllipsisLoc = EllipsisLoc.getRawEncoding();
193  I.Fun.RParenLoc = RParenLoc.getRawEncoding();
194  I.Fun.DeleteParams = false;
195  I.Fun.TypeQuals = TypeQuals;
196  I.Fun.NumParams = NumParams;
197  I.Fun.Params = nullptr;
198  I.Fun.RefQualifierIsLValueRef = RefQualifierIsLvalueRef;
199  I.Fun.RefQualifierLoc = RefQualifierLoc.getRawEncoding();
200  I.Fun.ConstQualifierLoc = ConstQualifierLoc.getRawEncoding();
201  I.Fun.VolatileQualifierLoc = VolatileQualifierLoc.getRawEncoding();
202  I.Fun.RestrictQualifierLoc = RestrictQualifierLoc.getRawEncoding();
203  I.Fun.MutableLoc = MutableLoc.getRawEncoding();
204  I.Fun.ExceptionSpecType = ESpecType;
205  I.Fun.ExceptionSpecLocBeg = ESpecRange.getBegin().getRawEncoding();
206  I.Fun.ExceptionSpecLocEnd = ESpecRange.getEnd().getRawEncoding();
207  I.Fun.NumExceptions = 0;
208  I.Fun.Exceptions = nullptr;
209  I.Fun.NoexceptExpr = nullptr;
210  I.Fun.HasTrailingReturnType = TrailingReturnType.isUsable() ||
211  TrailingReturnType.isInvalid();
212  I.Fun.TrailingReturnType = TrailingReturnType.get();
213 
214  assert(I.Fun.TypeQuals == TypeQuals && "bitfield overflow");
215  assert(I.Fun.ExceptionSpecType == ESpecType && "bitfield overflow");
216 
217  // new[] a parameter array if needed.
218  if (NumParams) {
219  // If the 'InlineParams' in Declarator is unused and big enough, put our
220  // parameter list there (in an effort to avoid new/delete traffic). If it
221  // is already used (consider a function returning a function pointer) or too
222  // small (function with too many parameters), go to the heap.
223  if (!TheDeclarator.InlineParamsUsed &&
224  NumParams <= llvm::array_lengthof(TheDeclarator.InlineParams)) {
225  I.Fun.Params = TheDeclarator.InlineParams;
226  I.Fun.DeleteParams = false;
227  TheDeclarator.InlineParamsUsed = true;
228  } else {
229  I.Fun.Params = new DeclaratorChunk::ParamInfo[NumParams];
230  I.Fun.DeleteParams = true;
231  }
232  memcpy(I.Fun.Params, Params, sizeof(Params[0]) * NumParams);
233  }
234 
235  // Check what exception specification information we should actually store.
236  switch (ESpecType) {
237  default: break; // By default, save nothing.
238  case EST_Dynamic:
239  // new[] an exception array if needed
240  if (NumExceptions) {
241  I.Fun.NumExceptions = NumExceptions;
242  I.Fun.Exceptions = new DeclaratorChunk::TypeAndRange[NumExceptions];
243  for (unsigned i = 0; i != NumExceptions; ++i) {
244  I.Fun.Exceptions[i].Ty = Exceptions[i];
245  I.Fun.Exceptions[i].Range = ExceptionRanges[i];
246  }
247  }
248  break;
249 
251  I.Fun.NoexceptExpr = NoexceptExpr;
252  break;
253 
254  case EST_Unparsed:
255  I.Fun.ExceptionSpecTokens = ExceptionSpecTokens;
256  break;
257  }
258  return I;
259 }
260 
262  for (unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
263  switch (DeclTypeInfo[i].Kind) {
265  return true;
267  continue;
274  return false;
275  }
276  llvm_unreachable("Invalid type chunk");
277  }
278 
279  switch (DS.getTypeSpecType()) {
280  case TST_atomic:
281  case TST_auto:
282  case TST_auto_type:
283  case TST_bool:
284  case TST_char:
285  case TST_char16:
286  case TST_char32:
287  case TST_class:
288  case TST_decimal128:
289  case TST_decimal32:
290  case TST_decimal64:
291  case TST_double:
292  case TST_float128:
293  case TST_enum:
294  case TST_error:
295  case TST_float:
296  case TST_half:
297  case TST_int:
298  case TST_int128:
299  case TST_struct:
300  case TST_interface:
301  case TST_union:
302  case TST_unknown_anytype:
303  case TST_unspecified:
304  case TST_void:
305  case TST_wchar:
306 #define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t:
307 #include "clang/Basic/OpenCLImageTypes.def"
308  return false;
309 
310  case TST_decltype_auto:
311  // This must have an initializer, so can't be a function declaration,
312  // even if the initializer has function type.
313  return false;
314 
315  case TST_decltype:
316  case TST_typeofExpr:
317  if (Expr *E = DS.getRepAsExpr())
318  return E->getType()->isFunctionType();
319  return false;
320 
321  case TST_underlyingType:
322  case TST_typename:
323  case TST_typeofType: {
324  QualType QT = DS.getRepAsType().get();
325  if (QT.isNull())
326  return false;
327 
328  if (const LocInfoType *LIT = dyn_cast<LocInfoType>(QT))
329  QT = LIT->getType();
330 
331  if (QT.isNull())
332  return false;
333 
334  return QT->isFunctionType();
335  }
336  }
337 
338  llvm_unreachable("Invalid TypeSpecType!");
339 }
340 
342  assert(getContext() == MemberContext);
346  getName().OperatorFunctionId.Operator));
347 }
348 
352 }
353 
355  if (!TypeSpecOwned)
356  return false;
357  return cast<TagDecl>(getRepAsDecl())->isCompleteDefinition();
358 }
359 
360 /// getParsedSpecifiers - Return a bitmask of which flavors of specifiers this
361 /// declaration specifier includes.
362 ///
364  unsigned Res = 0;
365  if (StorageClassSpec != SCS_unspecified ||
366  ThreadStorageClassSpec != TSCS_unspecified)
368 
369  if (TypeQualifiers != TQ_unspecified)
370  Res |= PQ_TypeQualifier;
371 
372  if (hasTypeSpecifier())
373  Res |= PQ_TypeSpecifier;
374 
375  if (FS_inline_specified || FS_virtual_specified || FS_explicit_specified ||
376  FS_noreturn_specified || FS_forceinline_specified)
377  Res |= PQ_FunctionSpecifier;
378  return Res;
379 }
380 
381 template <class T> static bool BadSpecifier(T TNew, T TPrev,
382  const char *&PrevSpec,
383  unsigned &DiagID,
384  bool IsExtension = true) {
385  PrevSpec = DeclSpec::getSpecifierName(TPrev);
386  if (TNew != TPrev)
387  DiagID = diag::err_invalid_decl_spec_combination;
388  else
389  DiagID = IsExtension ? diag::ext_duplicate_declspec :
390  diag::warn_duplicate_declspec;
391  return true;
392 }
393 
395  switch (S) {
396  case DeclSpec::SCS_unspecified: return "unspecified";
397  case DeclSpec::SCS_typedef: return "typedef";
398  case DeclSpec::SCS_extern: return "extern";
399  case DeclSpec::SCS_static: return "static";
400  case DeclSpec::SCS_auto: return "auto";
401  case DeclSpec::SCS_register: return "register";
402  case DeclSpec::SCS_private_extern: return "__private_extern__";
403  case DeclSpec::SCS_mutable: return "mutable";
404  }
405  llvm_unreachable("Unknown typespec!");
406 }
407 
409  switch (S) {
410  case DeclSpec::TSCS_unspecified: return "unspecified";
411  case DeclSpec::TSCS___thread: return "__thread";
412  case DeclSpec::TSCS_thread_local: return "thread_local";
413  case DeclSpec::TSCS__Thread_local: return "_Thread_local";
414  }
415  llvm_unreachable("Unknown typespec!");
416 }
417 
419  switch (W) {
420  case TSW_unspecified: return "unspecified";
421  case TSW_short: return "short";
422  case TSW_long: return "long";
423  case TSW_longlong: return "long long";
424  }
425  llvm_unreachable("Unknown typespec!");
426 }
427 
429  switch (C) {
430  case TSC_unspecified: return "unspecified";
431  case TSC_imaginary: return "imaginary";
432  case TSC_complex: return "complex";
433  }
434  llvm_unreachable("Unknown typespec!");
435 }
436 
437 
439  switch (S) {
440  case TSS_unspecified: return "unspecified";
441  case TSS_signed: return "signed";
442  case TSS_unsigned: return "unsigned";
443  }
444  llvm_unreachable("Unknown typespec!");
445 }
446 
448  const PrintingPolicy &Policy) {
449  switch (T) {
450  case DeclSpec::TST_unspecified: return "unspecified";
451  case DeclSpec::TST_void: return "void";
452  case DeclSpec::TST_char: return "char";
453  case DeclSpec::TST_wchar: return Policy.MSWChar ? "__wchar_t" : "wchar_t";
454  case DeclSpec::TST_char16: return "char16_t";
455  case DeclSpec::TST_char32: return "char32_t";
456  case DeclSpec::TST_int: return "int";
457  case DeclSpec::TST_int128: return "__int128";
458  case DeclSpec::TST_half: return "half";
459  case DeclSpec::TST_float: return "float";
460  case DeclSpec::TST_double: return "double";
461  case DeclSpec::TST_float128: return "__float128";
462  case DeclSpec::TST_bool: return Policy.Bool ? "bool" : "_Bool";
463  case DeclSpec::TST_decimal32: return "_Decimal32";
464  case DeclSpec::TST_decimal64: return "_Decimal64";
465  case DeclSpec::TST_decimal128: return "_Decimal128";
466  case DeclSpec::TST_enum: return "enum";
467  case DeclSpec::TST_class: return "class";
468  case DeclSpec::TST_union: return "union";
469  case DeclSpec::TST_struct: return "struct";
470  case DeclSpec::TST_interface: return "__interface";
471  case DeclSpec::TST_typename: return "type-name";
473  case DeclSpec::TST_typeofExpr: return "typeof";
474  case DeclSpec::TST_auto: return "auto";
475  case DeclSpec::TST_auto_type: return "__auto_type";
476  case DeclSpec::TST_decltype: return "(decltype)";
477  case DeclSpec::TST_decltype_auto: return "decltype(auto)";
478  case DeclSpec::TST_underlyingType: return "__underlying_type";
479  case DeclSpec::TST_unknown_anytype: return "__unknown_anytype";
480  case DeclSpec::TST_atomic: return "_Atomic";
481 #define GENERIC_IMAGE_TYPE(ImgType, Id) \
482  case DeclSpec::TST_##ImgType##_t: \
483  return #ImgType "_t";
484 #include "clang/Basic/OpenCLImageTypes.def"
485  case DeclSpec::TST_error: return "(error)";
486  }
487  llvm_unreachable("Unknown typespec!");
488 }
489 
491  switch (T) {
492  case DeclSpec::TQ_unspecified: return "unspecified";
493  case DeclSpec::TQ_const: return "const";
494  case DeclSpec::TQ_restrict: return "restrict";
495  case DeclSpec::TQ_volatile: return "volatile";
496  case DeclSpec::TQ_atomic: return "_Atomic";
497  case DeclSpec::TQ_unaligned: return "__unaligned";
498  }
499  llvm_unreachable("Unknown typespec!");
500 }
501 
503  const char *&PrevSpec,
504  unsigned &DiagID,
505  const PrintingPolicy &Policy) {
506  // OpenCL v1.1 s6.8g: "The extern, static, auto and register storage-class
507  // specifiers are not supported.
508  // It seems sensible to prohibit private_extern too
509  // The cl_clang_storage_class_specifiers extension enables support for
510  // these storage-class specifiers.
511  // OpenCL v1.2 s6.8 changes this to "The auto and register storage-class
512  // specifiers are not supported."
513  if (S.getLangOpts().OpenCL &&
514  !S.getOpenCLOptions().cl_clang_storage_class_specifiers) {
515  switch (SC) {
516  case SCS_extern:
517  case SCS_private_extern:
518  case SCS_static:
519  if (S.getLangOpts().OpenCLVersion < 120) {
520  DiagID = diag::err_opencl_unknown_type_specifier;
521  PrevSpec = getSpecifierName(SC);
522  return true;
523  }
524  break;
525  case SCS_auto:
526  case SCS_register:
527  DiagID = diag::err_opencl_unknown_type_specifier;
528  PrevSpec = getSpecifierName(SC);
529  return true;
530  default:
531  break;
532  }
533  }
534 
535  if (StorageClassSpec != SCS_unspecified) {
536  // Maybe this is an attempt to use C++11 'auto' outside of C++11 mode.
537  bool isInvalid = true;
538  if (TypeSpecType == TST_unspecified && S.getLangOpts().CPlusPlus) {
539  if (SC == SCS_auto)
540  return SetTypeSpecType(TST_auto, Loc, PrevSpec, DiagID, Policy);
541  if (StorageClassSpec == SCS_auto) {
542  isInvalid = SetTypeSpecType(TST_auto, StorageClassSpecLoc,
543  PrevSpec, DiagID, Policy);
544  assert(!isInvalid && "auto SCS -> TST recovery failed");
545  }
546  }
547 
548  // Changing storage class is allowed only if the previous one
549  // was the 'extern' that is part of a linkage specification and
550  // the new storage class is 'typedef'.
551  if (isInvalid &&
552  !(SCS_extern_in_linkage_spec &&
553  StorageClassSpec == SCS_extern &&
554  SC == SCS_typedef))
555  return BadSpecifier(SC, (SCS)StorageClassSpec, PrevSpec, DiagID);
556  }
557  StorageClassSpec = SC;
558  StorageClassSpecLoc = Loc;
559  assert((unsigned)SC == StorageClassSpec && "SCS constants overflow bitfield");
560  return false;
561 }
562 
564  const char *&PrevSpec,
565  unsigned &DiagID) {
566  if (ThreadStorageClassSpec != TSCS_unspecified)
567  return BadSpecifier(TSC, (TSCS)ThreadStorageClassSpec, PrevSpec, DiagID);
568 
569  ThreadStorageClassSpec = TSC;
570  ThreadStorageClassSpecLoc = Loc;
571  return false;
572 }
573 
574 /// These methods set the specified attribute of the DeclSpec, but return true
575 /// and ignore the request if invalid (e.g. "extern" then "auto" is
576 /// specified).
578  const char *&PrevSpec,
579  unsigned &DiagID,
580  const PrintingPolicy &Policy) {
581  // Overwrite TSWLoc only if TypeSpecWidth was unspecified, so that
582  // for 'long long' we will keep the source location of the first 'long'.
583  if (TypeSpecWidth == TSW_unspecified)
584  TSWLoc = Loc;
585  // Allow turning long -> long long.
586  else if (W != TSW_longlong || TypeSpecWidth != TSW_long)
587  return BadSpecifier(W, (TSW)TypeSpecWidth, PrevSpec, DiagID);
588  TypeSpecWidth = W;
589  return false;
590 }
591 
593  const char *&PrevSpec,
594  unsigned &DiagID) {
595  if (TypeSpecComplex != TSC_unspecified)
596  return BadSpecifier(C, (TSC)TypeSpecComplex, PrevSpec, DiagID);
597  TypeSpecComplex = C;
598  TSCLoc = Loc;
599  return false;
600 }
601 
603  const char *&PrevSpec,
604  unsigned &DiagID) {
605  if (TypeSpecSign != TSS_unspecified)
606  return BadSpecifier(S, (TSS)TypeSpecSign, PrevSpec, DiagID);
607  TypeSpecSign = S;
608  TSSLoc = Loc;
609  return false;
610 }
611 
613  const char *&PrevSpec,
614  unsigned &DiagID,
615  ParsedType Rep,
616  const PrintingPolicy &Policy) {
617  return SetTypeSpecType(T, Loc, Loc, PrevSpec, DiagID, Rep, Policy);
618 }
619 
621  SourceLocation TagNameLoc,
622  const char *&PrevSpec,
623  unsigned &DiagID,
624  ParsedType Rep,
625  const PrintingPolicy &Policy) {
626  assert(isTypeRep(T) && "T does not store a type");
627  assert(Rep && "no type provided!");
628  if (TypeSpecType != TST_unspecified) {
629  PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType, Policy);
630  DiagID = diag::err_invalid_decl_spec_combination;
631  return true;
632  }
633  TypeSpecType = T;
634  TypeRep = Rep;
635  TSTLoc = TagKwLoc;
636  TSTNameLoc = TagNameLoc;
637  TypeSpecOwned = false;
638  return false;
639 }
640 
642  const char *&PrevSpec,
643  unsigned &DiagID,
644  Expr *Rep,
645  const PrintingPolicy &Policy) {
646  assert(isExprRep(T) && "T does not store an expr");
647  assert(Rep && "no expression provided!");
648  if (TypeSpecType != TST_unspecified) {
649  PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType, Policy);
650  DiagID = diag::err_invalid_decl_spec_combination;
651  return true;
652  }
653  TypeSpecType = T;
654  ExprRep = Rep;
655  TSTLoc = Loc;
656  TSTNameLoc = Loc;
657  TypeSpecOwned = false;
658  return false;
659 }
660 
662  const char *&PrevSpec,
663  unsigned &DiagID,
664  Decl *Rep, bool Owned,
665  const PrintingPolicy &Policy) {
666  return SetTypeSpecType(T, Loc, Loc, PrevSpec, DiagID, Rep, Owned, Policy);
667 }
668 
670  SourceLocation TagNameLoc,
671  const char *&PrevSpec,
672  unsigned &DiagID,
673  Decl *Rep, bool Owned,
674  const PrintingPolicy &Policy) {
675  assert(isDeclRep(T) && "T does not store a decl");
676  // Unlike the other cases, we don't assert that we actually get a decl.
677 
678  if (TypeSpecType != TST_unspecified) {
679  PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType, Policy);
680  DiagID = diag::err_invalid_decl_spec_combination;
681  return true;
682  }
683  TypeSpecType = T;
684  DeclRep = Rep;
685  TSTLoc = TagKwLoc;
686  TSTNameLoc = TagNameLoc;
687  TypeSpecOwned = Owned && Rep != nullptr;
688  return false;
689 }
690 
692  const char *&PrevSpec,
693  unsigned &DiagID,
694  const PrintingPolicy &Policy) {
695  assert(!isDeclRep(T) && !isTypeRep(T) && !isExprRep(T) &&
696  "rep required for these type-spec kinds!");
697  if (TypeSpecType != TST_unspecified) {
698  PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType, Policy);
699  DiagID = diag::err_invalid_decl_spec_combination;
700  return true;
701  }
702  TSTLoc = Loc;
703  TSTNameLoc = Loc;
704  if (TypeAltiVecVector && (T == TST_bool) && !TypeAltiVecBool) {
705  TypeAltiVecBool = true;
706  return false;
707  }
708  TypeSpecType = T;
709  TypeSpecOwned = false;
710  return false;
711 }
712 
713 bool DeclSpec::SetTypeAltiVecVector(bool isAltiVecVector, SourceLocation Loc,
714  const char *&PrevSpec, unsigned &DiagID,
715  const PrintingPolicy &Policy) {
716  if (TypeSpecType != TST_unspecified) {
717  PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType, Policy);
718  DiagID = diag::err_invalid_vector_decl_spec_combination;
719  return true;
720  }
721  TypeAltiVecVector = isAltiVecVector;
722  AltiVecLoc = Loc;
723  return false;
724 }
725 
726 bool DeclSpec::SetTypePipe(bool isPipe, SourceLocation Loc,
727  const char *&PrevSpec, unsigned &DiagID,
728  const PrintingPolicy &Policy) {
729 
730  if (TypeSpecType != TST_unspecified) {
731  PrevSpec = DeclSpec::getSpecifierName((TST)TypeSpecType, Policy);
732  DiagID = diag::err_invalid_decl_spec_combination;
733  return true;
734  }
735 
736  if (isPipe) {
737  TypeSpecPipe = TSP_pipe;
738  }
739  return false;
740 }
741 
742 bool DeclSpec::SetTypeAltiVecPixel(bool isAltiVecPixel, SourceLocation Loc,
743  const char *&PrevSpec, unsigned &DiagID,
744  const PrintingPolicy &Policy) {
745  if (!TypeAltiVecVector || TypeAltiVecPixel ||
746  (TypeSpecType != TST_unspecified)) {
747  PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType, Policy);
748  DiagID = diag::err_invalid_pixel_decl_spec_combination;
749  return true;
750  }
751  TypeAltiVecPixel = isAltiVecPixel;
752  TSTLoc = Loc;
753  TSTNameLoc = Loc;
754  return false;
755 }
756 
757 bool DeclSpec::SetTypeAltiVecBool(bool isAltiVecBool, SourceLocation Loc,
758  const char *&PrevSpec, unsigned &DiagID,
759  const PrintingPolicy &Policy) {
760  if (!TypeAltiVecVector || TypeAltiVecBool ||
761  (TypeSpecType != TST_unspecified)) {
762  PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType, Policy);
763  DiagID = diag::err_invalid_vector_bool_decl_spec;
764  return true;
765  }
766  TypeAltiVecBool = isAltiVecBool;
767  TSTLoc = Loc;
768  TSTNameLoc = Loc;
769  return false;
770 }
771 
773  TypeSpecType = TST_error;
774  TypeSpecOwned = false;
775  TSTLoc = SourceLocation();
776  TSTNameLoc = SourceLocation();
777  return false;
778 }
779 
780 bool DeclSpec::SetTypeQual(TQ T, SourceLocation Loc, const char *&PrevSpec,
781  unsigned &DiagID, const LangOptions &Lang) {
782  // Duplicates are permitted in C99 onwards, but are not permitted in C89 or
783  // C++. However, since this is likely not what the user intended, we will
784  // always warn. We do not need to set the qualifier's location since we
785  // already have it.
786  if (TypeQualifiers & T) {
787  bool IsExtension = true;
788  if (Lang.C99)
789  IsExtension = false;
790  return BadSpecifier(T, T, PrevSpec, DiagID, IsExtension);
791  }
792  TypeQualifiers |= T;
793 
794  switch (T) {
795  case TQ_unspecified: break;
796  case TQ_const: TQ_constLoc = Loc; return false;
797  case TQ_restrict: TQ_restrictLoc = Loc; return false;
798  case TQ_volatile: TQ_volatileLoc = Loc; return false;
799  case TQ_unaligned: TQ_unalignedLoc = Loc; return false;
800  case TQ_atomic: TQ_atomicLoc = Loc; return false;
801  }
802 
803  llvm_unreachable("Unknown type qualifier!");
804 }
805 
806 bool DeclSpec::setFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec,
807  unsigned &DiagID) {
808  // 'inline inline' is ok. However, since this is likely not what the user
809  // intended, we will always warn, similar to duplicates of type qualifiers.
810  if (FS_inline_specified) {
811  DiagID = diag::warn_duplicate_declspec;
812  PrevSpec = "inline";
813  return true;
814  }
815  FS_inline_specified = true;
816  FS_inlineLoc = Loc;
817  return false;
818 }
819 
820 bool DeclSpec::setFunctionSpecForceInline(SourceLocation Loc, const char *&PrevSpec,
821  unsigned &DiagID) {
822  if (FS_forceinline_specified) {
823  DiagID = diag::warn_duplicate_declspec;
824  PrevSpec = "__forceinline";
825  return true;
826  }
827  FS_forceinline_specified = true;
828  FS_forceinlineLoc = Loc;
829  return false;
830 }
831 
833  const char *&PrevSpec,
834  unsigned &DiagID) {
835  // 'virtual virtual' is ok, but warn as this is likely not what the user
836  // intended.
837  if (FS_virtual_specified) {
838  DiagID = diag::warn_duplicate_declspec;
839  PrevSpec = "virtual";
840  return true;
841  }
842  FS_virtual_specified = true;
843  FS_virtualLoc = Loc;
844  return false;
845 }
846 
848  const char *&PrevSpec,
849  unsigned &DiagID) {
850  // 'explicit explicit' is ok, but warn as this is likely not what the user
851  // intended.
852  if (FS_explicit_specified) {
853  DiagID = diag::warn_duplicate_declspec;
854  PrevSpec = "explicit";
855  return true;
856  }
857  FS_explicit_specified = true;
858  FS_explicitLoc = Loc;
859  return false;
860 }
861 
863  const char *&PrevSpec,
864  unsigned &DiagID) {
865  // '_Noreturn _Noreturn' is ok, but warn as this is likely not what the user
866  // intended.
867  if (FS_noreturn_specified) {
868  DiagID = diag::warn_duplicate_declspec;
869  PrevSpec = "_Noreturn";
870  return true;
871  }
872  FS_noreturn_specified = true;
873  FS_noreturnLoc = Loc;
874  return false;
875 }
876 
877 bool DeclSpec::SetFriendSpec(SourceLocation Loc, const char *&PrevSpec,
878  unsigned &DiagID) {
879  if (Friend_specified) {
880  PrevSpec = "friend";
881  // Keep the later location, so that we can later diagnose ill-formed
882  // declarations like 'friend class X friend;'. Per [class.friend]p3,
883  // 'friend' must be the first token in a friend declaration that is
884  // not a function declaration.
885  FriendLoc = Loc;
886  DiagID = diag::warn_duplicate_declspec;
887  return true;
888  }
889 
890  Friend_specified = true;
891  FriendLoc = Loc;
892  return false;
893 }
894 
895 bool DeclSpec::setModulePrivateSpec(SourceLocation Loc, const char *&PrevSpec,
896  unsigned &DiagID) {
897  if (isModulePrivateSpecified()) {
898  PrevSpec = "__module_private__";
899  DiagID = diag::ext_duplicate_declspec;
900  return true;
901  }
902 
903  ModulePrivateLoc = Loc;
904  return false;
905 }
906 
907 bool DeclSpec::SetConstexprSpec(SourceLocation Loc, const char *&PrevSpec,
908  unsigned &DiagID) {
909  // 'constexpr constexpr' is ok, but warn as this is likely not what the user
910  // intended.
911  if (Constexpr_specified) {
912  DiagID = diag::warn_duplicate_declspec;
913  PrevSpec = "constexpr";
914  return true;
915  }
916  Constexpr_specified = true;
917  ConstexprLoc = Loc;
918  return false;
919 }
920 
921 bool DeclSpec::SetConceptSpec(SourceLocation Loc, const char *&PrevSpec,
922  unsigned &DiagID) {
923  if (Concept_specified) {
924  DiagID = diag::ext_duplicate_declspec;
925  PrevSpec = "concept";
926  return true;
927  }
928  Concept_specified = true;
929  ConceptLoc = Loc;
930  return false;
931 }
932 
933 void DeclSpec::SaveWrittenBuiltinSpecs() {
934  writtenBS.Sign = getTypeSpecSign();
935  writtenBS.Width = getTypeSpecWidth();
936  writtenBS.Type = getTypeSpecType();
937  // Search the list of attributes for the presence of a mode attribute.
938  writtenBS.ModeAttr = false;
939  AttributeList* attrs = getAttributes().getList();
940  while (attrs) {
941  if (attrs->getKind() == AttributeList::AT_Mode) {
942  writtenBS.ModeAttr = true;
943  break;
944  }
945  attrs = attrs->getNext();
946  }
947 }
948 
949 /// Finish - This does final analysis of the declspec, rejecting things like
950 /// "_Imaginary" (lacking an FP type). This returns a diagnostic to issue or
951 /// diag::NUM_DIAGNOSTICS if there is no error. After calling this method,
952 /// DeclSpec is guaranteed self-consistent, even if an error occurred.
953 void DeclSpec::Finish(Sema &S, const PrintingPolicy &Policy) {
954  // Before possibly changing their values, save specs as written.
955  SaveWrittenBuiltinSpecs();
956 
957  // Check the type specifier components first.
958 
959  // If decltype(auto) is used, no other type specifiers are permitted.
960  if (TypeSpecType == TST_decltype_auto &&
961  (TypeSpecWidth != TSW_unspecified ||
962  TypeSpecComplex != TSC_unspecified ||
963  TypeSpecSign != TSS_unspecified ||
964  TypeAltiVecVector || TypeAltiVecPixel || TypeAltiVecBool ||
965  TypeQualifiers)) {
966  const unsigned NumLocs = 9;
967  SourceLocation ExtraLocs[NumLocs] = {
968  TSWLoc, TSCLoc, TSSLoc, AltiVecLoc,
969  TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc, TQ_atomicLoc, TQ_unalignedLoc
970  };
971  FixItHint Hints[NumLocs];
972  SourceLocation FirstLoc;
973  for (unsigned I = 0; I != NumLocs; ++I) {
974  if (ExtraLocs[I].isValid()) {
975  if (FirstLoc.isInvalid() ||
977  FirstLoc))
978  FirstLoc = ExtraLocs[I];
979  Hints[I] = FixItHint::CreateRemoval(ExtraLocs[I]);
980  }
981  }
982  TypeSpecWidth = TSW_unspecified;
983  TypeSpecComplex = TSC_unspecified;
984  TypeSpecSign = TSS_unspecified;
985  TypeAltiVecVector = TypeAltiVecPixel = TypeAltiVecBool = false;
986  TypeQualifiers = 0;
987  S.Diag(TSTLoc, diag::err_decltype_auto_cannot_be_combined)
988  << Hints[0] << Hints[1] << Hints[2] << Hints[3]
989  << Hints[4] << Hints[5] << Hints[6] << Hints[7];
990  }
991 
992  // Validate and finalize AltiVec vector declspec.
993  if (TypeAltiVecVector) {
994  if (TypeAltiVecBool) {
995  // Sign specifiers are not allowed with vector bool. (PIM 2.1)
996  if (TypeSpecSign != TSS_unspecified) {
997  S.Diag(TSSLoc, diag::err_invalid_vector_bool_decl_spec)
998  << getSpecifierName((TSS)TypeSpecSign);
999  }
1000 
1001  // Only char/int are valid with vector bool. (PIM 2.1)
1002  if (((TypeSpecType != TST_unspecified) && (TypeSpecType != TST_char) &&
1003  (TypeSpecType != TST_int)) || TypeAltiVecPixel) {
1004  S.Diag(TSTLoc, diag::err_invalid_vector_bool_decl_spec)
1005  << (TypeAltiVecPixel ? "__pixel" :
1006  getSpecifierName((TST)TypeSpecType, Policy));
1007  }
1008 
1009  // Only 'short' and 'long long' are valid with vector bool. (PIM 2.1)
1010  if ((TypeSpecWidth != TSW_unspecified) && (TypeSpecWidth != TSW_short) &&
1011  (TypeSpecWidth != TSW_longlong))
1012  S.Diag(TSWLoc, diag::err_invalid_vector_bool_decl_spec)
1013  << getSpecifierName((TSW)TypeSpecWidth);
1014 
1015  // vector bool long long requires VSX support or ZVector.
1016  if ((TypeSpecWidth == TSW_longlong) &&
1017  (!S.Context.getTargetInfo().hasFeature("vsx")) &&
1018  (!S.Context.getTargetInfo().hasFeature("power8-vector")) &&
1019  !S.getLangOpts().ZVector)
1020  S.Diag(TSTLoc, diag::err_invalid_vector_long_long_decl_spec);
1021 
1022  // Elements of vector bool are interpreted as unsigned. (PIM 2.1)
1023  if ((TypeSpecType == TST_char) || (TypeSpecType == TST_int) ||
1024  (TypeSpecWidth != TSW_unspecified))
1025  TypeSpecSign = TSS_unsigned;
1026  } else if (TypeSpecType == TST_double) {
1027  // vector long double and vector long long double are never allowed.
1028  // vector double is OK for Power7 and later, and ZVector.
1029  if (TypeSpecWidth == TSW_long || TypeSpecWidth == TSW_longlong)
1030  S.Diag(TSWLoc, diag::err_invalid_vector_long_double_decl_spec);
1031  else if (!S.Context.getTargetInfo().hasFeature("vsx") &&
1032  !S.getLangOpts().ZVector)
1033  S.Diag(TSTLoc, diag::err_invalid_vector_double_decl_spec);
1034  } else if (TypeSpecType == TST_float) {
1035  // vector float is unsupported for ZVector.
1036  if (S.getLangOpts().ZVector)
1037  S.Diag(TSTLoc, diag::err_invalid_vector_float_decl_spec);
1038  } else if (TypeSpecWidth == TSW_long) {
1039  // vector long is unsupported for ZVector and deprecated for AltiVec.
1040  if (S.getLangOpts().ZVector)
1041  S.Diag(TSWLoc, diag::err_invalid_vector_long_decl_spec);
1042  else
1043  S.Diag(TSWLoc, diag::warn_vector_long_decl_spec_combination)
1044  << getSpecifierName((TST)TypeSpecType, Policy);
1045  }
1046 
1047  if (TypeAltiVecPixel) {
1048  //TODO: perform validation
1049  TypeSpecType = TST_int;
1050  TypeSpecSign = TSS_unsigned;
1051  TypeSpecWidth = TSW_short;
1052  TypeSpecOwned = false;
1053  }
1054  }
1055 
1056  // signed/unsigned are only valid with int/char/wchar_t.
1057  if (TypeSpecSign != TSS_unspecified) {
1058  if (TypeSpecType == TST_unspecified)
1059  TypeSpecType = TST_int; // unsigned -> unsigned int, signed -> signed int.
1060  else if (TypeSpecType != TST_int && TypeSpecType != TST_int128 &&
1061  TypeSpecType != TST_char && TypeSpecType != TST_wchar) {
1062  S.Diag(TSSLoc, diag::err_invalid_sign_spec)
1063  << getSpecifierName((TST)TypeSpecType, Policy);
1064  // signed double -> double.
1065  TypeSpecSign = TSS_unspecified;
1066  }
1067  }
1068 
1069  // Validate the width of the type.
1070  switch (TypeSpecWidth) {
1071  case TSW_unspecified: break;
1072  case TSW_short: // short int
1073  case TSW_longlong: // long long int
1074  if (TypeSpecType == TST_unspecified)
1075  TypeSpecType = TST_int; // short -> short int, long long -> long long int.
1076  else if (TypeSpecType != TST_int) {
1077  S.Diag(TSWLoc, diag::err_invalid_width_spec) << (int)TypeSpecWidth
1078  << getSpecifierName((TST)TypeSpecType, Policy);
1079  TypeSpecType = TST_int;
1080  TypeSpecOwned = false;
1081  }
1082  break;
1083  case TSW_long: // long double, long int
1084  if (TypeSpecType == TST_unspecified)
1085  TypeSpecType = TST_int; // long -> long int.
1086  else if (TypeSpecType != TST_int && TypeSpecType != TST_double) {
1087  S.Diag(TSWLoc, diag::err_invalid_width_spec) << (int)TypeSpecWidth
1088  << getSpecifierName((TST)TypeSpecType, Policy);
1089  TypeSpecType = TST_int;
1090  TypeSpecOwned = false;
1091  }
1092  break;
1093  }
1094 
1095  // TODO: if the implementation does not implement _Complex or _Imaginary,
1096  // disallow their use. Need information about the backend.
1097  if (TypeSpecComplex != TSC_unspecified) {
1098  if (TypeSpecType == TST_unspecified) {
1099  S.Diag(TSCLoc, diag::ext_plain_complex)
1102  " double");
1103  TypeSpecType = TST_double; // _Complex -> _Complex double.
1104  } else if (TypeSpecType == TST_int || TypeSpecType == TST_char) {
1105  // Note that this intentionally doesn't include _Complex _Bool.
1106  if (!S.getLangOpts().CPlusPlus)
1107  S.Diag(TSTLoc, diag::ext_integer_complex);
1108  } else if (TypeSpecType != TST_float && TypeSpecType != TST_double) {
1109  S.Diag(TSCLoc, diag::err_invalid_complex_spec)
1110  << getSpecifierName((TST)TypeSpecType, Policy);
1111  TypeSpecComplex = TSC_unspecified;
1112  }
1113  }
1114 
1115  // C11 6.7.1/3, C++11 [dcl.stc]p1, GNU TLS: __thread, thread_local and
1116  // _Thread_local can only appear with the 'static' and 'extern' storage class
1117  // specifiers. We also allow __private_extern__ as an extension.
1118  if (ThreadStorageClassSpec != TSCS_unspecified) {
1119  switch (StorageClassSpec) {
1120  case SCS_unspecified:
1121  case SCS_extern:
1122  case SCS_private_extern:
1123  case SCS_static:
1124  break;
1125  default:
1129  diag::err_invalid_decl_spec_combination)
1132  else
1134  diag::err_invalid_decl_spec_combination)
1137  // Discard the thread storage class specifier to recover.
1138  ThreadStorageClassSpec = TSCS_unspecified;
1139  ThreadStorageClassSpecLoc = SourceLocation();
1140  }
1141  }
1142 
1143  // If no type specifier was provided and we're parsing a language where
1144  // the type specifier is not optional, but we got 'auto' as a storage
1145  // class specifier, then assume this is an attempt to use C++0x's 'auto'
1146  // type specifier.
1147  if (S.getLangOpts().CPlusPlus &&
1148  TypeSpecType == TST_unspecified && StorageClassSpec == SCS_auto) {
1149  TypeSpecType = TST_auto;
1150  StorageClassSpec = SCS_unspecified;
1151  TSTLoc = TSTNameLoc = StorageClassSpecLoc;
1152  StorageClassSpecLoc = SourceLocation();
1153  }
1154  // Diagnose if we've recovered from an ill-formed 'auto' storage class
1155  // specifier in a pre-C++11 dialect of C++.
1156  if (!S.getLangOpts().CPlusPlus11 && TypeSpecType == TST_auto)
1157  S.Diag(TSTLoc, diag::ext_auto_type_specifier);
1158  if (S.getLangOpts().CPlusPlus && !S.getLangOpts().CPlusPlus11 &&
1159  StorageClassSpec == SCS_auto)
1160  S.Diag(StorageClassSpecLoc, diag::warn_auto_storage_class)
1161  << FixItHint::CreateRemoval(StorageClassSpecLoc);
1162  if (TypeSpecType == TST_char16 || TypeSpecType == TST_char32)
1163  S.Diag(TSTLoc, diag::warn_cxx98_compat_unicode_type)
1164  << (TypeSpecType == TST_char16 ? "char16_t" : "char32_t");
1165  if (Constexpr_specified)
1166  S.Diag(ConstexprLoc, diag::warn_cxx98_compat_constexpr);
1167 
1168  // C++ [class.friend]p6:
1169  // No storage-class-specifier shall appear in the decl-specifier-seq
1170  // of a friend declaration.
1171  if (isFriendSpecified() &&
1173  SmallString<32> SpecName;
1174  SourceLocation SCLoc;
1175  FixItHint StorageHint, ThreadHint;
1176 
1177  if (DeclSpec::SCS SC = getStorageClassSpec()) {
1178  SpecName = getSpecifierName(SC);
1179  SCLoc = getStorageClassSpecLoc();
1180  StorageHint = FixItHint::CreateRemoval(SCLoc);
1181  }
1182 
1184  if (!SpecName.empty()) SpecName += " ";
1185  SpecName += getSpecifierName(TSC);
1186  SCLoc = getThreadStorageClassSpecLoc();
1187  ThreadHint = FixItHint::CreateRemoval(SCLoc);
1188  }
1189 
1190  S.Diag(SCLoc, diag::err_friend_decl_spec)
1191  << SpecName << StorageHint << ThreadHint;
1192 
1194  }
1195 
1196  // C++11 [dcl.fct.spec]p5:
1197  // The virtual specifier shall be used only in the initial
1198  // declaration of a non-static class member function;
1199  // C++11 [dcl.fct.spec]p6:
1200  // The explicit specifier shall be used only in the declaration of
1201  // a constructor or conversion function within its class
1202  // definition;
1204  StringRef Keyword;
1205  SourceLocation SCLoc;
1206 
1207  if (isVirtualSpecified()) {
1208  Keyword = "virtual";
1209  SCLoc = getVirtualSpecLoc();
1210  } else {
1211  Keyword = "explicit";
1212  SCLoc = getExplicitSpecLoc();
1213  }
1214 
1215  FixItHint Hint = FixItHint::CreateRemoval(SCLoc);
1216  S.Diag(SCLoc, diag::err_friend_decl_spec)
1217  << Keyword << Hint;
1218 
1219  FS_virtual_specified = FS_explicit_specified = false;
1220  FS_virtualLoc = FS_explicitLoc = SourceLocation();
1221  }
1222 
1223  assert(!TypeSpecOwned || isDeclRep((TST) TypeSpecType));
1224 
1225  // Okay, now we can infer the real type.
1226 
1227  // TODO: return "auto function" and other bad things based on the real type.
1228 
1229  // 'data definition has no type or storage class'?
1230 }
1231 
1233  TST tst = getTypeSpecType();
1234  return isDeclRep(tst) && getRepAsDecl() != nullptr &&
1235  StorageClassSpec != DeclSpec::SCS_typedef;
1236 }
1237 
1240  SourceLocation SymbolLocations[3]) {
1242  StartLocation = OperatorLoc;
1243  EndLocation = OperatorLoc;
1245  for (unsigned I = 0; I != 3; ++I) {
1246  OperatorFunctionId.SymbolLocations[I] = SymbolLocations[I].getRawEncoding();
1247 
1248  if (SymbolLocations[I].isValid())
1249  EndLocation = SymbolLocations[I];
1250  }
1251 }
1252 
1254  const char *&PrevSpec) {
1255  if (!FirstLocation.isValid())
1256  FirstLocation = Loc;
1257  LastLocation = Loc;
1258  LastSpecifier = VS;
1259 
1260  if (Specifiers & VS) {
1261  PrevSpec = getSpecifierName(VS);
1262  return true;
1263  }
1264 
1265  Specifiers |= VS;
1266 
1267  switch (VS) {
1268  default: llvm_unreachable("Unknown specifier!");
1269  case VS_Override: VS_overrideLoc = Loc; break;
1270  case VS_Sealed:
1271  case VS_Final: VS_finalLoc = Loc; break;
1272  }
1273 
1274  return false;
1275 }
1276 
1278  switch (VS) {
1279  default: llvm_unreachable("Unknown specifier");
1280  case VS_Override: return "override";
1281  case VS_Final: return "final";
1282  case VS_Sealed: return "sealed";
1283  }
1284 }
SourceLocation getThreadStorageClassSpecLoc() const
Definition: DeclSpec.h:457
Defines the clang::ASTContext interface.
SourceLocation getEnd() const
IdKind getKind() const
Determine what kind of name we have.
Definition: DeclSpec.h:981
unsigned MutableLoc
The location of the 'mutable' qualifer in a lambda-declarator, if any.
Definition: DeclSpec.h:1275
NestedNameSpecifier * getRepresentation() const
Retrieve the representation of the nested-name-specifier.
unsigned RefQualifierIsLValueRef
Whether the ref-qualifier (if any) is an lvalue reference.
Definition: DeclSpec.h:1220
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
Definition: DeclSpec.cpp:107
A (possibly-)qualified type.
Definition: Type.h:598
bool isInvalid() const
Definition: Ownership.h:160
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
SourceLocation getExplicitSpecLoc() const
Definition: DeclSpec.h:571
TSW getTypeSpecWidth() const
Definition: DeclSpec.h:476
static const TSS TSS_unsigned
Definition: DeclSpec.h:268
unsigned RestrictQualifierLoc
The location of the restrict-qualifier, if any.
Definition: DeclSpec.h:1271
SourceLocation StartLocation
The location of the first token that describes this unqualified-id, which will be the location of the...
Definition: DeclSpec.h:958
TheContext getContext() const
Definition: DeclSpec.h:1750
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
static const TST TST_wchar
Definition: DeclSpec.h:275
Decl * getRepAsDecl() const
Definition: DeclSpec.h:491
const LangOptions & getLangOpts() const
Definition: Sema.h:1062
SourceLocation TemplateNameLoc
TemplateNameLoc - The location of the template name within the source.
UnionParsedType TypeRep
Definition: DeclSpec.h:367
unsigned MSWChar
When true, print the built-in wchar_t type as __wchar_t.
static const TST TST_typeofExpr
Definition: DeclSpec.h:295
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
Definition: Sema.h:1139
static const TST TST_char16
Definition: DeclSpec.h:276
unsigned ExceptionSpecLocBeg
The beginning location of the exception specification, if any.
Definition: DeclSpec.h:1278
bool SetConstexprSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:907
unsigned EllipsisLoc
When isVariadic is true, the location of the ellipsis in the source.
Definition: DeclSpec.h:1240
SCS getStorageClassSpec() const
Definition: DeclSpec.h:447
PtrTy get() const
Definition: Ownership.h:164
static DeclaratorChunk getFunction(bool HasProto, bool IsAmbiguous, SourceLocation LParenLoc, ParamInfo *Params, unsigned NumParams, SourceLocation EllipsisLoc, SourceLocation RParenLoc, unsigned TypeQuals, bool RefQualifierIsLvalueRef, SourceLocation RefQualifierLoc, SourceLocation ConstQualifierLoc, SourceLocation VolatileQualifierLoc, SourceLocation RestrictQualifierLoc, SourceLocation MutableLoc, ExceptionSpecificationType ESpecType, SourceRange ESpecRange, ParsedType *Exceptions, SourceRange *ExceptionRanges, unsigned NumExceptions, Expr *NoexceptExpr, CachedTokens *ExceptionSpecTokens, SourceLocation LocalRangeBegin, SourceLocation LocalRangeEnd, Declarator &TheDeclarator, TypeResult TrailingReturnType=TypeResult())
DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
Definition: DeclSpec.cpp:152
One instance of this struct is used for each type in a declarator that is parsed. ...
Definition: DeclSpec.h:1101
NamespaceDecl - Represent a C++ namespace.
Definition: Decl.h:471
SourceLocation EndLoc
EndLoc - If valid, the place where this chunck ends.
Definition: DeclSpec.h:1109
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
Definition: Sema.cpp:46
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:447
static const char * getSpecifierName(Specifier VS)
Definition: DeclSpec.cpp:1277
bool SetTypeAltiVecBool(bool isAltiVecBool, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
Definition: DeclSpec.cpp:757
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
unsigned RefQualifierLoc
The location of the ref-qualifier, if any.
Definition: DeclSpec.h:1256
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Definition: DeclSpec.cpp:125
static const TSCS TSCS_unspecified
Definition: DeclSpec.h:246
static const TST TST_underlyingType
Definition: DeclSpec.h:298
Information about one declarator, including the parsed type information and the identifier.
Definition: DeclSpec.h:1624
bool setFunctionSpecExplicit(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:847
TypeSpecifierType
Specifies the kind of type.
Definition: Specifiers.h:45
static const TST TST_interface
Definition: DeclSpec.h:291
static const TST TST_char
Definition: DeclSpec.h:274
void setBegin(SourceLocation b)
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:38
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
OpenCLOptions & getOpenCLOptions()
Definition: Sema.h:1063
Information about a template-id annotation token.
static const TST TST_unknown_anytype
Definition: DeclSpec.h:301
Base wrapper for a particular "section" of type source info.
Definition: TypeLoc.h:40
TemplateIdAnnotation * TemplateId
When Kind == IK_TemplateId or IK_ConstructorTemplateId, the template-id annotation that contains the ...
Definition: DeclSpec.h:952
Expr * NoexceptExpr
Pointer to the expression in the noexcept-specifier of this function, if it has one.
Definition: DeclSpec.h:1296
One of these records is kept for each identifier that is lexed.
void setConstructorTemplateId(TemplateIdAnnotation *TemplateId)
Specify that this unqualified-id was parsed as a template-id that names a constructor.
Definition: DeclSpec.cpp:39
static const TST TST_decimal32
Definition: DeclSpec.h:285
AttributeList * getList() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:92
A C++ nested-name-specifier augmented with source location information.
TypeSpecifierSign
Specifies the signedness of a type, e.g., signed or unsigned.
Definition: Specifiers.h:33
unsigned VolatileQualifierLoc
The location of the volatile-qualifier, if any.
Definition: DeclSpec.h:1266
TSS getTypeSpecSign() const
Definition: DeclSpec.h:478
static const TST TST_class
Definition: DeclSpec.h:292
OverloadedOperatorKind Operator
The kind of overloaded operator.
Definition: DeclSpec.h:914
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/__unaligned The qualifier bitmask values are the same as...
Definition: DeclSpec.h:1224
static const TST TST_double
Definition: DeclSpec.h:282
struct OFI OperatorFunctionId
When Kind == IK_OperatorFunctionId, the overloaded operator that we parsed.
Definition: DeclSpec.h:935
bool setFunctionSpecVirtual(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:832
static const TST TST_error
Definition: DeclSpec.h:306
static const TST TST_enum
Definition: DeclSpec.h:288
static const TSW TSW_unspecified
Definition: DeclSpec.h:253
void ClearStorageClassSpecs()
Definition: DeclSpec.h:461
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:48
bool SetTypeAltiVecPixel(bool isAltiVecPixel, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
Definition: DeclSpec.cpp:742
SourceLocation getBeginLoc() const
Get the begin source location.
Definition: TypeLoc.cpp:170
const TargetInfo & getTargetInfo() const
Definition: ASTContext.h:588
bool setFunctionSpecForceInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:820
SCS
storage-class-specifier
Definition: DeclSpec.h:232
unsigned HasTrailingReturnType
HasTrailingReturnType - If this is true, a trailing return type was specified.
Definition: DeclSpec.h:1234
bool SetFriendSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:877
unsigned RParenLoc
The location of the right parenthesis in the source.
Definition: DeclSpec.h:1243
bool SetTypePipe(bool isPipe, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
Definition: DeclSpec.cpp:726
bool setFunctionSpecNoreturn(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:862
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
void setTemplateId(TemplateIdAnnotation *TemplateId)
Specify that this unqualified-id was parsed as a template-id.
Definition: DeclSpec.cpp:31
detail::InMemoryDirectory::const_iterator I
bool isInvalid() const
static const TST TST_float
Definition: DeclSpec.h:281
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covered by this nested-name-specifier.
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:263
static const TSW TSW_long
Definition: DeclSpec.h:255
TST getTypeSpecType() const
Definition: DeclSpec.h:479
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
Definition: DeclSpec.cpp:119
Kind getKind() const
Holds a QualType and a TypeSourceInfo* that came out of a declarator parsing.
Definition: LocInfoType.h:29
bool isTypeRep() const
Definition: DeclSpec.h:484
unsigned NumParams
NumParams - This is the number of formal parameters specified by the declarator.
Definition: DeclSpec.h:1247
ASTContext * Context
unsigned NumExceptions
NumExceptions - This is the number of types in the dynamic-exception- decl, if the function has one...
Definition: DeclSpec.h:1251
static bool isDeclRep(TST T)
Definition: DeclSpec.h:413
Expr - This represents one expression.
Definition: Expr.h:105
Defines the clang::LangOptions interface.
bool isDeclarationOfFunction() const
Determine whether the declaration that will be produced from this declaration will be a function...
Definition: DeclSpec.cpp:261
SourceLocation getTypeSpecComplexLoc() const
Definition: DeclSpec.h:507
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
unsigned SymbolLocations[3]
The source locations of the individual tokens that name the operator, e.g., the "new", "[", and "]" tokens in operator new [].
Definition: DeclSpec.h:923
This file defines the classes used to store parsed information about declaration-specifiers and decla...
enum clang::DeclaratorChunk::@185 Kind
static const TST TST_decimal64
Definition: DeclSpec.h:286
Defines the clang::TypeLoc interface and its subclasses.
CachedTokens * ExceptionSpecTokens
Pointer to the cached tokens for an exception-specification that has not yet been parsed...
Definition: DeclSpec.h:1300
bool hasTypeSpecifier() const
Return true if any type-specifier has been found.
Definition: DeclSpec.h:590
SourceLocation Loc
Loc - The place where this type was defined.
Definition: DeclSpec.h:1107
static const TST TST_int
Definition: DeclSpec.h:278
bool SetTypeSpecSign(TSS S, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:602
static const TST TST_half
Definition: DeclSpec.h:280
Wraps an identifier and optional source location for the identifier.
Definition: AttributeList.h:72
SourceLocation getStorageClassSpecLoc() const
Definition: DeclSpec.h:456
static bool BadSpecifier(T TNew, T TPrev, const char *&PrevSpec, unsigned &DiagID, bool IsExtension=true)
Definition: DeclSpec.cpp:381
static const TSW TSW_short
Definition: DeclSpec.h:254
bool isVirtualSpecified() const
Definition: DeclSpec.h:567
UnionParsedType TrailingReturnType
If HasTrailingReturnType is true, this is the trailing return type specified.
Definition: DeclSpec.h:1305
bool SetTypeSpecWidth(TSW 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:577
bool isValid() const
Determine whether this unqualified-id refers to a valid name.
Definition: DeclSpec.h:975
TypeAndRange * Exceptions
Pointer to a new[]'d array of TypeAndRange objects that contain the types in the function's dynamic e...
Definition: DeclSpec.h:1292
static const TST TST_char32
Definition: DeclSpec.h:277
unsigned Bool
Whether we can use 'bool' rather than '_Bool' (even if the language doesn't actually have 'bool'...
bool isCtorOrDtor()
Returns true if this declares a constructor or a destructor.
Definition: DeclSpec.cpp:349
SourceLocation getLastQualifierNameLoc() const
Retrieve the location of the name in the last qualifier in this nested name specifier.
Definition: DeclSpec.cpp:136
bool SetConceptSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:921
Kind
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
Definition: Ownership.h:146
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
Encodes a location in the source.
static const TST TST_auto_type
Definition: DeclSpec.h:300
An overloaded operator name, e.g., operator+.
Definition: DeclSpec.h:895
Expr * getRepAsExpr() const
Definition: DeclSpec.h:495
UnqualifiedId & getName()
Retrieve the name specified by this declarator.
Definition: DeclSpec.h:1748
bool isValid() const
Return true if this is a valid SourceLocation object.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
Definition: DeclSpec.cpp:143
NestedNameSpecifierLoc getTemporary() const
Retrieve a nested-name-specifier with location information based on the information in this builder...
FunctionTypeInfo Fun
Definition: DeclSpec.h:1447
static const TST TST_union
Definition: DeclSpec.h:289
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:502
ParsedType getRepAsType() const
Definition: DeclSpec.h:487
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
static const TSS TSS_signed
Definition: DeclSpec.h:267
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
SourceLocation getVirtualSpecLoc() const
Definition: DeclSpec.h:568
static const TST TST_typeofType
Definition: DeclSpec.h:294
SourceLocation getBegin() const
PtrTy get() const
Definition: Ownership.h:75
bool SetTypeQual(TQ T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const LangOptions &Lang)
Definition: DeclSpec.cpp:780
bool isStaticMember()
Returns true if this declares a static member.
Definition: DeclSpec.cpp:341
bool SetTypeAltiVecVector(bool isAltiVecVector, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
Definition: DeclSpec.cpp:713
Decl * DeclRep
Definition: DeclSpec.h:368
A constructor named via a template-id.
Definition: DeclSpec.h:903
static const TST TST_decltype_auto
Definition: DeclSpec.h:297
bool setModulePrivateSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:895
static bool isInvalid(LocType Loc, bool *Invalid)
static bool isStaticOverloadedOperator(OverloadedOperatorKind OOK)
Returns true if the given operator is implicitly static in a record context.
Definition: DeclCXX.h:1767
TSCS getThreadStorageClassSpec() const
Definition: DeclSpec.h:448
static const TSS TSS_unspecified
Definition: DeclSpec.h:266
static const TST TST_decltype
Definition: DeclSpec.h:296
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:22
static const TST TST_auto
Definition: DeclSpec.h:299
bool isFriendSpecified() const
Definition: DeclSpec.h:700
static const TST TST_void
Definition: DeclSpec.h:273
unsigned isVariadic
isVariadic - If this function has a prototype, and if that proto ends with ',...)', this is true.
Definition: DeclSpec.h:1213
SourceLocation RAngleLoc
The location of the '>' after the template argument list.
static const TST TST_int128
Definition: DeclSpec.h:279
unsigned DeleteParams
DeleteParams - If this is true, we need to delete[] Params.
Definition: DeclSpec.h:1230
bool isMissingDeclaratorOk()
Checks if this DeclSpec can stand alone, without a Declarator.
Definition: DeclSpec.cpp:1232
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
Definition: Diagnostic.h:104
bool hasTagDefinition() const
Definition: DeclSpec.cpp:354
unsigned ConstQualifierLoc
The location of the const-qualifier, if any.
Definition: DeclSpec.h:1261
detail::InMemoryDirectory::const_iterator E
static const TST TST_unspecified
Definition: DeclSpec.h:272
bool SetSpecifier(Specifier VS, SourceLocation Loc, const char *&PrevSpec)
Definition: DeclSpec.cpp:1253
static const TST TST_decimal128
Definition: DeclSpec.h:287
SourceManager & getSourceManager() const
Definition: Sema.h:1067
static const TSCS TSCS___thread
Definition: DeclSpec.h:247
unsigned hasPrototype
hasPrototype - This is true if the function had at least one typed parameter.
Definition: DeclSpec.h:1208
unsigned LParenLoc
The location of the left parenthesis in the source.
Definition: DeclSpec.h:1237
bool isFunctionType() const
Definition: Type.h:5479
bool SetStorageClassSpecThread(TSCS TSC, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:563
void setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3])
Specify that this unqualified-id was parsed as an operator-function-id.
Definition: DeclSpec.cpp:1238
static const TST TST_typename
Definition: DeclSpec.h:293
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
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:78
A template-id, e.g., f<int>.
Definition: DeclSpec.h:907
bool isUsable() const
Definition: Ownership.h:161
bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
Definition: DeclSpec.cpp:691
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
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:47
unsigned ExceptionSpecType
ExceptionSpecType - An ExceptionSpecificationType value.
Definition: DeclSpec.h:1227
ThreadStorageClassSpecifier
Thread storage-class-specifier.
Definition: Specifiers.h:188
bool isExplicitSpecified() const
Definition: DeclSpec.h:570
void setEnd(SourceLocation e)
Represents a C++ struct/union/class.
Definition: DeclCXX.h:263
static const TSCS TSCS_thread_local
Definition: DeclSpec.h:248
TypeSpecifierWidth
Specifies the width of a type, e.g., short, long, or long long.
Definition: Specifiers.h:25
static const TST TST_float128
Definition: DeclSpec.h:283
static const TST TST_bool
Definition: DeclSpec.h:284
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
Definition: DeclSpec.cpp:97
void Finish(Sema &S, const PrintingPolicy &Policy)
Finish - This does final analysis of the declspec, issuing diagnostics for things like "_Imaginary" (...
Definition: DeclSpec.cpp:953
Defines the clang::TargetInfo interface.
Expr * ExprRep
Definition: DeclSpec.h:369
static const TSW TSW_longlong
Definition: DeclSpec.h:256
static Decl::Kind getKind(const Decl *D)
Definition: DeclBase.cpp:810
unsigned getParsedSpecifiers() const
Return a bitmask of which flavors of specifiers this DeclSpec includes.
Definition: DeclSpec.cpp:363
virtual bool hasFeature(StringRef Feature) const
Determine whether the given target has the given feature.
static const TST TST_atomic
Definition: DeclSpec.h:302
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...
static const TST TST_struct
Definition: DeclSpec.h:290
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
Definition: Diagnostic.h:52
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed...
Definition: DeclSpec.h:1179
AttributeList * getNext() const
A trivial tuple used to represent a source range.
ASTContext & Context
Definition: Sema.h:299
bool SetTypeSpecComplex(TSC C, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:592
bool SetTypeSpecError()
Definition: DeclSpec.cpp:772
unsigned ExceptionSpecLocEnd
The end location of the exception specification, if any.
Definition: DeclSpec.h:1281
bool isModulePrivateSpecified() const
Definition: DeclSpec.h:703
Represents a C++ namespace alias.
Definition: DeclCXX.h:2718
SourceLocation EndLocation
The location of the last token that describes this unqualified-id.
Definition: DeclSpec.h:961
static const TSCS TSCS__Thread_local
Definition: DeclSpec.h:249
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Definition: Type.h:665
enum clang::UnqualifiedId::IdKind Kind
ParamInfo * Params
Params - This is a pointer to a new[]'d array of ParamInfo objects that describe the parameters speci...
Definition: DeclSpec.h:1286
ParsedAttributes & getAttributes()
Definition: DeclSpec.h:749
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
Definition: DeclSpec.h:1729
AttributeList - Represents a syntactic attribute.
Definition: AttributeList.h:94
void Clear()
Clear out this builder, and prepare it to build another nested-name-specifier with source-location in...
bool setFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Definition: DeclSpec.cpp:806
unsigned isAmbiguous
Can this declaration be a constructor-style initializer?
Definition: DeclSpec.h:1216