31#include "llvm/ADT/SmallString.h"
32#include "llvm/Support/TimeProfiler.h"
67 assert(Tok.
is(tok::kw_namespace) &&
"Not a namespace!");
71 if (Tok.
is(tok::code_completion)) {
79 InnerNamespaceInfoList ExtraNSs;
84 auto ReadAttributes = [&] {
88 if (Tok.
is(tok::kw___attribute)) {
89 ParseGNUAttributes(attrs);
94 ? diag::warn_cxx14_compat_ns_enum_attribute
95 : diag::ext_ns_enum_attribute)
97 ParseCXX11Attributes(attrs);
100 }
while (MoreToParse);
105 if (Tok.
is(tok::identifier)) {
108 while (Tok.
is(tok::coloncolon) &&
111 GetLookAheadToken(2).is(tok::identifier)))) {
113 InnerNamespaceInfo Info;
116 if (Tok.
is(tok::kw_inline)) {
119 FirstNestedInlineLoc = Info.InlineLoc;
125 ExtraNSs.push_back(Info);
134 if (!ExtraNSs.empty() && attrLoc.
isValid())
135 Diag(attrLoc, diag::err_unexpected_nested_namespace_attribute);
137 if (Tok.
is(tok::equal)) {
139 Diag(Tok, diag::err_expected) << tok::identifier;
144 if (!ExtraNSs.empty()) {
145 Diag(ExtraNSs.front().NamespaceLoc,
146 diag::err_unexpected_qualified_namespace_alias)
148 ExtraNSs.back().IdentLoc);
153 Diag(attrLoc, diag::err_unexpected_namespace_attributes_alias);
155 Diag(InlineLoc, diag::err_inline_namespace_alias)
157 Decl *NSAlias = ParseNamespaceAlias(NamespaceLoc, IdentLoc, Ident, DeclEnd);
162 if (
T.consumeOpen()) {
164 Diag(Tok, diag::err_expected) << tok::l_brace;
166 Diag(Tok, diag::err_expected_either) << tok::identifier << tok::l_brace;
173 Diag(
T.getOpenLocation(), diag::err_namespace_nonnamespace_scope);
178 if (ExtraNSs.empty()) {
180 }
else if (InlineLoc.
isValid()) {
181 Diag(InlineLoc, diag::err_inline_nested_namespace_definition);
183 Diag(ExtraNSs[0].NamespaceLoc,
184 diag::warn_cxx14_compat_nested_namespace_definition);
185 if (FirstNestedInlineLoc.
isValid())
186 Diag(FirstNestedInlineLoc,
187 diag::warn_cxx17_compat_inline_nested_namespace_definition);
189 Diag(ExtraNSs[0].NamespaceLoc,
190 diag::warn_cxx14_compat_nested_namespace_definition);
191 if (FirstNestedInlineLoc.
isValid())
192 Diag(FirstNestedInlineLoc, diag::ext_inline_nested_namespace_definition);
194 TentativeParsingAction TPA(*
this);
196 Token rBraceToken = Tok;
199 if (!rBraceToken.
is(tok::r_brace)) {
200 Diag(ExtraNSs[0].NamespaceLoc, diag::ext_nested_namespace_definition)
202 ExtraNSs.back().IdentLoc);
204 std::string NamespaceFix;
205 for (
const auto &ExtraNS : ExtraNSs) {
206 NamespaceFix +=
" { ";
207 if (ExtraNS.InlineLoc.isValid())
208 NamespaceFix +=
"inline ";
209 NamespaceFix +=
"namespace ";
210 NamespaceFix += ExtraNS.Ident->getName();
214 for (
unsigned i = 0, e = ExtraNSs.size(); i != e; ++i)
217 Diag(ExtraNSs[0].NamespaceLoc, diag::ext_nested_namespace_definition)
220 ExtraNSs.back().IdentLoc),
226 if (FirstNestedInlineLoc.
isValid())
227 Diag(FirstNestedInlineLoc, diag::ext_inline_nested_namespace_definition);
233 ? diag::warn_cxx98_compat_inline_namespace
234 : diag::ext_inline_namespace);
241 getCurScope(), InlineLoc, NamespaceLoc, IdentLoc, Ident,
242 T.getOpenLocation(), attrs, ImplicitUsingDirectiveDecl,
false);
245 NamespaceLoc,
"parsing namespace");
249 ParseInnerNamespace(ExtraNSs, 0, InlineLoc, attrs,
T);
252 NamespaceScope.Exit();
254 DeclEnd =
T.getCloseLocation();
258 ImplicitUsingDirectiveDecl);
262void Parser::ParseInnerNamespace(
const InnerNamespaceInfoList &InnerNSs,
266 if (index == InnerNSs.size()) {
267 while (!tryParseMisplacedModuleImport() && Tok.
isNot(tok::r_brace) &&
268 Tok.
isNot(tok::eof)) {
270 MaybeParseCXX11Attributes(DeclAttrs);
272 ParseExternalDeclaration(DeclAttrs, EmptyDeclSpecAttrs);
288 getCurScope(), InnerNSs[index].InlineLoc, InnerNSs[index].NamespaceLoc,
289 InnerNSs[index].IdentLoc, InnerNSs[index].Ident,
291 assert(!ImplicitUsingDirectiveDecl &&
292 "nested namespace definition cannot define anonymous namespace");
294 ParseInnerNamespace(InnerNSs, ++index, InlineLoc, attrs, Tracker);
296 NamespaceScope.Exit();
307 assert(Tok.
is(tok::equal) &&
"Not equal token");
311 if (Tok.
is(tok::code_completion)) {
319 ParseOptionalCXXScopeSpecifier(SS,
nullptr,
327 if (Tok.
isNot(tok::identifier)) {
328 Diag(Tok, diag::err_expected_namespace_name);
347 if (ExpectAndConsume(tok::semi, diag::err_expected_semi_after_namespace_name))
351 Alias, SS, IdentLoc, Ident);
362 assert(isTokenStringLiteral() &&
"Not a string literal!");
376 while (MaybeParseCXX11Attributes(DeclAttrs) ||
377 MaybeParseGNUAttributes(DeclSpecAttrs))
380 if (Tok.
isNot(tok::l_brace)) {
387 ParseExternalDeclaration(DeclAttrs, DeclSpecAttrs, &DS);
395 ProhibitAttributes(DeclAttrs);
400 unsigned NestedModules = 0;
403 case tok::annot_module_begin:
408 case tok::annot_module_end:
415 case tok::annot_module_include:
428 MaybeParseCXX11Attributes(DeclAttrs);
429 ParseExternalDeclaration(DeclAttrs, DeclSpecAttrs);
456Decl *Parser::ParseExportDeclaration() {
457 assert(Tok.
is(tok::kw_export));
465 if (Tok.
isNot(tok::l_brace)) {
468 MaybeParseCXX11Attributes(DeclAttrs);
470 ParseExternalDeclaration(DeclAttrs, EmptyDeclSpecAttrs);
478 while (!tryParseMisplacedModuleImport() && Tok.
isNot(tok::r_brace) &&
479 Tok.
isNot(tok::eof)) {
481 MaybeParseCXX11Attributes(DeclAttrs);
483 ParseExternalDeclaration(DeclAttrs, EmptyDeclSpecAttrs);
488 T.getCloseLocation());
496 assert(Tok.
is(tok::kw_using) &&
"Not using token");
502 if (Tok.
is(tok::code_completion)) {
509 while (Tok.
is(tok::kw_template)) {
511 Diag(TemplateLoc, diag::err_unexpected_template_after_using)
516 if (Tok.
is(tok::kw_namespace)) {
518 if (TemplateInfo.Kind) {
520 Diag(UsingLoc, diag::err_templated_using_directive_declaration)
524 Decl *UsingDir = ParseUsingDirective(Context, UsingLoc, DeclEnd, Attrs);
529 return ParseUsingDeclaration(Context, TemplateInfo, UsingLoc, DeclEnd, Attrs,
547 assert(Tok.
is(tok::kw_namespace) &&
"Not 'namespace' token");
552 if (Tok.
is(tok::code_completion)) {
560 ParseOptionalCXXScopeSpecifier(SS,
nullptr,
572 if (Tok.
isNot(tok::identifier)) {
573 Diag(Tok, diag::err_expected_namespace_name);
592 bool GNUAttr =
false;
593 if (Tok.
is(tok::kw___attribute)) {
595 ParseGNUAttributes(attrs);
600 if (ExpectAndConsume(tok::semi,
601 GNUAttr ? diag::err_expected_semi_after_attribute_list
602 : diag::err_expected_semi_after_namespace_name))
606 IdentLoc, NamespcName, attrs);
615 UsingDeclarator &
D) {
622 if (Tok.
is(tok::kw___super)) {
629 if (ParseOptionalCXXScopeSpecifier(
D.SS,
nullptr,
639 if (
D.SS.isInvalid())
653 Tok.
is(tok::identifier) &&
659 !
D.SS.getScopeRep()->getAsNamespace() &&
660 !
D.SS.getScopeRep()->getAsNamespaceAlias()) {
664 D.Name.setConstructorName(
Type, IdLoc, IdLoc);
671 !(Tok.
is(tok::identifier) &&
NextToken().is(tok::equal)),
672 false,
nullptr,
D.Name))
678 ? diag::warn_cxx17_compat_using_declaration_pack
679 : diag::ext_using_declaration_pack);
718 ? diag::warn_cxx17_compat_using_enum_declaration
719 : diag::ext_using_enum_declaration);
721 DiagnoseCXX11AttributeExtension(PrefixAttrs);
723 if (TemplateInfo.Kind) {
725 Diag(UsingLoc, diag::err_templated_using_directive_declaration)
731 if (ParseOptionalCXXScopeSpecifier(SS,
nullptr,
743 if (Tok.
is(tok::code_completion)) {
753 if (Tok.
is(tok::identifier)) {
765 }
else if (Tok.
is(tok::annot_template_id)) {
772 assert(Tok.
is(tok::annot_typename) &&
"template-id -> type failed");
775 ConsumeAnnotationToken();
787 << Tok.
is(tok::kw_enum);
798 if (ExpectAndConsume(tok::semi, diag::err_expected_after,
799 "using-enum declaration"))
808 MaybeParseCXX11Attributes(MisplacedAttrs);
810 if (InInitStatement && Tok.
isNot(tok::identifier))
814 bool InvalidDeclarator = ParseUsingDeclarator(Context,
D);
817 MaybeParseAttributes(PAKM_GNU | PAKM_CXX11, Attrs);
821 if (MisplacedAttrs.Range.isValid()) {
823 MisplacedAttrs.empty() ? nullptr : &MisplacedAttrs.front();
824 auto &
Range = MisplacedAttrs.Range;
825 (FirstAttr && FirstAttr->isRegularKeywordAttribute()
835 if (Tok.
is(tok::equal) || InInitStatement) {
836 if (InvalidDeclarator) {
841 ProhibitAttributes(PrefixAttrs);
843 Decl *DeclFromDeclSpec =
nullptr;
849 Decl *AD = ParseAliasDeclarationAfterDeclarator(
850 TemplateInfo, UsingLoc,
D, DeclEnd, AS, Attrs, &DeclFromDeclSpec);
854 DiagnoseCXX11AttributeExtension(PrefixAttrs);
859 if (TemplateInfo.Kind) {
861 Diag(UsingLoc, diag::err_templated_using_directive_declaration)
873 MaybeParseAttributes(PAKM_GNU | PAKM_CXX11, Attrs);
874 DiagnoseCXX11AttributeExtension(Attrs);
877 if (InvalidDeclarator)
882 if (
D.TypenameLoc.isValid() &&
885 diag::err_typename_identifiers_only)
892 D.TypenameLoc,
D.SS,
D.Name,
893 D.EllipsisLoc, Attrs);
895 DeclsInGroup.push_back(UD);
903 InvalidDeclarator = ParseUsingDeclarator(Context,
D);
906 if (DeclsInGroup.size() > 1)
909 ? diag::warn_cxx17_compat_multi_using_declaration
910 : diag::ext_multi_using_declaration);
914 if (ExpectAndConsume(tok::semi, diag::err_expected_after,
915 !Attrs.
empty() ?
"attributes list"
916 : UELoc.
isValid() ?
"using-enum declaration"
917 :
"using declaration"))
923Decl *Parser::ParseAliasDeclarationAfterDeclarator(
927 if (ExpectAndConsume(tok::equal)) {
933 ? diag::warn_cxx98_compat_alias_declaration
934 : diag::ext_alias_declaration);
938 if (TemplateInfo.Kind == ParsedTemplateInfo::Template &&
941 if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitSpecialization)
943 if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation)
945 if (SpecKind != -1) {
949 D.Name.TemplateId->RAngleLoc);
951 Range = TemplateInfo.getSourceRange();
953 << SpecKind <<
Range;
960 Diag(
D.Name.StartLocation, diag::err_alias_declaration_not_identifier);
964 }
else if (
D.TypenameLoc.isValid())
965 Diag(
D.TypenameLoc, diag::err_alias_declaration_not_identifier)
969 else if (
D.SS.isNotEmpty())
972 if (
D.EllipsisLoc.isValid())
973 Diag(
D.EllipsisLoc, diag::err_alias_declaration_pack_expansion)
976 Decl *DeclFromDeclSpec =
nullptr;
981 AS, &DeclFromDeclSpec, &Attrs);
983 *OwnedType = DeclFromDeclSpec;
987 if (ExpectAndConsume(tok::semi, diag::err_expected_after,
988 !Attrs.
empty() ?
"attributes list"
989 :
"alias declaration"))
994 TemplateParams ? TemplateParams->data() :
nullptr,
995 TemplateParams ? TemplateParams->size() : 0);
997 UsingLoc,
D.Name, Attrs, TypeAlias,
1003 if (
const auto *BO = dyn_cast_or_null<BinaryOperator>(AssertExpr)) {
1004 if (BO->getOpcode() == BO_LAnd &&
1005 isa<StringLiteral>(BO->getRHS()->IgnoreImpCasts()))
1020 assert(Tok.
isOneOf(tok::kw_static_assert, tok::kw__Static_assert) &&
1021 "Not a static_assert declaration");
1024 const char *TokName = Tok.
getName();
1026 if (Tok.
is(tok::kw__Static_assert))
1027 diagnoseUseOfC11Keyword(Tok);
1028 else if (Tok.
is(tok::kw_static_assert)) {
1031 Diag(Tok, diag::warn_c23_compat_keyword) << Tok.
getName();
1036 Diag(Tok, diag::warn_cxx98_compat_static_assert);
1042 if (
T.consumeOpen()) {
1043 Diag(Tok, diag::err_expected) << tok::l_paren;
1051 if (AssertExpr.isInvalid()) {
1057 if (Tok.
is(tok::r_paren)) {
1060 DiagVal = diag::warn_cxx14_compat_static_assert_no_message;
1062 DiagVal = diag::ext_cxx_static_assert_no_message;
1064 DiagVal = diag::warn_c17_compat_static_assert_no_message;
1066 DiagVal = diag::ext_c_static_assert_no_message;
1070 if (ExpectAndConsume(tok::comma)) {
1075 bool ParseAsExpression =
false;
1077 for (
unsigned I = 0;; ++I) {
1078 const Token &
T = GetLookAheadToken(I);
1079 if (
T.is(tok::r_paren))
1082 ParseAsExpression =
true;
1088 if (ParseAsExpression)
1093 Diag(Tok, diag::err_expected_string_literal)
1108 ExpectAndConsumeSemi(diag::err_expected_semi_after_static_assert, TokName);
1111 AssertMessage.
get(),
1112 T.getCloseLocation());
1121 assert(Tok.
isOneOf(tok::kw_decltype, tok::annot_decltype) &&
1122 "Not a decltype specifier");
1128 if (Tok.
is(tok::annot_decltype)) {
1129 Result = getExprAnnotation(Tok);
1134 ConsumeAnnotationToken();
1135 if (
Result.isInvalid()) {
1141 Diag(Tok, diag::warn_cxx98_compat_decltype);
1146 if (
T.expectAndConsume(diag::err_expected_lparen_after,
"decltype",
1149 return T.getOpenLocation() == Tok.
getLocation() ? StartLoc
1150 :
T.getOpenLocation();
1154 if (Tok.
is(tok::kw_auto) &&
NextToken().is(tok::r_paren)) {
1159 ? diag::warn_cxx11_compat_decltype_auto_type_specifier
1160 : diag::ext_decltype_auto_type_specifier);
1174 if (
Result.isInvalid()) {
1177 EndLoc = ConsumeParen();
1184 assert(Tok.
is(tok::semi));
1198 if (
T.getCloseLocation().isInvalid()) {
1202 return T.getCloseLocation();
1205 if (
Result.isInvalid()) {
1207 return T.getCloseLocation();
1210 EndLoc =
T.getCloseLocation();
1212 assert(!
Result.isInvalid());
1214 const char *PrevSpec =
nullptr;
1219 PrevSpec, DiagID,
Result.get(), Policy)
1221 PrevSpec, DiagID, Policy)) {
1222 Diag(StartLoc, DiagID) << PrevSpec;
1228void Parser::AnnotateExistingDecltypeSpecifier(
const DeclSpec &DS,
1244 Tok.
setKind(tok::annot_decltype);
1245 setExprAnnotation(Tok,
1255 assert(Tok.
isOneOf(tok::annot_pack_indexing_type, tok::identifier) &&
1256 "Expected an identifier");
1261 const char *PrevSpec;
1265 if (Tok.
is(tok::annot_pack_indexing_type)) {
1273 ConsumeAnnotationToken();
1274 if (
Type.isInvalid()) {
1279 DiagID,
Type, Policy);
1283 !GetLookAheadToken(2).is(tok::l_square)) {
1315 return T.getCloseLocation();
1318void Parser::AnnotateExistingIndexedTypeNamePack(
ParsedType T,
1334 Tok.
setKind(tok::annot_pack_indexing_type);
1335 setTypeAnnotation(Tok,
T);
1343#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) \
1344 case tok::kw___##Trait: \
1345 return DeclSpec::TST_##Trait;
1346#include "clang/Basic/TransformTypeTraits.def"
1348 llvm_unreachable(
"passed in an unhandled type transformation built-in");
1352bool Parser::MaybeParseTypeTransformTypeSpecifier(
DeclSpec &DS) {
1357 DeclSpec::TST TypeTransformTST = TypeTransformTokToDeclSpec();
1361 if (
T.expectAndConsume(diag::err_expected_lparen_after, Tok.
getName(),
1366 if (
Result.isInvalid()) {
1372 if (
T.getCloseLocation().isInvalid())
1375 const char *PrevSpec =
nullptr;
1380 Diag(StartLoc, DiagID) << PrevSpec;
1406 if (Tok.
is(tok::kw_typename)) {
1407 Diag(Tok, diag::err_expected_class_name_not_template)
1414 if (ParseOptionalCXXScopeSpecifier(SS,
nullptr,
1424 if (Tok.
isOneOf(tok::kw_decltype, tok::annot_decltype)) {
1431 EndLocation = ParseDecltypeSpecifier(DS);
1438 if (Tok.
is(tok::annot_pack_indexing_type)) {
1440 ParsePackIndexingType(DS);
1449 if (Tok.
is(tok::annot_template_id)) {
1455 assert(Tok.
is(tok::annot_typename) &&
"template-id -> type failed");
1458 ConsumeAnnotationToken();
1465 if (Tok.
isNot(tok::identifier)) {
1466 Diag(Tok, diag::err_expected_class_name);
1473 if (Tok.
is(tok::less)) {
1482 Diag(IdLoc, diag::err_unknown_template_name) <<
Id;
1493 if (Tok.
is(tok::annot_template_id) &&
1494 takeTemplateIdAnnotation(Tok)->mightBeType())
1500 if (Tok.
isNot(tok::annot_typename))
1507 ConsumeAnnotationToken();
1520 Diag(IdLoc, diag::err_expected_class_name);
1525 EndLocation = IdLoc;
1533 const char *PrevSpec =
nullptr;
1543void Parser::ParseMicrosoftInheritanceClassAttributes(
ParsedAttributes &attrs) {
1544 while (Tok.
isOneOf(tok::kw___single_inheritance,
1545 tok::kw___multiple_inheritance,
1546 tok::kw___virtual_inheritance)) {
1550 attrs.
addNew(AttrName, AttrNameLoc,
nullptr, AttrNameLoc,
nullptr, 0, Kind);
1555 while (Tok.
is(tok::kw__Nullable)) {
1559 attrs.
addNew(AttrName, AttrNameLoc,
nullptr, AttrNameLoc,
nullptr, 0, Kind);
1566bool Parser::isValidAfterTypeSpecifier(
bool CouldBeBitfield) {
1577 case tok::identifier:
1579 case tok::coloncolon:
1580 case tok::annot_cxxscope:
1581 case tok::annot_typename:
1582 case tok::annot_template_id:
1583 case tok::kw_decltype:
1586 case tok::kw_operator:
1587 case tok::kw___declspec:
1592 case tok::kw___attribute:
1593 case tok::annot_pragma_pack:
1595 case tok::annot_pragma_ms_pragma:
1597 case tok::annot_pragma_ms_vtordisp:
1599 case tok::annot_pragma_ms_pointers_to_members:
1602 return CouldBeBitfield ||
1605 case tok::kw___cdecl:
1606 case tok::kw___fastcall:
1607 case tok::kw___stdcall:
1608 case tok::kw___thiscall:
1609 case tok::kw___vectorcall:
1615 case tok::kw_volatile:
1616 case tok::kw_restrict:
1617 case tok::kw__Atomic:
1618 case tok::kw___unaligned:
1622 case tok::kw_inline:
1623 case tok::kw_virtual:
1624 case tok::kw_friend:
1626 case tok::kw_static:
1627 case tok::kw_extern:
1628 case tok::kw_typedef:
1629 case tok::kw_register:
1631 case tok::kw_mutable:
1632 case tok::kw_thread_local:
1633 case tok::kw_constexpr:
1634 case tok::kw_consteval:
1635 case tok::kw_constinit:
1651 if (!isKnownToBeTypeSpecifier(
NextToken()))
1708 ParsedTemplateInfo &TemplateInfo,
1710 DeclSpecContext DSC,
1713 if (TagTokKind == tok::kw_struct)
1715 else if (TagTokKind == tok::kw___interface)
1717 else if (TagTokKind == tok::kw_class)
1720 assert(TagTokKind == tok::kw_union &&
"Not a class specifier");
1724 if (Tok.
is(tok::code_completion)) {
1738 const bool shouldDelayDiagsInTag =
1739 (TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate);
1745 MaybeParseAttributes(PAKM_CXX11 | PAKM_Declspec | PAKM_GNU, attrs);
1747 if (Tok.
isOneOf(tok::kw___single_inheritance,
1748 tok::kw___multiple_inheritance,
1749 tok::kw___virtual_inheritance)) {
1750 ParseMicrosoftInheritanceClassAttributes(attrs);
1753 if (Tok.
is(tok::kw__Nullable)) {
1754 ParseNullabilityClassAttributes(attrs);
1768#include
"clang/Basic/TransformTypeTraits.def"
1769 tok::kw___is_abstract,
1770 tok::kw___is_aggregate,
1771 tok::kw___is_arithmetic,
1773 tok::kw___is_assignable,
1774 tok::kw___is_base_of,
1775 tok::kw___is_bounded_array,
1777 tok::kw___is_complete_type,
1778 tok::kw___is_compound,
1780 tok::kw___is_constructible,
1781 tok::kw___is_convertible,
1782 tok::kw___is_convertible_to,
1783 tok::kw___is_destructible,
1786 tok::kw___is_floating_point,
1788 tok::kw___is_function,
1789 tok::kw___is_fundamental,
1790 tok::kw___is_integral,
1791 tok::kw___is_interface_class,
1792 tok::kw___is_literal,
1793 tok::kw___is_lvalue_expr,
1794 tok::kw___is_lvalue_reference,
1795 tok::kw___is_member_function_pointer,
1796 tok::kw___is_member_object_pointer,
1797 tok::kw___is_member_pointer,
1798 tok::kw___is_nothrow_assignable,
1799 tok::kw___is_nothrow_constructible,
1800 tok::kw___is_nothrow_convertible,
1801 tok::kw___is_nothrow_destructible,
1802 tok::kw___is_object,
1804 tok::kw___is_pointer,
1805 tok::kw___is_polymorphic,
1806 tok::kw___is_reference,
1807 tok::kw___is_referenceable,
1808 tok::kw___is_rvalue_expr,
1809 tok::kw___is_rvalue_reference,
1811 tok::kw___is_scalar,
1812 tok::kw___is_scoped_enum,
1813 tok::kw___is_sealed,
1814 tok::kw___is_signed,
1815 tok::kw___is_standard_layout,
1816 tok::kw___is_trivial,
1817 tok::kw___is_trivially_equality_comparable,
1818 tok::kw___is_trivially_assignable,
1819 tok::kw___is_trivially_constructible,
1820 tok::kw___is_trivially_copyable,
1821 tok::kw___is_unbounded_array,
1823 tok::kw___is_unsigned,
1825 tok::kw___is_volatile
1832 TryKeywordIdentFallback(
true);
1834 struct PreserveAtomicIdentifierInfoRAII {
1835 PreserveAtomicIdentifierInfoRAII(
Token &Tok,
bool Enabled)
1836 : AtomicII(nullptr) {
1839 assert(Tok.
is(tok::kw__Atomic));
1844 ~PreserveAtomicIdentifierInfoRAII() {
1847 AtomicII->revertIdentifierToTokenID(tok::kw__Atomic);
1857 bool ShouldChangeAtomicToIdentifier =
getLangOpts().MSVCCompat &&
1858 Tok.
is(tok::kw__Atomic) &&
1860 PreserveAtomicIdentifierInfoRAII AtomicTokenGuard(
1861 Tok, ShouldChangeAtomicToIdentifier);
1871 if (TemplateInfo.TemplateParams)
1874 bool HasValidSpec =
true;
1875 if (ParseOptionalCXXScopeSpecifier(Spec,
nullptr,
1879 HasValidSpec =
false;
1882 if (Tok.
isNot(tok::identifier) && Tok.
isNot(tok::annot_template_id)) {
1883 Diag(Tok, diag::err_expected) << tok::identifier;
1884 HasValidSpec =
false;
1892 auto RecoverFromUndeclaredTemplateName = [&](
IdentifierInfo *Name,
1895 bool KnownUndeclared) {
1896 Diag(NameLoc, diag::err_explicit_spec_non_template)
1897 << (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation)
1898 << TagTokKind << Name << TemplateArgRange << KnownUndeclared;
1902 if (TemplateParams && TemplateInfo.LastParameterListWasEmpty) {
1903 if (TemplateParams->size() > 1) {
1904 TemplateParams->pop_back();
1906 TemplateParams =
nullptr;
1907 TemplateInfo.Kind = ParsedTemplateInfo::NonTemplate;
1909 }
else if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation) {
1911 TemplateParams =
nullptr;
1912 TemplateInfo.Kind = ParsedTemplateInfo::NonTemplate;
1922 if (Tok.
is(tok::identifier)) {
1931 TemplateArgList TemplateArgs;
1933 if (ParseTemplateIdAfterTemplateName(
true, LAngleLoc, TemplateArgs,
1939 RecoverFromUndeclaredTemplateName(
1940 Name, NameLoc,
SourceRange(LAngleLoc, RAngleLoc),
false);
1942 }
else if (Tok.
is(tok::annot_template_id)) {
1943 TemplateId = takeTemplateIdAnnotation(Tok);
1944 NameLoc = ConsumeAnnotationToken();
1951 RecoverFromUndeclaredTemplateName(
1954 TemplateId =
nullptr;
1967 Diag(TemplateId->
LAngleLoc, diag::err_template_spec_syntax_non_template)
1968 << TemplateId->
Name <<
static_cast<int>(TemplateId->
Kind) <<
Range;
2003 MaybeParseCXX11Attributes(Attributes);
2008 AllowDefiningTypeSpec::No ||
2011 else if (Tok.
is(tok::l_brace) ||
2012 (DSC != DeclSpecContext::DSC_association &&
2014 (isClassCompatibleKeyword() &&
2030 }
else if (isClassCompatibleKeyword() &&
2037 TentativeParsingAction PA(*
this);
2040 while (isClassCompatibleKeyword()) {
2046 if (Tok.
is(tok::l_square) &&
NextToken().is(tok::l_square)) {
2050 }
else if (Tok.
is(tok::kw_alignas) &&
NextToken().is(tok::l_paren)) {
2060 if (!
T.consumeOpen())
2068 if (Tok.
isOneOf(tok::l_brace, tok::colon))
2074 }
else if (!isTypeSpecifier(DSC) &&
2075 (Tok.
is(tok::semi) ||
2078 if (Tok.
isNot(tok::semi)) {
2081 ExpectAndConsume(tok::semi, diag::err_expected_after,
2099 auto *FirstAttr = Attributes.
empty() ? nullptr : &Attributes.
front();
2101 (FirstAttr && FirstAttr->isRegularKeywordAttribute()
2102 ?
Diag(
Loc, diag::err_keyword_not_allowed) << FirstAttr
2103 :
Diag(
Loc, diag::err_attributes_not_allowed))
2115 if (!Name && !TemplateId &&
2120 Diag(StartLoc, diag::err_anon_type_definition)
2147 }
else if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation &&
2150 ProhibitCXX11Attributes(attrs, diag::err_attributes_not_allowed,
2151 diag::err_keyword_not_allowed,
2155 getCurScope(), TemplateInfo.ExternLoc, TemplateInfo.TemplateLoc,
2166 TemplateInfo.Kind == ParsedTemplateInfo::NonTemplate)) {
2167 ProhibitCXX11Attributes(attrs, diag::err_attributes_not_allowed,
2168 diag::err_keyword_not_allowed,
2178 if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation) {
2191 "Expected a definition here");
2195 TemplateParams =
nullptr;
2200 diag::err_explicit_instantiation_with_definition)
2209 std::nullopt, LAngleLoc,
nullptr));
2210 TemplateParams = &FakedParamLists;
2217 SS, *TemplateId, attrs,
2220 TemplateParams ? TemplateParams->size() : 0),
2223 }
else if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation &&
2230 ProhibitAttributes(attrs);
2233 getCurScope(), TemplateInfo.ExternLoc, TemplateInfo.TemplateLoc,
2234 TagType, StartLoc, SS, Name, NameLoc, attrs);
2236 TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate) {
2237 ProhibitCXX11Attributes(attrs, diag::err_attributes_not_allowed,
2238 diag::err_keyword_not_allowed,
2245 TemplateParams ? TemplateParams->size() : 0));
2248 ProhibitCXX11Attributes(attrs, diag::err_attributes_not_allowed,
2249 diag::err_keyword_not_allowed,
2253 TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation) {
2256 Diag(Tok, diag::err_template_defn_explicit_instantiation)
2258 TemplateParams =
nullptr;
2261 bool IsDependent =
false;
2271 stripTypeAttributesOffDeclSpec(attrs, DS, TUK);
2274 TagOrTempResult = Actions.
ActOnTag(
2278 DSC == DeclSpecContext::DSC_type_specifier,
2279 DSC == DeclSpecContext::DSC_template_param ||
2280 DSC == DeclSpecContext::DSC_template_type_arg,
2281 OffsetOfState, &SkipBody);
2288 Name, StartLoc, NameLoc);
2295 if (shouldDelayDiagsInTag) {
2296 diagsFromTag.done();
2298 TemplateInfo.Kind == ParsedTemplateInfo::Template)
2299 diagsFromTag.redelay();
2304 assert(Tok.
is(tok::l_brace) ||
2306 isClassCompatibleKeyword());
2308 SkipCXXMemberSpecification(StartLoc, AttrFixitLoc,
TagType,
2309 TagOrTempResult.
get());
2311 ParseCXXMemberSpecification(StartLoc, AttrFixitLoc, attrs,
TagType,
2312 TagOrTempResult.
get());
2317 ParseStructUnionBody(StartLoc,
TagType, cast<RecordDecl>(
D));
2330 const char *PrevSpec =
nullptr;
2335 NameLoc.
isValid() ? NameLoc : StartLoc,
2337 }
else if (!TagOrTempResult.
isInvalid()) {
2339 TagType, StartLoc, NameLoc.
isValid() ? NameLoc : StartLoc, PrevSpec,
2340 DiagID, TagOrTempResult.
get(), Owned, Policy);
2347 Diag(StartLoc, DiagID) << PrevSpec;
2363 (TemplateInfo.Kind || !isValidAfterTypeSpecifier(
false))) {
2364 if (Tok.
isNot(tok::semi)) {
2366 ExpectAndConsume(tok::semi, diag::err_expected_after,
2384void Parser::ParseBaseClause(
Decl *ClassDecl) {
2385 assert(Tok.
is(tok::colon) &&
"Not a base clause");
2394 if (
Result.isInvalid()) {
2400 BaseInfo.push_back(
Result.get());
2425 bool IsVirtual =
false;
2429 MaybeParseCXX11Attributes(Attributes);
2435 CheckMisplacedCXX11Attribute(Attributes, StartLoc);
2445 CheckMisplacedCXX11Attribute(Attributes, StartLoc);
2449 if (Tok.
is(tok::kw_virtual)) {
2453 Diag(VirtualLoc, diag::err_dup_virtual)
2460 CheckMisplacedCXX11Attribute(Attributes, StartLoc);
2474 TypeResult BaseType = ParseBaseTypeSpecifier(BaseLoc, EndLocation);
2490 Access, BaseType.
get(), BaseLoc,
2505 case tok::kw_private:
2507 case tok::kw_protected:
2509 case tok::kw_public:
2518void Parser::HandleMemberFunctionDeclDelays(
Declarator &DeclaratorInfo,
2525 if (!NeedLateParse) {
2529 if (Param->hasUnparsedDefaultArg()) {
2530 NeedLateParse =
true;
2536 if (NeedLateParse) {
2539 auto LateMethod =
new LateParsedMethodDeclaration(
this, ThisDecl);
2540 getCurrentClass().LateParsedDeclarations.push_back(LateMethod);
2545 LateMethod->DefaultArgs.reserve(FTI.
NumParams);
2547 LateMethod->DefaultArgs.push_back(LateParsedDefaultArgument(
2584 if (II == Ident_override)
2587 if (II == Ident_sealed)
2590 if (II == Ident_abstract)
2593 if (II == Ident_final)
2596 if (II == Ident_GNU_final)
2607void Parser::ParseOptionalCXX11VirtSpecifierSeq(
VirtSpecifiers &VS,
2626 const char *PrevSpec =
nullptr;
2644 ? diag::warn_cxx98_compat_override_control_keyword
2645 : diag::ext_override_control_keyword)
2654bool Parser::isCXX11FinalKeyword()
const {
2663bool Parser::isClassCompatibleKeyword()
const {
2673bool Parser::ParseCXXMemberDeclaratorBeforeInitializer(
2675 LateParsedAttrList &LateParsedAttrs) {
2686 if (Tok.
isNot(tok::colon))
2687 ParseDeclarator(DeclaratorInfo);
2692 MaybeParseHLSLAnnotations(DeclaratorInfo,
nullptr,
2697 "don't know where identifier would go yet?");
2701 }
else if (Tok.
is(tok::kw_requires)) {
2702 ParseTrailingRequiresClause(DeclaratorInfo);
2704 ParseOptionalCXX11VirtSpecifierSeq(
2705 VS, getCurrentClass().IsInterface,
2708 MaybeParseAndDiagnoseDeclSpecAfterCXX11VirtSpecifierSeq(DeclaratorInfo,
2713 if (Tok.
is(tok::kw_asm)) {
2716 if (AsmLabel.isInvalid())
2726 DiagnoseAndSkipCXX11Attributes();
2727 MaybeParseGNUAttributes(DeclaratorInfo, &LateParsedAttrs);
2728 DiagnoseAndSkipCXX11Attributes();
2733 ParseOptionalCXX11VirtSpecifierSeq(
2734 VS, getCurrentClass().IsInterface,
2740 if (AL.isKnownToGCC() && !AL.isCXX11Attribute())
2741 Diag(AL.getLoc(), diag::warn_gcc_attribute_location);
2743 MaybeParseAndDiagnoseDeclSpecAfterCXX11VirtSpecifierSeq(DeclaratorInfo,
2760void Parser::MaybeParseAndDiagnoseDeclSpecAfterCXX11VirtSpecifierSeq(
2766 ParseTypeQualifierListOpt(
2767 DS, AR_NoAttributesParsed,
false,
2768 false, llvm::function_ref<
void()>([&]() {
2771 D.ExtendWithDeclSpec(DS);
2773 if (
D.isFunctionDeclarator()) {
2774 auto &
Function =
D.getFunctionTypeInfo();
2776 auto DeclSpecCheck = [&](
DeclSpec::TQ TypeQual, StringRef FixItName,
2779 auto &MQ =
Function.getOrCreateMethodQualifiers();
2780 if (!(MQ.getTypeQualifiers() & TypeQual)) {
2781 std::string Name(FixItName.data());
2784 MQ.SetTypeQual(TypeQual, SpecLoc);
2786 Diag(SpecLoc, diag::err_declspec_after_virtspec)
2795 bool RefQualifierIsLValueRef =
true;
2797 if (ParseRefQualifier(RefQualifierIsLValueRef, RefQualifierLoc)) {
2798 const char *Name = (RefQualifierIsLValueRef ?
"& " :
"&& ");
2801 Function.RefQualifierIsLValueRef = RefQualifierIsLValueRef;
2802 Function.RefQualifierLoc = RefQualifierLoc;
2804 Diag(RefQualifierLoc, diag::err_declspec_after_virtspec)
2805 << (RefQualifierIsLValueRef ?
"&" :
"&&")
2808 D.SetRangeEnd(RefQualifierLoc);
2854 "ParseCXXClassMemberDeclaration should only be called in C++ mode");
2855 if (Tok.
is(tok::at)) {
2857 Diag(Tok, diag::err_at_defs_cxx);
2859 Diag(Tok, diag::err_at_in_class);
2875 bool MalformedTypeSpec =
false;
2876 if (!TemplateInfo.Kind &&
2877 Tok.
isOneOf(tok::identifier, tok::coloncolon, tok::kw___super)) {
2879 MalformedTypeSpec =
true;
2882 if (Tok.
isNot(tok::annot_cxxscope))
2883 isAccessDecl =
false;
2884 else if (
NextToken().is(tok::identifier))
2885 isAccessDecl = GetLookAheadToken(2).
is(tok::semi);
2892 ParseOptionalCXXScopeSpecifier(SS,
nullptr,
2905 false,
false,
true,
true,
2906 false, &TemplateKWLoc, Name)) {
2912 if (ExpectAndConsume(tok::semi, diag::err_expected_after,
2913 "access declaration")) {
2929 if (!TemplateInfo.Kind &&
2930 Tok.
isOneOf(tok::kw_static_assert, tok::kw__Static_assert)) {
2936 if (Tok.
is(tok::kw_template)) {
2937 assert(!TemplateInfo.TemplateParams &&
2938 "Nested template improperly parsed?");
2942 DeclEnd, AccessAttrs, AS);
2946 if (Tok.
is(tok::kw___extension__)) {
2950 return ParseCXXClassMemberDeclaration(AS, AccessAttrs, TemplateInfo,
2956 MaybeParseCXX11Attributes(DeclAttrs);
2961 if (Tok.
is(tok::annot_attr_openmp))
2962 return ParseOpenMPDeclarativeDirectiveWithExtDecl(AS, DeclAttrs);
2964 if (Tok.
is(tok::kw_using)) {
2969 while (Tok.
is(tok::kw_template)) {
2971 Diag(TemplateLoc, diag::err_unexpected_template_after_using)
2975 if (Tok.
is(tok::kw_namespace)) {
2976 Diag(UsingLoc, diag::err_using_namespace_in_class);
2983 UsingLoc, DeclEnd, DeclAttrs, AS);
2987 MaybeParseMicrosoftAttributes(DeclSpecAttrs);
2990 LateParsedAttrList CommonLateParsedAttrs;
2997 if (MalformedTypeSpec)
3005 bool IsTemplateSpecOrInst =
3006 (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation ||
3007 TemplateInfo.Kind == ParsedTemplateInfo::ExplicitSpecialization);
3010 ParseDeclarationSpecifiers(DS, TemplateInfo, AS, DeclSpecContext::DSC_class,
3011 &CommonLateParsedAttrs);
3013 if (IsTemplateSpecOrInst)
3014 diagsFromTag.done();
3022 TemplateInfo.Kind == ParsedTemplateInfo::NonTemplate &&
3023 DiagnoseMissingSemiAfterTagDefinition(DS, AS, DeclSpecContext::DSC_class,
3024 &CommonLateParsedAttrs))
3028 TemplateInfo.TemplateParams ? TemplateInfo.TemplateParams->data()
3030 TemplateInfo.TemplateParams ? TemplateInfo.TemplateParams->size() : 0);
3034 ProhibitAttributes(DeclAttrs);
3038 getCurScope(), AS, DS, DeclAttrs, TemplateParams,
false, AnonRecord);
3040 DS.complete(TheDecl);
3042 Decl *decls[] = {AnonRecord, TheDecl};
3053 if (TemplateInfo.TemplateParams)
3058 LateParsedAttrList LateParsedAttrs;
3063 auto TryConsumePureSpecifier = [&](
bool AllowDefinition) {
3064 if (Tok.
isNot(tok::equal))
3069 if (
Zero.isNot(tok::numeric_constant) ||
3073 auto &
After = GetLookAheadToken(2);
3074 if (!
After.isOneOf(tok::semi, tok::comma) &&
3075 !(AllowDefinition &&
3076 After.isOneOf(tok::l_brace, tok::colon, tok::kw_try)))
3087 bool ExpectSemi =
true;
3095 if (ParseCXXMemberDeclaratorBeforeInitializer(
3096 DeclaratorInfo, VS, BitfieldSize, LateParsedAttrs)) {
3101 if (IsTemplateSpecOrInst)
3109 TryConsumePureSpecifier(
true);
3120 if (Tok.
isOneOf(tok::l_brace, tok::colon, tok::kw_try)) {
3122 }
else if (Tok.
is(tok::equal)) {
3124 if (KW.
is(tok::kw_default))
3126 else if (KW.
is(tok::kw_delete))
3128 else if (KW.
is(tok::code_completion)) {
3145 ProhibitAttributes(DeclAttrs);
3162 diag::err_function_declared_typedef);
3168 Decl *FunDecl = ParseCXXInlineMethodDef(AS, AccessAttrs, DeclaratorInfo,
3169 TemplateInfo, VS, PureSpecLoc);
3172 for (
unsigned i = 0, ni = CommonLateParsedAttrs.size(); i < ni; ++i) {
3173 CommonLateParsedAttrs[i]->addDecl(FunDecl);
3175 for (
unsigned i = 0, ni = LateParsedAttrs.size(); i < ni; ++i) {
3176 LateParsedAttrs[i]->addDecl(FunDecl);
3179 LateParsedAttrs.clear();
3182 if (Tok.
is(tok::semi))
3183 ConsumeExtraSemi(AfterMemberFunctionDefinition);
3195 bool HasStaticInitializer =
false;
3200 Diag(Tok, diag::err_anon_bitfield_member_init);
3204 if (!TryConsumePureSpecifier(
false))
3206 HasStaticInitializer =
true;
3212 TemplateInfo.Kind == ParsedTemplateInfo::NonTemplate) {
3214 if (BitfieldSize.
get())
3216 ? diag::warn_cxx17_compat_bitfield_member_init
3217 : diag::ext_bitfield_member_init);
3220 HasStaticInitializer =
true;
3236 if (AL.isCXX11Attribute() || AL.isRegularKeywordAttribute()) {
3237 auto Loc = AL.getRange().getBegin();
3238 (AL.isRegularKeywordAttribute()
3239 ?
Diag(
Loc, diag::err_keyword_not_allowed) << AL
3240 :
Diag(
Loc, diag::err_attributes_not_allowed))
3248 getCurScope(), AS, DeclaratorInfo, TemplateParams, BitfieldSize.
get(),
3249 VS, HasInClassInit);
3252 ThisDecl ? dyn_cast<VarTemplateDecl>(ThisDecl) :
nullptr)
3255 ThisDecl = VT->getTemplatedDecl();
3264 DeclaratorInfo.getDeclSpec().getStorageClassSpec() ==
3267 HasStaticInitializer =
true;
3271 Diag(PureSpecLoc, diag::err_duplicate_virt_specifier) <<
"abstract";
3273 if (ThisDecl && PureSpecLoc.
isValid())
3282 ? diag::warn_cxx98_compat_nonstatic_member_init
3283 : diag::ext_nonstatic_member_init);
3285 if (DeclaratorInfo.isArrayOfUnknownBound()) {
3291 Diag(Tok, diag::err_incomplete_array_member_init);
3298 ParseCXXNonStaticMemberInitializer(ThisDecl);
3299 }
else if (HasStaticInitializer) {
3302 ThisDecl, DeclaratorInfo.isDeclarationOfFunction(), EqualLoc);
3304 if (
Init.isInvalid()) {
3308 }
else if (ThisDecl)
3311 }
else if (ThisDecl && DeclaratorInfo.isStaticMember())
3318 for (
unsigned i = 0, ni = CommonLateParsedAttrs.size(); i < ni; ++i)
3319 CommonLateParsedAttrs[i]->addDecl(ThisDecl);
3321 for (
unsigned i = 0, ni = LateParsedAttrs.size(); i < ni; ++i)
3322 LateParsedAttrs[i]->addDecl(ThisDecl);
3325 DeclsInGroup.push_back(ThisDecl);
3327 if (DeclaratorInfo.isFunctionDeclarator() &&
3328 DeclaratorInfo.getDeclSpec().getStorageClassSpec() !=
3330 HandleMemberFunctionDeclDelays(DeclaratorInfo, ThisDecl);
3332 LateParsedAttrs.clear();
3334 DeclaratorInfo.complete(ThisDecl);
3347 Diag(CommaLoc, diag::err_expected_semi_declaration)
3357 if (TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate &&
3358 DeclaratorInfo.isFirstDeclarator()) {
3359 Diag(CommaLoc, diag::err_multiple_template_declarators)
3360 << TemplateInfo.Kind;
3364 DeclaratorInfo.clear();
3368 DeclaratorInfo.setCommaLoc(CommaLoc);
3373 DiagnoseAndSkipCXX11Attributes();
3374 MaybeParseGNUAttributes(DeclaratorInfo);
3375 DiagnoseAndSkipCXX11Attributes();
3377 if (ParseCXXMemberDeclaratorBeforeInitializer(
3378 DeclaratorInfo, VS, BitfieldSize, LateParsedAttrs))
3383 ExpectAndConsume(tok::semi, diag::err_expected_semi_decl_list)) {
3416 assert(Tok.
isOneOf(tok::equal, tok::l_brace) &&
3417 "Data member initializer not starting with '=' or '{'");
3419 bool IsFieldInitialization = isa_and_present<FieldDecl>(
D);
3423 IsFieldInitialization
3432 IsFieldInitialization;
3435 if (Tok.
is(tok::kw_delete)) {
3442 if (IsFunction || Next.isOneOf(tok::semi, tok::comma, tok::eof)) {
3448 SkipDeletedFunctionBody();
3451 }
else if (Tok.
is(tok::kw_default)) {
3453 Diag(Tok, diag::err_default_delete_in_multiple_declaration)
3461 if (
const auto *PD = dyn_cast_or_null<MSPropertyDecl>(
D)) {
3462 Diag(Tok, diag::err_ms_property_initializer) << PD;
3465 return ParseInitializer();
3473 assert(isCXX11FinalKeyword() &&
"not a class definition");
3479 CheckMisplacedCXX11Attribute(Attrs, AttrFixitLoc);
3484 if (Tok.
isNot(tok::colon) && Tok.
isNot(tok::l_brace))
3491 if (Tok.
is(tok::colon)) {
3494 ParsingClassDefinition ParsingDef(*
this,
TagDecl,
true,
3500 ParseBaseClause(
nullptr);
3504 if (!Tok.
is(tok::l_brace)) {
3506 diag::err_expected_lbrace_after_base_specifiers);
3512 assert(Tok.
is(tok::l_brace));
3518 if (Tok.
is(tok::kw___attribute)) {
3520 MaybeParseGNUAttributes(Attrs);
3530 case tok::kw___if_exists:
3531 case tok::kw___if_not_exists:
3532 ParseMicrosoftIfExistsClassDeclaration(
TagType, AccessAttrs, AS);
3537 ConsumeExtraSemi(InsideStruct,
TagType);
3541 case tok::annot_pragma_vis:
3542 HandlePragmaVisibility();
3544 case tok::annot_pragma_pack:
3547 case tok::annot_pragma_align:
3548 HandlePragmaAlign();
3550 case tok::annot_pragma_ms_pointers_to_members:
3551 HandlePragmaMSPointersToMembers();
3553 case tok::annot_pragma_ms_pragma:
3554 HandlePragmaMSPragma();
3556 case tok::annot_pragma_ms_vtordisp:
3557 HandlePragmaMSVtorDisp();
3559 case tok::annot_pragma_dump:
3563 case tok::kw_namespace:
3565 DiagnoseUnexpectedNamespace(cast<NamedDecl>(
TagDecl));
3568 case tok::kw_private:
3572 ParsedTemplateInfo TemplateInfo;
3573 return ParseCXXClassMemberDeclaration(AS, AccessAttrs, TemplateInfo);
3576 case tok::kw_public:
3577 case tok::kw_protected: {
3587 AccessAttrs.
clear();
3588 MaybeParseGNUAttributes(AccessAttrs);
3593 Diag(EndLoc, diag::err_expected)
3597 Diag(EndLoc, diag::err_expected)
3609 AccessAttrs.
clear();
3615 case tok::annot_attr_openmp:
3616 case tok::annot_pragma_openmp:
3617 return ParseOpenMPDeclarativeDirectiveWithExtDecl(
3619 case tok::annot_pragma_openacc:
3627 ConsumeAnnotationToken();
3630 ParsedTemplateInfo TemplateInfo;
3631 return ParseCXXClassMemberDeclaration(AS, AccessAttrs, TemplateInfo);
3648 "Invalid TagType!");
3650 llvm::TimeTraceScope TimeScope(
"ParseClass", [&]() {
3651 if (
auto *TD = dyn_cast_or_null<NamedDecl>(
TagDecl))
3652 return TD->getQualifiedNameAsString();
3653 return std::string(
"<anonymous>");
3657 "parsing struct/union/class body");
3661 bool NonNestedClass =
true;
3662 if (!ClassStack.empty()) {
3664 if (S->isClassScope()) {
3666 NonNestedClass =
false;
3669 if (getCurrentClass().IsInterface) {
3673 ? cast<NamedDecl>(
TagDecl)->getQualifiedNameAsString()
3679 if (S->isFunctionScope())
3690 ParsingClassDefinition ParsingDef(*
this,
TagDecl, NonNestedClass,
3698 bool IsFinalSpelledSealed =
false;
3699 bool IsAbstract =
false;
3707 if (isCXX11FinalKeyword()) {
3710 Diag(Skipped, diag::err_duplicate_class_virt_specifier)
3715 IsFinalSpelledSealed =
true;
3720 Diag(Skipped, diag::err_duplicate_class_virt_specifier)
3728 Diag(FinalLoc, diag::err_override_control_interface)
3732 ? diag::warn_cxx98_compat_override_control_keyword
3733 : diag::ext_override_control_keyword)
3736 Diag(FinalLoc, diag::ext_ms_sealed_keyword);
3738 Diag(AbstractLoc, diag::ext_ms_abstract_keyword);
3740 Diag(FinalLoc, diag::ext_warn_gnu_final);
3743 "not a class definition");
3749 CheckMisplacedCXX11Attribute(Attrs, AttrFixitLoc);
3758 if (!Tok.
is(tok::colon) && !Tok.
is(tok::l_brace)) {
3765 if (Tok.
is(tok::colon)) {
3766 ParseScope InheritanceScope(
this,
getCurScope()->getFlags() |
3770 if (!Tok.
is(tok::l_brace)) {
3771 bool SuggestFixIt =
false;
3775 case tok::kw_private:
3776 case tok::kw_protected:
3777 case tok::kw_public:
3780 case tok::kw_static_assert:
3784 case tok::kw_template:
3785 SuggestFixIt =
true;
3787 case tok::identifier:
3788 SuggestFixIt = isConstructorDeclarator(
true);
3791 SuggestFixIt = isCXXSimpleDeclaration(
false);
3796 Diag(BraceLoc, diag::err_expected_lbrace_after_base_specifiers);
3810 assert(Tok.
is(tok::l_brace));
3816 IsFinalSpelledSealed, IsAbstract,
3817 T.getOpenLocation());
3832 while (!tryParseMisplacedModuleImport() && Tok.
isNot(tok::r_brace) &&
3833 Tok.
isNot(tok::eof)) {
3835 ParseCXXClassMemberDeclarationWithPragmas(
3837 MaybeDestroyTemplateIds();
3846 MaybeParseGNUAttributes(attrs);
3850 T.getOpenLocation(),
3851 T.getCloseLocation(), attrs);
3858 if (
TagDecl && NonNestedClass) {
3865 ParseLexedPragmas(getCurrentClass());
3866 ParseLexedAttributes(getCurrentClass());
3867 ParseLexedMethodDeclarations(getCurrentClass());
3872 ParseLexedMemberInitializers(getCurrentClass());
3873 ParseLexedMethodDefs(getCurrentClass());
3874 PrevTokLocation = SavedPrevTokLocation;
3889void Parser::DiagnoseUnexpectedNamespace(
NamedDecl *
D) {
3890 assert(Tok.
is(tok::kw_namespace));
3929void Parser::ParseConstructorInitializer(
Decl *ConstructorDecl) {
3930 assert(Tok.
is(tok::colon) &&
3931 "Constructor initializer always starts with ':'");
3939 bool AnyErrors =
false;
3942 if (Tok.
is(tok::code_completion)) {
3945 ConstructorDecl, MemInitializers);
3949 MemInitResult MemInit = ParseMemInitializer(ConstructorDecl);
3951 MemInitializers.push_back(MemInit.
get());
3955 if (Tok.
is(tok::comma))
3957 else if (Tok.
is(tok::l_brace))
3962 Tok.
isOneOf(tok::identifier, tok::coloncolon)) {
3964 Diag(
Loc, diag::err_ctor_init_missing_comma)
3970 << tok::l_brace << tok::comma;
3995 if (ParseOptionalCXXScopeSpecifier(SS,
nullptr,
4008 if (Tok.
is(tok::identifier)) {
4013 }
else if (Tok.
is(tok::annot_decltype)) {
4018 ParseDecltypeSpecifier(DS);
4019 }
else if (Tok.
is(tok::annot_pack_indexing_type)) {
4022 ParsePackIndexingType(DS);
4025 ? takeTemplateIdAnnotation(Tok)
4030 assert(Tok.
is(tok::annot_typename) &&
"template-id -> type failed");
4032 ConsumeAnnotationToken();
4034 Diag(Tok, diag::err_expected_member_or_base_name);
4041 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
4044 ExprResult InitList = ParseBraceInitializer();
4054 TemplateTypeTy.
get(), DS, IdLoc,
4055 InitList.
get(), EllipsisLoc);
4056 }
else if (Tok.
is(tok::l_paren)) {
4061 ExprVector ArgExprs;
4062 auto RunSignatureHelp = [&] {
4067 ConstructorDecl, SS, TemplateTypeTy.
get(), ArgExprs, II,
4068 T.getOpenLocation(),
false);
4069 CalledSignatureHelp =
true;
4070 return PreferredType;
4072 if (Tok.
isNot(tok::r_paren) && ParseExpressionList(ArgExprs, [&] {
4073 PreferredType.enterFunctionArgument(Tok.
getLocation(),
4090 ConstructorDecl,
getCurScope(), SS, II, TemplateTypeTy.
get(), DS, IdLoc,
4091 T.getOpenLocation(), ArgExprs,
T.getCloseLocation(), EllipsisLoc);
4098 return Diag(Tok, diag::err_expected_either) << tok::l_paren << tok::l_brace;
4100 return Diag(Tok, diag::err_expected) << tok::l_paren;
4118 ExceptionSpecTokens =
nullptr;
4122 if (Tok.
isNot(tok::kw_throw) && Tok.
isNot(tok::kw_noexcept))
4126 bool IsNoexcept = Tok.
is(tok::kw_noexcept);
4127 Token StartTok = Tok;
4131 if (!Tok.
is(tok::l_paren)) {
4134 Diag(Tok, diag::warn_cxx98_compat_noexcept_decl);
4135 NoexceptExpr =
nullptr;
4139 Diag(Tok, diag::err_expected_lparen_after) <<
"throw";
4145 ExceptionSpecTokens->push_back(StartTok);
4146 ExceptionSpecTokens->push_back(Tok);
4147 SpecificationRange.
setEnd(ConsumeParen());
4149 ConsumeAndStoreUntil(tok::r_paren, *ExceptionSpecTokens,
4152 SpecificationRange.
setEnd(ExceptionSpecTokens->back().getLocation());
4158 if (Tok.
is(tok::kw_throw)) {
4159 Result = ParseDynamicExceptionSpecification(
4160 SpecificationRange, DynamicExceptions, DynamicExceptionRanges);
4161 assert(DynamicExceptions.size() == DynamicExceptionRanges.size() &&
4162 "Produced different number of exception types and ranges.");
4166 if (Tok.
isNot(tok::kw_noexcept))
4169 Diag(Tok, diag::warn_cxx98_compat_noexcept_decl);
4177 if (Tok.
is(tok::l_paren)) {
4190 NoexceptRange =
SourceRange(KeywordLoc,
T.getCloseLocation());
4197 NoexceptRange =
SourceRange(KeywordLoc, KeywordLoc);
4201 SpecificationRange = NoexceptRange;
4206 if (Tok.
is(tok::kw_throw)) {
4207 Diag(Tok.
getLocation(), diag::err_dynamic_and_noexcept_specification);
4208 ParseDynamicExceptionSpecification(NoexceptRange, DynamicExceptions,
4209 DynamicExceptionRanges);
4212 Diag(Tok.
getLocation(), diag::err_dynamic_and_noexcept_specification);
4220 if (
P.getLangOpts().CPlusPlus11) {
4221 const char *Replacement = IsNoexcept ?
"noexcept" :
"noexcept(false)";
4223 ? diag::ext_dynamic_exception_spec
4224 : diag::warn_exception_spec_deprecated)
4245 assert(Tok.
is(tok::kw_throw) &&
"expected throw");
4249 if (
T.consumeOpen()) {
4250 Diag(Tok, diag::err_expected_lparen_after) <<
"throw";
4257 if (Tok.
is(tok::ellipsis)) {
4260 Diag(EllipsisLoc, diag::ext_ellipsis_exception_spec);
4262 SpecificationRange.
setEnd(
T.getCloseLocation());
4269 while (Tok.
isNot(tok::r_paren)) {
4272 if (Tok.
is(tok::ellipsis)) {
4278 if (!Res.isInvalid())
4282 if (!Res.isInvalid()) {
4283 Exceptions.push_back(Res.get());
4284 Ranges.push_back(
Range);
4292 SpecificationRange.
setEnd(
T.getCloseLocation());
4294 Exceptions.empty());
4301 bool MayBeFollowedByDirectInit) {
4302 assert(Tok.
is(tok::arrow) &&
"expected arrow");
4312void Parser::ParseTrailingRequiresClause(
Declarator &
D) {
4313 assert(Tok.
is(tok::kw_requires) &&
"expected requires");
4331 DeclaratorScopeObj DeclScopeObj(*
this, SS);
4333 DeclScopeObj.EnterDeclaratorScope();
4342 std::optional<Sema::CXXThisScopeRAII> ThisScope;
4343 InitCXXThisScopeForDeclaratorIfRelevant(
D,
D.getDeclSpec(), ThisScope);
4345 TrailingRequiresClause =
4348 TrailingRequiresClause =
4351 if (!
D.isDeclarationOfFunction()) {
4353 diag::err_requires_clause_on_declarator_not_declaring_a_function);
4358 SkipUntil({tok::l_brace, tok::arrow, tok::kw_try, tok::comma, tok::colon},
4361 D.setTrailingRequiresClause(TrailingRequiresClause.
get());
4364 if (
D.isFunctionDeclarator() && Tok.
is(tok::arrow) &&
4365 D.getDeclSpec().getTypeSpecType() ==
TST_auto) {
4369 ParseTrailingReturnType(
Range,
false);
4373 diag::err_requires_clause_must_appear_after_trailing_return)
4375 auto &FunctionChunk =
D.getFunctionTypeInfo();
4376 FunctionChunk.HasTrailingReturnType = TrailingReturnType.
isUsable();
4377 FunctionChunk.TrailingReturnType = TrailingReturnType.
get();
4380 SkipUntil({tok::equal, tok::l_brace, tok::arrow, tok::kw_try, tok::comma},
4389 bool NonNestedClass,
4391 assert((NonNestedClass || !ClassStack.empty()) &&
4392 "Nested class without outer class");
4393 ClassStack.push(
new ParsingClass(ClassDecl, NonNestedClass, IsInterface));
4399void Parser::DeallocateParsedClasses(Parser::ParsingClass *
Class) {
4400 for (
unsigned I = 0, N =
Class->LateParsedDeclarations.size(); I != N; ++I)
4401 delete Class->LateParsedDeclarations[I];
4412 assert(!ClassStack.empty() &&
"Mismatched push/pop for class parsing");
4416 ParsingClass *Victim = ClassStack.top();
4418 if (Victim->TopLevelClass) {
4421 DeallocateParsedClasses(Victim);
4424 assert(!ClassStack.empty() &&
"Missing top-level class?");
4426 if (Victim->LateParsedDeclarations.empty()) {
4431 DeallocateParsedClasses(Victim);
4439 "Nested class outside of class scope?");
4440 ClassStack.top()->LateParsedDeclarations.push_back(
4441 new LateParsedClass(
this, Victim));
4467 case tok::code_completion:
4474 case tok::numeric_constant: {
4482 StringRef Spelling = PP.
getSpelling(ExpansionLoc, ExpansionBuf);
4483 if (Spelling ==
"__clang__") {
4487 Diag(Tok, diag::warn_wrong_clang_attr_namespace)
4503 case tok::pipeequal:
4504 case tok::caretequal:
4506 case tok::exclaimequal:
4512 StringRef Spelling = PP.
getSpelling(SpellingLoc, SpellingBuf);
4521void Parser::ParseOpenMPAttributeArgs(
const IdentifierInfo *AttrName,
4526 if (
T.consumeOpen()) {
4527 Diag(Tok, diag::err_expected) << tok::l_paren;
4531 if (AttrName->
isStr(
"directive")) {
4537 OMPBeginTok.
setKind(tok::annot_attr_openmp);
4539 OpenMPTokens.push_back(OMPBeginTok);
4541 ConsumeAndStoreUntil(tok::r_paren, OpenMPTokens,
false,
4545 OMPEndTok.
setKind(tok::annot_pragma_openmp_end);
4547 OpenMPTokens.push_back(OMPEndTok);
4549 assert(AttrName->
isStr(
"sequence") &&
4550 "Expected either 'directive' or 'sequence'");
4559 const IdentifierInfo *Ident = TryParseCXX11AttributeIdentifier(IdentLoc);
4563 if (Ident && Ident->
isStr(
"omp") && !ExpectAndConsume(tok::coloncolon))
4564 Ident = TryParseCXX11AttributeIdentifier(IdentLoc);
4568 if (!Ident || (!Ident->
isStr(
"directive") && !Ident->
isStr(
"sequence"))) {
4575 ParseOpenMPAttributeArgs(Ident, OpenMPTokens);
4589 case ParsedAttr::AT_CarriesDependency:
4590 case ParsedAttr::AT_Deprecated:
4591 case ParsedAttr::AT_FallThrough:
4592 case ParsedAttr::AT_CXX11NoReturn:
4593 case ParsedAttr::AT_NoUniqueAddress:
4594 case ParsedAttr::AT_Likely:
4595 case ParsedAttr::AT_Unlikely:
4597 case ParsedAttr::AT_WarnUnusedResult:
4598 return !ScopeName && AttrName->
getName() ==
"nodiscard";
4599 case ParsedAttr::AT_Unused:
4600 return !ScopeName && AttrName->
getName() ==
"maybe_unused";
4612 assert(Tok.
is(tok::l_paren) &&
"Not a C++11 attribute argument list");
4620 TentativeParsingAction TPA(*
this);
4623 if (Res.isInvalid()) {
4626 if (Tok.
is(tok::r_paren))
4631 if (!Tok.
isOneOf(tok::r_paren, tok::r_square)) {
4636 if (!Res.isInvalid()) {
4637 auto *
E = Res.get();
4676bool Parser::ParseCXX11AttributeArgs(
4680 assert(Tok.
is(tok::l_paren) &&
"Not a C++11 attribute argument list");
4684 LO.CPlusPlus ? ParsedAttr::Form::CXX11() :
ParsedAttr::Form::
C23();
4690 Form = ParsedAttr::Form::Microsoft();
4705 if (ScopeName && (ScopeName->
isStr(
"gnu") || ScopeName->
isStr(
"__gnu__"))) {
4708 ParseGNUAttributeArgs(AttrName, AttrNameLoc, Attrs, EndLoc, ScopeName,
4709 ScopeLoc, Form,
nullptr);
4714 if (ScopeName && ScopeName->
isStr(
"omp") &&
4715 (AttrName->
isStr(
"directive") || AttrName->
isStr(
"sequence"))) {
4717 ? diag::warn_omp51_compat_attributes
4718 : diag::ext_omp_attributes);
4720 ParseOpenMPAttributeArgs(AttrName, OpenMPTokens);
4729 if (ScopeName && (ScopeName->
isStr(
"clang") || ScopeName->
isStr(
"_Clang")))
4730 NumArgs = ParseClangAttributeArgs(AttrName, AttrNameLoc, Attrs, EndLoc,
4731 ScopeName, ScopeLoc, Form);
4733 else if (!ScopeName && AttrName->
isStr(
"assume")) {
4734 if (ParseCXXAssumeAttributeArg(Attrs, AttrName, AttrNameLoc, EndLoc, Form))
4738 NumArgs = ParseAttributeArgsCommon(AttrName, AttrNameLoc, Attrs, EndLoc,
4739 ScopeName, ScopeLoc, Form);
4741 if (!Attrs.
empty() &&
4747 Diag(LParenLoc, diag::warn_unknown_attribute_ignored) << AttrName;
4748 Attr.setInvalid(
true);
4756 if (
Attr.getMaxArgs() && !NumArgs) {
4759 Diag(LParenLoc, diag::err_attribute_requires_arguments) << AttrName;
4760 Attr.setInvalid(
true);
4761 }
else if (!
Attr.getMaxArgs()) {
4765 Diag(LParenLoc, diag::err_cxx11_attribute_forbids_arguments)
4768 Attr.setInvalid(
true);
4801 if (Tok.
is(tok::kw_alignas)) {
4808 ParseAlignmentSpecifier(Attrs, EndLoc);
4819 if (!Tok.
is(tok::l_paren))
4822 ParseAttributeArgsCommon(AttrName,
Loc, Attrs, EndLoc,
4826 Attrs.
addNew(AttrName,
Loc,
nullptr,
Loc,
nullptr, 0, Form);
4830 assert(Tok.
is(tok::l_square) &&
NextToken().is(tok::l_square) &&
4831 "Not a double square bracket attribute list");
4836 : diag::warn_ext_cxx11_attributes);
4839 : diag::warn_ext_c23_attributes);
4843 checkCompoundToken(OpenLoc, tok::l_square, CompoundToken::AttrBegin);
4848 if (Tok.
is(tok::kw_using)) {
4850 ? diag::warn_cxx14_compat_using_attribute_ns
4851 : diag::ext_using_attribute_ns);
4854 CommonScopeName = TryParseCXX11AttributeIdentifier(
4856 if (!CommonScopeName) {
4864 bool AttrParsed =
false;
4865 while (!Tok.
isOneOf(tok::r_square, tok::semi, tok::eof)) {
4869 if (ExpectAndConsume(tok::comma)) {
4883 AttrName = TryParseCXX11AttributeIdentifier(
4892 ScopeName = AttrName;
4895 AttrName = TryParseCXX11AttributeIdentifier(
4905 if (CommonScopeName) {
4907 Diag(ScopeLoc, diag::err_using_attribute_ns_conflict)
4910 ScopeName = CommonScopeName;
4911 ScopeLoc = CommonScopeLoc;
4916 if (Tok.
is(tok::l_paren))
4917 AttrParsed = ParseCXX11AttributeArgs(AttrName, AttrLoc, Attrs, EndLoc,
4918 ScopeName, ScopeLoc, OpenMPTokens);
4924 ScopeName, ScopeLoc,
nullptr, 0,
4926 : ParsedAttr::Form::C23());
4931 Diag(Tok, diag::err_cxx11_attribute_forbids_ellipsis) << AttrName;
4936 if (Tok.
is(tok::semi)) {
4942 if (ExpectAndConsume(tok::r_square))
4944 else if (Tok.
is(tok::r_square))
4945 checkCompoundToken(CloseLoc, tok::r_square, CompoundToken::AttrEnd);
4948 if (ExpectAndConsume(tok::r_square))
4961 ParseCXX11AttributeSpecifier(Attrs, &EndLoc);
4962 }
while (isAllowedCXX11AttributeSpecifier());
4967void Parser::DiagnoseAndSkipCXX11Attributes() {
4976 (Keyword ?
Diag(StartLoc, diag::err_keyword_not_allowed) << Keyword
4977 :
Diag(StartLoc, diag::err_attributes_not_allowed))
4985 if (!isCXX11AttributeSpecifier())
4989 if (Tok.
is(tok::l_square)) {
4993 EndLoc =
T.getCloseLocation();
5000 "not an attribute specifier");
5003 if (!
T.consumeOpen())
5005 EndLoc =
T.getCloseLocation();
5007 }
while (isCXX11AttributeSpecifier());
5014 assert(Tok.
is(tok::identifier) &&
"Not a Microsoft attribute list");
5016 assert(UuidIdent->
getName() ==
"uuid" &&
"Not a Microsoft attribute list");
5023 if (
T.consumeOpen()) {
5024 Diag(Tok, diag::err_expected) << tok::l_paren;
5029 if (isTokenStringLiteral()) {
5034 ArgExprs.push_back(StringResult.
get());
5051 while (Tok.
isNot(tok::r_paren)) {
5053 Diag(Tok, diag::err_attribute_uuid_malformed_guid);
5058 SpellingBuffer.resize(Tok.
getLength() + 1);
5060 StringRef TokSpelling = PP.
getSpelling(Tok, SpellingBuffer, &Invalid);
5065 StrBuffer += TokSpelling;
5071 Diag(Tok, diag::err_attribute_uuid_malformed_guid);
5081 Toks[0].
setKind(tok::string_literal);
5087 ArgExprs.push_back(UuidString);
5090 if (!
T.consumeClose()) {
5093 ParsedAttr::Form::Microsoft());
5106 assert(Tok.
is(tok::l_square) &&
"Not a Microsoft attribute list");
5117 SkipUntil(tok::r_square, tok::identifier,
5119 if (Tok.
is(tok::code_completion)) {
5127 if (Tok.
isNot(tok::identifier))
5130 ParseMicrosoftUuidAttributeArgs(Attrs);
5140 bool AttrParsed =
false;
5141 if (Tok.
is(tok::l_paren)) {
5144 ParseCXX11AttributeArgs(II, NameLoc, Attrs, &EndLoc,
nullptr,
5146 ReplayOpenMPAttributeTokens(OpenMPTokens);
5150 ParsedAttr::Form::Microsoft());
5157 EndLoc =
T.getCloseLocation();
5158 }
while (Tok.
is(tok::l_square));
5163void Parser::ParseMicrosoftIfExistsClassDeclaration(
5166 IfExistsCondition
Result;
5167 if (ParseMicrosoftIfExistsCondition(
Result))
5171 if (
Braces.consumeOpen()) {
5172 Diag(Tok, diag::err_expected) << tok::l_brace;
5176 switch (
Result.Behavior) {
5182 Diag(
Result.KeywordLoc, diag::warn_microsoft_dependent_exists)
5192 while (Tok.
isNot(tok::r_brace) && !isEofOrEom()) {
5194 if (Tok.
isOneOf(tok::kw___if_exists, tok::kw___if_not_exists)) {
5195 ParseMicrosoftIfExistsClassDeclaration(
TagType, AccessAttrs, CurAS);
5200 if (Tok.
is(tok::semi)) {
5201 ConsumeExtraSemi(InsideStruct,
TagType);
5211 if (Tok.
is(tok::colon))
5215 Diag(Tok, diag::err_expected) << tok::colon;
5220 ParsedTemplateInfo TemplateInfo;
5222 ParseCXXClassMemberDeclaration(CurAS, AccessAttrs, TemplateInfo);
Defines the clang::ASTContext interface.
Defines the C++ template declaration subclasses.
llvm::MachO::RecordLoc RecordLoc
Defines an enumeration for C++ overloaded operators.
static void diagnoseDynamicExceptionSpecification(Parser &P, SourceRange Range, bool IsNoexcept)
static bool IsBuiltInOrStandardCXX11Attribute(IdentifierInfo *AttrName, IdentifierInfo *ScopeName)
static FixItHint getStaticAssertNoMessageFixIt(const Expr *AssertExpr, SourceLocation EndExprLoc)
This file declares facilities that support code completion.
Defines the clang::TokenKind enum and support functions.
#define TRANSFORM_TYPE_TRAIT_DEF(Enum, _)
const NestedNameSpecifier * Specifier
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const clang::PrintingPolicy & getPrintingPolicy() const
Attr - This represents one attribute.