16#ifndef DEMANGLE_ITANIUMDEMANGLE_H
17#define DEMANGLE_ITANIUMDEMANGLE_H
34#pragma clang diagnostic push
35#pragma clang diagnostic ignored "-Wunused-template"
41 static_assert(std::is_trivial<T>::value,
42 "T is required to be a trivial type");
48 bool isInline()
const {
return First == Inline; }
56 void reserve(
size_t NewCap) {
59 auto *Tmp =
static_cast<T *
>(std::malloc(NewCap *
sizeof(
T)));
62 std::copy(First, Last, Tmp);
65 First =
static_cast<T *
>(std::realloc(First, NewCap *
sizeof(
T)));
80 if (
Other.isInline()) {
82 Last = First +
Other.size();
94 if (
Other.isInline()) {
100 Last = First +
Other.size();
135 Last = First +
Index;
141 bool empty()
const {
return First == Last; }
142 size_t size()
const {
return static_cast<size_t>(Last - First); }
166#define NODE(NodeKind) K##NodeKind,
167#include "ItaniumNodes.def"
229 template<
typename Fn>
void visit(Fn
F)
const;
273 bool StrictlyWorse =
false)
const {
322 : Elements(Elements_), NumElements(NumElements_) {}
324 bool empty()
const {
return NumElements == 0; }
325 size_t size()
const {
return NumElements; }
328 Node **
end()
const {
return Elements + NumElements; }
333 bool FirstElement =
true;
334 for (
size_t Idx = 0;
Idx != NumElements; ++
Idx) {
335 size_t BeforeComma = OB.getCurrentPosition();
338 size_t AfterComma = OB.getCurrentPosition();
343 if (AfterComma == OB.getCurrentPosition()) {
344 OB.setCurrentPosition(BeforeComma);
348 FirstElement =
false;
368 const std::string_view Suffix;
372 :
Node(KDotSuffix), Prefix(Prefix_), Suffix(Suffix_) {}
374 template<
typename Fn>
void match(Fn
F)
const {
F(Prefix, Suffix); }
386 std::string_view Ext;
391 :
Node(KVendorExtQualType), Ty(Ty_), Ext(Ext_), TA(TA_) {}
394 std::string_view
getExt()
const {
return Ext; }
397 template <
typename Fn>
void match(Fn
F)
const {
F(Ty, Ext, TA); }
473 :
Node(KConversionOperatorType), Ty(Ty_) {}
475 template<
typename Fn>
void match(Fn
F)
const {
F(Ty); }
485 const std::string_view Postfix;
489 :
Node(KPostfixQualifiedType), Ty(Ty_), Postfix(Postfix_) {}
491 template<
typename Fn>
void match(Fn
F)
const {
F(Ty, Postfix); }
500 const std::string_view Name;
505 template<
typename Fn>
void match(Fn
F)
const {
F(Name); }
507 std::string_view
getName()
const {
return Name; }
519 :
Node(KBitIntType), Size(Size_), Signed(Signed_) {}
521 template <
typename Fn>
void match(Fn
F)
const {
F(Size, Signed); }
528 Size->printAsOperand(OB);
534 std::string_view
Kind;
538 :
Node(KElaboratedTypeSpefType),
Kind(Kind_), Child(Child_) {}
550 std::string_view Transform;
554 :
Node(KTransformedType), Transform(Transform_),
BaseType(BaseType_) {}
591 :
Node(KEnableIfAttr), Conditions(Conditions_) {}
593 template<
typename Fn>
void match(Fn
F)
const {
F(Conditions); }
596 OB +=
" [enable_if:";
604 std::string_view Protocol;
610 :
Node(KObjCProtoName), Ty(Ty_), Protocol(Protocol_) {}
612 template<
typename Fn>
void match(Fn
F)
const {
F(Ty, Protocol); }
615 return Ty->
getKind() == KNameType &&
637 template<
typename Fn>
void match(Fn
F)
const {
F(Pointee); }
640 return Pointee->hasRHSComponent(OB);
645 if (Pointee->getKind() != KObjCProtoName ||
647 Pointee->printLeft(OB);
648 if (Pointee->hasArray(OB))
650 if (Pointee->hasArray(OB) || Pointee->hasFunction(OB))
654 const auto *objcProto =
static_cast<const ObjCProtoName *
>(Pointee);
656 OB += objcProto->Protocol;
662 if (Pointee->getKind() != KObjCProtoName ||
664 if (Pointee->hasArray(OB) || Pointee->hasFunction(OB))
666 Pointee->printRight(OB);
681 mutable bool Printing =
false;
690 std::pair<ReferenceKind, const Node *> collapse(
OutputBuffer &OB)
const {
691 auto SoFar = std::make_pair(RK, Pointee);
697 if (SN->
getKind() != KReferenceType)
700 SoFar.second = RT->Pointee;
701 SoFar.first = std::min(SoFar.first, RT->RK);
705 if (Prev.
size() > 1 && SoFar.second == Prev[(Prev.
size() - 1) / 2]) {
707 SoFar.second =
nullptr;
717 Pointee(Pointee_), RK(RK_) {}
719 template<
typename Fn>
void match(Fn
F)
const {
F(Pointee, RK); }
729 std::pair<ReferenceKind, const Node *> Collapsed = collapse(OB);
730 if (!Collapsed.second)
732 Collapsed.second->printLeft(OB);
733 if (Collapsed.second->hasArray(OB))
735 if (Collapsed.second->hasArray(OB) || Collapsed.second->hasFunction(OB))
738 OB += (Collapsed.first == ReferenceKind::LValue ?
"&" :
"&&");
744 std::pair<ReferenceKind, const Node *> Collapsed = collapse(OB);
745 if (!Collapsed.second)
747 if (Collapsed.second->hasArray(OB) || Collapsed.second->hasFunction(OB))
749 Collapsed.second->printRight(OB);
754 const Node *ClassType;
755 const Node *MemberType;
760 ClassType(ClassType_), MemberType(MemberType_) {}
762 template<
typename Fn>
void match(Fn
F)
const {
F(ClassType, MemberType); }
774 ClassType->print(OB);
794 Base(Base_), Dimension(Dimension_) {}
796 template<
typename Fn>
void match(Fn
F)
const {
F(Base, Dimension); }
804 if (OB.back() !=
']')
808 Dimension->print(OB);
810 Base->printRight(OB);
814 const NodeArray &Elements)
const override {
815 if (Base->getKind() == KNameType &&
817 return Elements.printAsString(OB);
828 const Node *ExceptionSpec;
833 :
Node(KFunctionType,
836 Ret(Ret_), Params(Params_), CVQuals(CVQuals_), RefQual(RefQual_),
837 ExceptionSpec(ExceptionSpec_) {}
839 template<
typename Fn>
void match(Fn
F)
const {
840 F(Ret, Params, CVQuals, RefQual, ExceptionSpec);
876 if (ExceptionSpec !=
nullptr) {
878 ExceptionSpec->
print(OB);
888 template<
typename Fn>
void match(Fn
F)
const {
F(E); }
902 :
Node(KDynamicExceptionSpec), Types(Types_) {}
904 template<
typename Fn>
void match(Fn
F)
const {
F(Types); }
909 Types.printWithComma(OB);
926 :
Node(KExplicitObjectParameter), Base(Base_) {
929 "Creating an ExplicitObjectParameter without a valid Base Node.");
932 template <
typename Fn>
void match(Fn
F)
const {
F(Base); }
945 const Node *Requires;
951 const Node *Attrs_,
const Node *Requires_,
953 :
Node(KFunctionEncoding,
956 Ret(Ret_), Name(Name_), Params(Params_), Attrs(Attrs_),
957 Requires(Requires_), CVQuals(CVQuals_), RefQual(RefQual_) {}
959 template<
typename Fn>
void match(Fn
F)
const {
960 F(Ret, Name, Params, Attrs, Requires, CVQuals, RefQual);
976 if (!Ret->hasRHSComponent(OB))
1001 if (Attrs !=
nullptr)
1004 if (Requires !=
nullptr) {
1006 Requires->
print(OB);
1021 OB +=
"operator\"\" ";
1027 const std::string_view Special;
1032 :
Node(KSpecialName), Special(Special_), Child(Child_) {}
1034 template<
typename Fn>
void match(Fn
F)
const {
F(Special, Child); }
1043 const Node *FirstType;
1044 const Node *SecondType;
1048 :
Node(KCtorVtableSpecialName),
1049 FirstType(FirstType_), SecondType(SecondType_) {}
1051 template<
typename Fn>
void match(Fn
F)
const {
F(FirstType, SecondType); }
1054 OB +=
"construction vtable for ";
1055 FirstType->print(OB);
1057 SecondType->
print(OB);
1084 :
Node(KMemberLikeFriendName),
Qual(Qual_),
Name(Name_) {}
1106 template <
typename Fn>
void match(Fn
F)
const {
1155 const Node *Qualifier;
1160 :
Node(KQualifiedName), Qualifier(Qualifier_), Name(Name_) {}
1162 template<
typename Fn>
void match(Fn
F)
const {
F(Qualifier, Name); }
1164 std::string_view
getBaseName()
const override {
return Name->getBaseName(); }
1167 Qualifier->print(OB);
1175 const Node *Dimension;
1179 :
Node(KVectorType),
BaseType(BaseType_), Dimension(Dimension_) {}
1190 Dimension->print(OB);
1196 const Node *Dimension;
1200 :
Node(KPixelVectorType), Dimension(Dimension_) {}
1202 template<
typename Fn>
void match(Fn
F)
const {
F(Dimension); }
1206 OB +=
"pixel vector[";
1207 Dimension->print(OB);
1213 const Node *Dimension;
1217 :
Node(KBinaryFPType), Dimension(Dimension_) {}
1219 template<
typename Fn>
void match(Fn
F)
const {
F(Dimension); }
1223 Dimension->print(OB);
1241 :
Node(KSyntheticTemplateParamName),
Kind(Kind_), Index(Index_) {}
1247 case TemplateParamKind::Type:
1250 case TemplateParamKind::NonType:
1253 case TemplateParamKind::Template:
1268 :
Node(KTemplateParamQualifiedArg), Param(Param_), Arg(Arg_) {}
1270 template <
typename Fn>
void match(Fn
F)
const {
F(Param, Arg); }
1286 :
Node(KTypeTemplateParamDecl,
Cache::
Yes), Name(Name_) {}
1288 template<
typename Fn>
void match(Fn
F)
const {
F(Name); }
1303 Constraint(Constraint_), Name(Name_) {}
1305 template<
typename Fn>
void match(Fn
F)
const {
F(Constraint, Name); }
1308 Constraint->print(OB);
1322 :
Node(KNonTypeTemplateParamDecl,
Cache::
Yes), Name(Name_), Type(Type_) {}
1324 template<
typename Fn>
void match(Fn
F)
const {
F(Name, Type); }
1327 Type->printLeft(OB);
1328 if (!Type->hasRHSComponent(OB))
1334 Type->printRight(OB);
1347 :
Node(KTemplateTemplateParamDecl,
Cache::
Yes), Name(Name_),
1348 Params(Params_), Requires(Requires_) {}
1350 template <
typename Fn>
void match(Fn
F)
const {
F(Name, Params, Requires); }
1356 OB +=
"> typename ";
1361 if (Requires !=
nullptr) {
1363 Requires->
print(OB);
1374 :
Node(KTemplateParamPackDecl,
Cache::
Yes), Param(Param_) {}
1376 template<
typename Fn>
void match(Fn
F)
const {
F(Param); }
1379 Param->printLeft(OB);
1400 if (OB.CurrentPackMax == std::numeric_limits<unsigned>::max()) {
1401 OB.CurrentPackMax =
static_cast<unsigned>(Data.size());
1402 OB.CurrentPackIndex = 0;
1409 if (std::all_of(Data.begin(), Data.end(),
1410 [](
Node *
P) { return P->getArrayCache() == Cache::No; }))
1412 if (std::all_of(Data.begin(), Data.end(),
1413 [](
Node *
P) { return P->getFunctionCache() == Cache::No; }))
1415 if (std::all_of(Data.begin(), Data.end(), [](
Node *
P) {
1416 return P->getRHSComponentCache() == Cache::No;
1421 template<
typename Fn>
void match(Fn
F)
const {
F(Data); }
1424 initializePackExpansion(OB);
1425 size_t Idx = OB.CurrentPackIndex;
1426 return Idx < Data.size() && Data[
Idx]->hasRHSComponent(OB);
1429 initializePackExpansion(OB);
1430 size_t Idx = OB.CurrentPackIndex;
1431 return Idx < Data.size() && Data[
Idx]->hasArray(OB);
1434 initializePackExpansion(OB);
1435 size_t Idx = OB.CurrentPackIndex;
1436 return Idx < Data.size() && Data[
Idx]->hasFunction(OB);
1439 initializePackExpansion(OB);
1440 size_t Idx = OB.CurrentPackIndex;
1441 return Idx < Data.size() ? Data[
Idx]->getSyntaxNode(OB) :
this;
1445 initializePackExpansion(OB);
1446 size_t Idx = OB.CurrentPackIndex;
1447 if (
Idx < Data.size())
1448 Data[
Idx]->printLeft(OB);
1451 initializePackExpansion(OB);
1452 size_t Idx = OB.CurrentPackIndex;
1453 if (
Idx < Data.size())
1454 Data[
Idx]->printRight(OB);
1467 :
Node(KTemplateArgumentPack), Elements(Elements_) {}
1469 template<
typename Fn>
void match(Fn
F)
const {
F(Elements); }
1474 Elements.printWithComma(OB);
1485 :
Node(KParameterPackExpansion), Child(Child_) {}
1487 template<
typename Fn>
void match(Fn
F)
const {
F(Child); }
1492 constexpr unsigned Max = std::numeric_limits<unsigned>::max();
1495 size_t StreamPos = OB.getCurrentPosition();
1503 if (OB.CurrentPackMax == Max) {
1510 if (OB.CurrentPackMax == 0) {
1511 OB.setCurrentPosition(StreamPos);
1516 for (
unsigned I = 1,
E = OB.CurrentPackMax;
I <
E; ++
I) {
1518 OB.CurrentPackIndex =
I;
1530 :
Node(KTemplateArgs), Params(Params_), Requires(Requires_) {}
1532 template<
typename Fn>
void match(Fn
F)
const {
F(Params, Requires); }
1539 Params.printWithComma(OB);
1581 template<
typename Fn>
void match(Fn
F)
const =
delete;
1645 :
Node(KGlobalQualifiedName), Child(Child_) {}
1647 template<
typename Fn>
void match(Fn
F)
const {
F(Child); }
1649 std::string_view
getBaseName()
const override {
return Child->getBaseName(); }
1687 case SpecialSubKind::allocator:
1688 return {
"allocator"};
1689 case SpecialSubKind::basic_string:
1690 return {
"basic_string"};
1691 case SpecialSubKind::string:
1692 return {
"basic_string"};
1693 case SpecialSubKind::istream:
1694 return {
"basic_istream"};
1695 case SpecialSubKind::ostream:
1696 return {
"basic_ostream"};
1697 case SpecialSubKind::iostream:
1698 return {
"basic_iostream"};
1707 OB <<
"<char, std::char_traits<char>";
1708 if (
SSK == SpecialSubKind::string)
1709 OB <<
", std::allocator<char>";
1727 SV.remove_prefix(
sizeof(
"basic_") - 1);
1742 const Node *Basename;
1748 :
Node(KCtorDtorName), Basename(Basename_), IsDtor(IsDtor_),
1749 Variant(Variant_) {}
1751 template<
typename Fn>
void match(Fn
F)
const {
F(Basename, IsDtor, Variant); }
1756 OB += Basename->getBaseName();
1766 template<
typename Fn>
void match(Fn
F)
const {
F(Base); }
1770 Base->printLeft(OB);
1775 const std::string_view Count;
1779 :
Node(KUnnamedTypeName), Count(Count_) {}
1781 template<
typename Fn>
void match(Fn
F)
const {
F(Count); }
1792 const Node *Requires1;
1794 const Node *Requires2;
1795 std::string_view Count;
1800 std::string_view Count_)
1801 :
Node(KClosureTypeName), TemplateParams(TemplateParams_),
1802 Requires1(Requires1_), Params(Params_), Requires2(Requires2_),
1805 template<
typename Fn>
void match(Fn
F)
const {
1806 F(TemplateParams, Requires1, Params, Requires2, Count);
1810 if (!TemplateParams.
empty()) {
1816 if (Requires1 !=
nullptr) {
1818 Requires1->
print(OB);
1824 if (Requires2 !=
nullptr) {
1826 Requires2->
print(OB);
1843 :
Node(KStructuredBindingName), Bindings(Bindings_) {}
1845 template<
typename Fn>
void match(Fn
F)
const {
F(Bindings); }
1858 const std::string_view InfixOperator;
1864 :
Node(KBinaryExpr, Prec_),
LHS(LHS_), InfixOperator(InfixOperator_),
1867 template <
typename Fn>
void match(Fn
F)
const {
1872 bool ParenAll = OB.isGtInsideTemplateArgs() &&
1873 (InfixOperator ==
">" || InfixOperator ==
">>");
1880 if (!(InfixOperator ==
","))
1882 OB += InfixOperator;
1896 :
Node(KArraySubscriptExpr, Prec_), Op1(Op1_), Op2(Op2_) {}
1898 template <
typename Fn>
void match(Fn
F)
const {
1912 const std::string_view Operator;
1916 :
Node(KPostfixExpr, Prec_), Child(Child_), Operator(Operator_) {}
1918 template <
typename Fn>
void match(Fn
F)
const {
1936 :
Node(KConditionalExpr, Prec_),
Cond(Cond_), Then(Then_), Else(Else_) {}
1938 template <
typename Fn>
void match(Fn
F)
const {
1945 Then->printAsOperand(OB);
1953 const std::string_view
Kind;
1961 template <
typename Fn>
void match(Fn
F)
const {
1974 const Node *SubExpr;
1975 std::string_view Offset;
1981 std::string_view Offset_,
NodeArray UnionSelectors_,
1982 bool OnePastTheEnd_)
1983 :
Node(KSubobjectExpr), Type(Type_), SubExpr(SubExpr_), Offset(Offset_),
1984 UnionSelectors(UnionSelectors_), OnePastTheEnd(OnePastTheEnd_) {}
1986 template<
typename Fn>
void match(Fn
F)
const {
1987 F(Type, SubExpr, Offset, UnionSelectors, OnePastTheEnd);
1994 OB +=
" at offset ";
1995 if (Offset.empty()) {
1997 }
else if (Offset[0] ==
'n') {
1999 OB += std::string_view(Offset.data() + 1, Offset.size() - 1);
2008 const std::string_view Prefix;
2010 const std::string_view Postfix;
2015 :
Node(KEnclosingExpr, Prec_), Prefix(Prefix_), Infix(Infix_) {}
2017 template <
typename Fn>
void match(Fn
F)
const {
2032 const std::string_view CastKind;
2039 :
Node(KCastExpr, Prec_), CastKind(CastKind_), To(To_),
From(From_) {}
2041 template <
typename Fn>
void match(Fn
F)
const {
2054 From->printAsOperand(OB);
2064 :
Node(KSizeofParamPackExpr), Pack(Pack_) {}
2066 template<
typename Fn>
void match(Fn
F)
const {
F(Pack); }
2084 :
Node(KCallExpr, Prec_), Callee(Callee_), Args(Args_),
2085 IsParen(IsParen_) {}
2087 template <
typename Fn>
void match(Fn
F)
const {
2098 Args.printWithComma(OB);
2112 bool IsArray_,
Prec Prec_)
2113 :
Node(KNewExpr, Prec_), ExprList(ExprList_), Type(Type_),
2114 InitList(InitList_), IsGlobal(IsGlobal_), IsArray(IsArray_) {}
2116 template<
typename Fn>
void match(Fn
F)
const {
2126 if (!ExprList.
empty()) {
2133 if (!InitList.
empty()) {
2148 :
Node(KDeleteExpr, Prec_), Op(Op_), IsGlobal(IsGlobal_),
2149 IsArray(IsArray_) {}
2151 template <
typename Fn>
void match(Fn
F)
const {
2167 std::string_view Prefix;
2172 :
Node(KPrefixExpr, Prec_), Prefix(Prefix_), Child(Child_) {}
2174 template <
typename Fn>
void match(Fn
F)
const {
2185 std::string_view Number;
2205 :
Node(KConversionExpr, Prec_), Type(Type_), Expressions(Expressions_) {}
2207 template <
typename Fn>
void match(Fn
F)
const {
2223 const Node *SubExpr;
2224 std::string_view Offset;
2228 std::string_view Offset_,
Prec Prec_)
2229 :
Node(KPointerToMemberConversionExpr, Prec_), Type(Type_),
2230 SubExpr(SubExpr_), Offset(Offset_) {}
2232 template <
typename Fn>
void match(Fn
F)
const {
2251 :
Node(KInitListExpr), Ty(Ty_), Inits(Inits_) {}
2253 template<
typename Fn>
void match(Fn
F)
const {
F(Ty, Inits); }
2273 :
Node(KBracedExpr), Elem(Elem_), Init(Init_), IsArray(IsArray_) {}
2275 template<
typename Fn>
void match(Fn
F)
const {
F(Elem, Init, IsArray); }
2286 if (Init->
getKind() != KBracedExpr && Init->
getKind() != KBracedRangeExpr)
2298 :
Node(KBracedRangeExpr), First(First_), Last(Last_), Init(Init_) {}
2300 template<
typename Fn>
void match(Fn
F)
const {
F(First, Last, Init); }
2308 if (Init->
getKind() != KBracedExpr && Init->
getKind() != KBracedRangeExpr)
2315 const Node *Pack, *Init;
2316 std::string_view OperatorName;
2320 FoldExpr(
bool IsLeftFold_, std::string_view OperatorName_,
const Node *Pack_,
2322 :
Node(KFoldExpr), Pack(Pack_), Init(Init_), OperatorName(OperatorName_),
2323 IsLeftFold(IsLeftFold_) {}
2325 template<
typename Fn>
void match(Fn
F)
const {
2326 F(IsLeftFold, OperatorName, Pack, Init);
2330 auto PrintPack = [&] {
2340 if (!IsLeftFold || Init !=
nullptr) {
2346 OB <<
" " << OperatorName <<
" ";
2349 if (IsLeftFold || Init !=
nullptr) {
2351 OB <<
" " << OperatorName <<
" ";
2367 template<
typename Fn>
void match(Fn
F)
const {
F(Op); }
2381 template<
typename Fn>
void match(Fn
F)
const {
F(Value); }
2384 OB += Value ? std::string_view(
"true") : std::string_view(
"false");
2394 template<
typename Fn>
void match(Fn
F)
const {
F(Type); }
2409 template<
typename Fn>
void match(Fn
F)
const {
F(Type); }
2413 if (Type->getKind() == KClosureTypeName)
2422 std::string_view Integer;
2426 :
Node(KEnumLiteral), Ty(Ty_), Integer(Integer_) {}
2428 template<
typename Fn>
void match(Fn
F)
const {
F(Ty, Integer); }
2435 if (Integer[0] ==
'n')
2436 OB <<
'-' << std::string_view(Integer.data() + 1, Integer.size() - 1);
2443 std::string_view Type;
2444 std::string_view Value;
2448 :
Node(KIntegerLiteral), Type(Type_), Value(Value_) {}
2450 template<
typename Fn>
void match(Fn
F)
const {
F(Type, Value); }
2453 if (Type.size() > 3) {
2459 if (Value[0] ==
'n')
2460 OB <<
'-' << std::string_view(Value.data() + 1, Value.size() - 1);
2464 if (Type.size() <= 3)
2468 std::string_view
value()
const {
return Value; }
2476 :
Node(KRequiresExpr), Parameters(Parameters_),
2477 Requirements(Requirements_) {}
2479 template<
typename Fn>
void match(Fn
F)
const {
F(Parameters, Requirements); }
2483 if (!Parameters.empty()) {
2486 Parameters.printWithComma(OB);
2491 for (
const Node *Req : Requirements) {
2502 const Node *TypeConstraint;
2505 const Node *TypeConstraint_)
2506 :
Node(KExprRequirement), Expr(Expr_), IsNoexcept(IsNoexcept_),
2507 TypeConstraint(TypeConstraint_) {}
2509 template <
typename Fn>
void match(Fn
F)
const {
2510 F(Expr, IsNoexcept, TypeConstraint);
2515 if (IsNoexcept || TypeConstraint)
2518 if (IsNoexcept || TypeConstraint)
2522 if (TypeConstraint) {
2524 TypeConstraint->
print(OB);
2534 :
Node(KTypeRequirement), Type(Type_) {}
2536 template <
typename Fn>
void match(Fn
F)
const {
F(Type); }
2546 const Node *Constraint;
2549 :
Node(KNestedRequirement), Constraint(Constraint_) {}
2551 template <
typename Fn>
void match(Fn
F)
const {
F(Constraint); }
2555 Constraint->
print(OB);
2564 return Node::KFloatLiteral;
2567 return Node::KDoubleLiteral;
2570 return Node::KLongDoubleLiteral;
2575 const std::string_view Contents;
2577 static constexpr Kind KindForClass =
2582 :
Node(KindForClass), Contents(Contents_) {}
2584 template<
typename Fn>
void match(Fn
F)
const {
F(Contents); }
2588 if (Contents.size() >=
N) {
2591 char buf[
sizeof(
Float)];
2593 const char *t = Contents.data();
2594 const char *last = t +
N;
2596 for (; t != last; ++t, ++e) {
2597 unsigned d1 = isdigit(*t) ?
static_cast<unsigned>(*t -
'0')
2598 :
static_cast<unsigned>(*t -
'a' + 10);
2600 unsigned d0 = isdigit(*t) ?
static_cast<unsigned>(*t -
'0')
2601 :
static_cast<unsigned>(*t -
'a' + 10);
2602 *e =
static_cast<char>((d1 << 4) + d0);
2604#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
2605 std::reverse(buf, e);
2609 OB += std::string_view(num, n);
2620template<
typename Fn>
2625 return F(static_cast<const X *>(this));
2626#include "ItaniumNodes.def"
2634 template <> struct NodeKind<X> { \
2635 static constexpr Node::Kind Kind = Node::K##X; \
2636 static constexpr const char *name() { return #X; } \
2638#include "ItaniumNodes.def"
2641 auto StartPos = OB.getCurrentPosition();
2642 auto Fail = [&OB, StartPos] {
2643 OB.setCurrentPosition(StartPos);
2648 bool LastWasNumericEscape =
false;
2649 for (
const Node *Element : *
this) {
2650 if (Element->
getKind() != Node::KIntegerLiteral)
2652 int integer_value = 0;
2654 if (c <
'0' || c >
'9' || integer_value > 25)
2656 integer_value *= 10;
2657 integer_value += c -
'0';
2659 if (integer_value > 255)
2663 if (LastWasNumericEscape) {
2664 if ((integer_value >=
'0' && integer_value <=
'9') ||
2665 (integer_value >=
'a' && integer_value <=
'f') ||
2666 (integer_value >=
'A' && integer_value <=
'F')) {
2671 LastWasNumericEscape =
false;
2674 switch (integer_value) {
2707 if (integer_value < 32 || integer_value == 127) {
2708 constexpr char Hex[] =
"0123456789ABCDEF";
2710 if (integer_value > 7)
2712 if (integer_value >= 16)
2713 OB += Hex[integer_value >> 4];
2714 OB += Hex[integer_value & 0xF];
2715 LastWasNumericEscape =
true;
2720 OB += (
char)integer_value;
2748 size_t OldNumTemplateParamLists;
2753 : Parser(TheParser),
2813 void reset(
const char *First_,
const char *Last_) {
2822 for (
int I = 0;
I != 3; ++
I)
2832 size_t sz =
static_cast<size_t>(end - begin);
2834 Node **data =
new (mem)
Node *[sz];
2835 std::copy(begin, end, data);
2865 char look(
unsigned Lookahead = 0)
const {
2866 if (
static_cast<size_t>(
Last -
First) <= Lookahead)
2868 return First[Lookahead];
2886 return look() ==
'T' &&
2887 std::string_view(
"yptnk").find(
look(1)) != std::string_view::npos;
2937 for (;
I <
E; ++
I) {
2994 return *
this <
Other.Enc;
2997 return Enc[0] < Peek[0] || (
Enc[0] == Peek[0] &&
Enc[1] < Peek[1]);
3000 return Enc[0] == Peek[0] &&
Enc[1] == Peek[1];
3006 std::string_view Res =
Name;
3009 "operator name does not start with 'operator'");
3010 Res.remove_prefix(
sizeof(
"operator") - 1);
3012 Res.remove_prefix(1);
3045template <
typename Derived,
typename Alloc>
3048 return getDerived().parseNestedName(State);
3050 return getDerived().parseLocalName(State);
3052 Node *Result =
nullptr;
3053 bool IsSubst =
false;
3055 Result = getDerived().parseUnscopedName(State, &IsSubst);
3059 if (look() ==
'I') {
3064 Node *TA = getDerived().parseTemplateArgs(State !=
nullptr);
3069 Result = make<NameWithTemplateArgs>(Result, TA);
3070 }
else if (IsSubst) {
3081template <
typename Derived,
typename Alloc>
3083 if (!consumeIf(
'Z'))
3085 Node *Encoding = getDerived().parseEncoding();
3086 if (Encoding ==
nullptr || !consumeIf(
'E'))
3089 if (consumeIf(
's')) {
3091 auto *StringLitName = make<NameType>(
"string literal");
3094 return make<LocalName>(Encoding, StringLitName);
3101 if (consumeIf(
'd')) {
3103 if (!consumeIf(
'_'))
3105 Node *
N = getDerived().parseName(State);
3108 return make<LocalName>(Encoding,
N);
3111 Node *Entity = getDerived().parseName(State);
3112 if (Entity ==
nullptr)
3115 return make<LocalName>(Encoding, Entity);
3121template <
typename Derived,
typename Alloc>
3126 Node *Std =
nullptr;
3127 if (consumeIf(
"St")) {
3128 Std = make<NameType>(
"std");
3133 Node *Res =
nullptr;
3135 if (look() ==
'S') {
3136 Node *S = getDerived().parseSubstitution();
3139 if (S->
getKind() == Node::KModuleName)
3141 else if (IsSubst && Std ==
nullptr) {
3149 if (Res ==
nullptr || Std !=
nullptr) {
3150 Res = getDerived().parseUnqualifiedName(State, Std,
Module);
3162template <
typename Derived,
typename Alloc>
3165 if (getDerived().parseModuleNameOpt(
Module))
3168 bool IsMemberLikeFriend = Scope && consumeIf(
'F');
3173 if (look() >=
'1' && look() <=
'9') {
3174 Result = getDerived().parseSourceName(State);
3175 }
else if (look() ==
'U') {
3176 Result = getDerived().parseUnnamedTypeName(State);
3177 }
else if (consumeIf(
"DC")) {
3179 size_t BindingsBegin = Names.
size();
3181 Node *Binding = getDerived().parseSourceName(State);
3182 if (Binding ==
nullptr)
3185 }
while (!consumeIf(
'E'));
3186 Result = make<StructuredBindingName>(popTrailingNodeArray(BindingsBegin));
3187 }
else if (look() ==
'C' || look() ==
'D') {
3189 if (Scope ==
nullptr ||
Module !=
nullptr)
3191 Result = getDerived().parseCtorDtorName(Scope, State);
3193 Result = getDerived().parseOperatorName(State);
3196 if (Result !=
nullptr &&
Module !=
nullptr)
3197 Result = make<ModuleEntity>(
Module, Result);
3198 if (Result !=
nullptr)
3199 Result = getDerived().parseAbiTags(Result);
3200 if (Result !=
nullptr && IsMemberLikeFriend)
3201 Result = make<MemberLikeFriendName>(Scope, Result);
3202 else if (Result !=
nullptr && Scope !=
nullptr)
3203 Result = make<NestedName>(Scope, Result);
3213template <
typename Derived,
typename Alloc>
3216 while (consumeIf(
'W')) {
3217 bool IsPartition = consumeIf(
'P');
3218 Node *Sub = getDerived().parseSourceName(
nullptr);
3236template <
typename Derived,
typename Alloc>
3241 if (State !=
nullptr)
3242 TemplateParams.
clear();
3244 if (consumeIf(
"Ut")) {
3245 std::string_view Count = parseNumber();
3246 if (!consumeIf(
'_'))
3248 return make<UnnamedTypeName>(Count);
3250 if (consumeIf(
"Ul")) {
3252 TemplateParams.
size());
3255 size_t ParamsBegin = Names.
size();
3256 while (getDerived().isTemplateParamDecl()) {
3258 getDerived().parseTemplateParamDecl(LambdaTemplateParams.
params());
3263 NodeArray TempParams = popTrailingNodeArray(ParamsBegin);
3287 if (TempParams.
empty())
3290 Node *Requires1 =
nullptr;
3291 if (consumeIf(
'Q')) {
3292 Requires1 = getDerived().parseConstraintExpr();
3293 if (Requires1 ==
nullptr)
3297 if (!consumeIf(
"v")) {
3299 Node *
P = getDerived().parseType();
3303 }
while (look() !=
'E' && look() !=
'Q');
3305 NodeArray Params = popTrailingNodeArray(ParamsBegin);
3307 Node *Requires2 =
nullptr;
3308 if (consumeIf(
'Q')) {
3309 Requires2 = getDerived().parseConstraintExpr();
3310 if (Requires2 ==
nullptr)
3314 if (!consumeIf(
'E'))
3317 std::string_view Count = parseNumber();
3318 if (!consumeIf(
'_'))
3320 return make<ClosureTypeName>(TempParams, Requires1, Params, Requires2,
3323 if (consumeIf(
"Ub")) {
3324 (void)parseNumber();
3325 if (!consumeIf(
'_'))
3327 return make<NameType>(
"'block-literal'");
3333template <
typename Derived,
typename Alloc>
3336 if (parsePositiveInteger(&Length))
3338 if (numLeft() < Length || Length == 0)
3340 std::string_view
Name(First, Length);
3343 return make<NameType>(
"(anonymous namespace)");
3344 return make<NameType>(
Name);
3348template <
typename Derived,
typename Alloc>
3360 "operator co_await"},
3372 "operator delete[]"},
3420 "reinterpret_cast"},
3432template <
typename Derived,
typename Alloc>
3438template <
typename Derived,
typename Alloc>
3446 size_t lower = 0u, upper = NumOps - 1;
3447 while (upper != lower) {
3448 size_t middle = (upper + lower) / 2;
3449 if (Ops[middle] < First)
3454 if (Ops[lower] != First)
3464template <
typename Derived,
typename Alloc>
3467 if (
const auto *Op = parseOperatorEncoding()) {
3468 if (Op->getKind() == OperatorInfo::CCast) {
3475 PermitForwardTemplateReferences ||
3477 Node *Ty = getDerived().parseType();
3481 return make<ConversionOperatorType>(Ty);
3484 if (Op->getKind() >= OperatorInfo::Unnameable)
3487 if (Op->getKind() == OperatorInfo::Member && !Op->getFlag())
3491 return make<NameType>(Op->getName());
3494 if (consumeIf(
"li")) {
3496 Node *SN = getDerived().parseSourceName(State);
3499 return make<LiteralOperator>(SN);
3502 if (consumeIf(
'v')) {
3504 if (look() >=
'0' && look() <=
'9') {
3506 Node *SN = getDerived().parseSourceName(State);
3509 return make<ConversionOperatorType>(SN);
3527template <
typename Derived,
typename Alloc>
3531 if (SoFar->
getKind() == Node::KSpecialSubstitution) {
3533 SoFar = make<ExpandedSpecialSubstitution>(
3539 if (consumeIf(
'C')) {
3540 bool IsInherited = consumeIf(
'I');
3541 if (look() !=
'1' && look() !=
'2' && look() !=
'3' && look() !=
'4' &&
3544 int Variant = look() -
'0';
3548 if (getDerived().parseName(State) ==
nullptr)
3551 return make<CtorDtorName>(SoFar,
false, Variant);
3554 if (look() ==
'D' && (look(1) ==
'0' || look(1) ==
'1' || look(1) ==
'2' ||
3555 look(1) ==
'4' || look(1) ==
'5')) {
3556 int Variant = look(1) -
'0';
3559 return make<CtorDtorName>(SoFar,
true, Variant);
3584template <
typename Derived,
typename Alloc>
3587 if (!consumeIf(
'N'))
3592 if (!consumeIf(
'H')) {
3597 if (consumeIf(
'O')) {
3600 }
else if (consumeIf(
'R')) {
3611 Node *SoFar =
nullptr;
3612 while (!consumeIf(
'E')) {
3617 if (look() ==
'T') {
3619 if (SoFar !=
nullptr)
3621 SoFar = getDerived().parseTemplateParam();
3622 }
else if (look() ==
'I') {
3624 if (SoFar ==
nullptr)
3626 Node *TA = getDerived().parseTemplateArgs(State !=
nullptr);
3629 if (SoFar->
getKind() == Node::KNameWithTemplateArgs)
3636 SoFar = make<NameWithTemplateArgs>(SoFar, TA);
3637 }
else if (look() ==
'D' && (look(1) ==
't' || look(1) ==
'T')) {
3639 if (SoFar !=
nullptr)
3641 SoFar = getDerived().parseDecltype();
3645 if (look() ==
'S') {
3648 if (look(1) ==
't') {
3650 S = make<NameType>(
"std");
3652 S = getDerived().parseSubstitution();
3656 if (S->
getKind() == Node::KModuleName) {
3658 }
else if (SoFar !=
nullptr) {
3667 SoFar = getDerived().parseUnqualifiedName(State, SoFar,
Module);
3670 if (SoFar ==
nullptr)
3679 if (SoFar ==
nullptr || Subs.
empty())
3687template <
typename Derived,
typename Alloc>
3689 Node *SN = getDerived().parseSourceName(
nullptr);
3692 if (look() ==
'I') {
3693 Node *TA = getDerived().parseTemplateArgs();
3696 return make<NameWithTemplateArgs>(SN, TA);
3703template <
typename Derived,
typename Alloc>
3706 if (std::isdigit(look()))
3707 Result = getDerived().parseSimpleId();
3709 Result = getDerived().parseUnresolvedType();
3710 if (Result ==
nullptr)
3712 return make<DtorName>(Result);
3718template <
typename Derived,
typename Alloc>
3720 if (look() ==
'T') {
3721 Node *TP = getDerived().parseTemplateParam();
3727 if (look() ==
'D') {
3728 Node *DT = getDerived().parseDecltype();
3734 return getDerived().parseSubstitution();
3744template <
typename Derived,
typename Alloc>
3746 if (std::isdigit(look()))
3747 return getDerived().parseSimpleId();
3749 if (consumeIf(
"dn"))
3750 return getDerived().parseDestructorName();
3754 Node *Oper = getDerived().parseOperatorName(
nullptr);
3755 if (Oper ==
nullptr)
3757 if (look() ==
'I') {
3758 Node *TA = getDerived().parseTemplateArgs();
3761 return make<NameWithTemplateArgs>(Oper, TA);
3778template <
typename Derived,
typename Alloc>
3780 Node *SoFar =
nullptr;
3784 if (consumeIf(
"srN")) {
3785 SoFar = getDerived().parseUnresolvedType();
3786 if (SoFar ==
nullptr)
3789 if (look() ==
'I') {
3790 Node *TA = getDerived().parseTemplateArgs();
3793 SoFar = make<NameWithTemplateArgs>(SoFar, TA);
3798 while (!consumeIf(
'E')) {
3799 Node *Qual = getDerived().parseSimpleId();
3800 if (Qual ==
nullptr)
3802 SoFar = make<QualifiedName>(SoFar, Qual);
3807 Node *Base = getDerived().parseBaseUnresolvedName();
3808 if (Base ==
nullptr)
3810 return make<QualifiedName>(SoFar, Base);
3814 if (!consumeIf(
"sr")) {
3815 SoFar = getDerived().parseBaseUnresolvedName();
3816 if (SoFar ==
nullptr)
3819 SoFar = make<GlobalQualifiedName>(SoFar);
3824 if (std::isdigit(look())) {
3826 Node *Qual = getDerived().parseSimpleId();
3827 if (Qual ==
nullptr)
3830 SoFar = make<QualifiedName>(SoFar, Qual);
3832 SoFar = make<GlobalQualifiedName>(Qual);
3837 }
while (!consumeIf(
'E'));
3842 SoFar = getDerived().parseUnresolvedType();
3843 if (SoFar ==
nullptr)
3846 if (look() ==
'I') {
3847 Node *TA = getDerived().parseTemplateArgs();
3850 SoFar = make<NameWithTemplateArgs>(SoFar, TA);
3858 Node *Base = getDerived().parseBaseUnresolvedName();
3859 if (Base ==
nullptr)
3861 return make<QualifiedName>(SoFar, Base);
3866template <
typename Derived,
typename Alloc>
3868 while (consumeIf(
'B')) {
3869 std::string_view SN = parseBareSourceName();
3872 N = make<AbiTagAttr>(
N, SN);
3880template <
typename Alloc,
typename Derived>
3883 const char *Tmp = First;
3886 if (numLeft() == 0 || !std::isdigit(*First))
3887 return std::string_view();
3888 while (numLeft() != 0 && std::isdigit(*First))
3890 return std::string_view(Tmp, First - Tmp);
3894template <
typename Alloc,
typename Derived>
3897 if (look() <
'0' || look() >
'9')
3899 while (look() >=
'0' && look() <=
'9') {
3901 *Out +=
static_cast<size_t>(
consume() -
'0');
3906template <
typename Alloc,
typename Derived>
3909 if (parsePositiveInteger(&
Int) || numLeft() <
Int)
3911 std::string_view R(First,
Int);
3924template <
typename Derived,
typename Alloc>
3928 Node *ExceptionSpec =
nullptr;
3929 if (consumeIf(
"Do")) {
3930 ExceptionSpec = make<NameType>(
"noexcept");
3933 }
else if (consumeIf(
"DO")) {
3934 Node *
E = getDerived().parseExpr();
3935 if (
E ==
nullptr || !consumeIf(
'E'))
3937 ExceptionSpec = make<NoexceptSpec>(
E);
3940 }
else if (consumeIf(
"Dw")) {
3941 size_t SpecsBegin = Names.
size();
3942 while (!consumeIf(
'E')) {
3943 Node *
T = getDerived().parseType();
3949 make<DynamicExceptionSpec>(popTrailingNodeArray(SpecsBegin));
3956 if (!consumeIf(
'F'))
3959 Node *ReturnType = getDerived().parseType();
3960 if (ReturnType ==
nullptr)
3964 size_t ParamsBegin = Names.
size();
3970 if (consumeIf(
"RE")) {
3974 if (consumeIf(
"OE")) {
3978 Node *
T = getDerived().parseType();
3984 NodeArray Params = popTrailingNodeArray(ParamsBegin);
3985 return make<FunctionType>(ReturnType, Params, CVQuals,
3986 ReferenceQualifier, ExceptionSpec);
3994template <
typename Derived,
typename Alloc>
3996 if (!consumeIf(
"Dv"))
3998 if (look() >=
'1' && look() <=
'9') {
3999 Node *DimensionNumber = make<NameType>(parseNumber());
4000 if (!DimensionNumber)
4002 if (!consumeIf(
'_'))
4005 return make<PixelVectorType>(DimensionNumber);
4006 Node *ElemType = getDerived().parseType();
4007 if (ElemType ==
nullptr)
4009 return make<VectorType>(ElemType, DimensionNumber);
4012 if (!consumeIf(
'_')) {
4013 Node *DimExpr = getDerived().parseExpr();
4016 if (!consumeIf(
'_'))
4018 Node *ElemType = getDerived().parseType();
4021 return make<VectorType>(ElemType, DimExpr);
4023 Node *ElemType = getDerived().parseType();
4026 return make<VectorType>(ElemType,
nullptr);
4031template <
typename Derived,
typename Alloc>
4033 if (!consumeIf(
'D'))
4035 if (!consumeIf(
't') && !consumeIf(
'T'))
4037 Node *
E = getDerived().parseExpr();
4040 if (!consumeIf(
'E'))
4042 return make<EnclosingExpr>(
"decltype",
E);
4047template <
typename Derived,
typename Alloc>
4049 if (!consumeIf(
'A'))
4052 Node *Dimension =
nullptr;
4054 if (std::isdigit(look())) {
4055 Dimension = make<NameType>(parseNumber());
4058 if (!consumeIf(
'_'))
4060 }
else if (!consumeIf(
'_')) {
4061 Node *DimExpr = getDerived().parseExpr();
4062 if (DimExpr ==
nullptr)
4064 if (!consumeIf(
'_'))
4066 Dimension = DimExpr;
4069 Node *Ty = getDerived().parseType();
4072 return make<ArrayType>(Ty, Dimension);
4076template <
typename Derived,
typename Alloc>
4078 if (!consumeIf(
'M'))
4080 Node *ClassType = getDerived().parseType();
4081 if (ClassType ==
nullptr)
4083 Node *MemberType = getDerived().parseType();
4084 if (MemberType ==
nullptr)
4086 return make<PointerToMemberType>(ClassType, MemberType);
4093template <
typename Derived,
typename Alloc>
4095 std::string_view ElabSpef;
4096 if (consumeIf(
"Ts"))
4097 ElabSpef =
"struct";
4098 else if (consumeIf(
"Tu"))
4100 else if (consumeIf(
"Te"))
4103 Node *
Name = getDerived().parseName();
4104 if (
Name ==
nullptr)
4107 if (!ElabSpef.empty())
4108 return make<ElaboratedTypeSpefType>(ElabSpef,
Name);
4116template <
typename Derived,
typename Alloc>
4118 if (consumeIf(
'U')) {
4119 std::string_view Qual = parseBareSourceName();
4125 constexpr size_t Len =
sizeof(
"objcproto") - 1;
4126 std::string_view ProtoSourceName(Qual.data() + Len, Qual.size() - Len);
4127 std::string_view Proto;
4130 SaveLast(Last, &*ProtoSourceName.rbegin() + 1);
4131 Proto = parseBareSourceName();
4135 Node *Child = getDerived().parseQualifiedType();
4136 if (Child ==
nullptr)
4138 return make<ObjCProtoName>(Child, Proto);
4142 if (look() ==
'I') {
4143 TA = getDerived().parseTemplateArgs();
4148 Node *Child = getDerived().parseQualifiedType();
4149 if (Child ==
nullptr)
4151 return make<VendorExtQualType>(Child, Qual, TA);
4155 Node *Ty = getDerived().parseType();
4159 Ty = make<QualType>(Ty, Quals);
4183template <
typename Derived,
typename Alloc>
4185 Node *Result =
nullptr;
4192 unsigned AfterQuals = 0;
4193 if (look(AfterQuals) ==
'r') ++AfterQuals;
4194 if (look(AfterQuals) ==
'V') ++AfterQuals;
4195 if (look(AfterQuals) ==
'K') ++AfterQuals;
4197 if (look(AfterQuals) ==
'F' ||
4198 (look(AfterQuals) ==
'D' &&
4199 (look(AfterQuals + 1) ==
'o' || look(AfterQuals + 1) ==
'O' ||
4200 look(AfterQuals + 1) ==
'w' || look(AfterQuals + 1) ==
'x'))) {
4201 Result = getDerived().parseFunctionType();
4207 Result = getDerived().parseQualifiedType();
4213 return make<NameType>(
"void");
4217 return make<NameType>(
"wchar_t");
4221 return make<NameType>(
"bool");
4225 return make<NameType>(
"char");
4229 return make<NameType>(
"signed char");
4233 return make<NameType>(
"unsigned char");
4237 return make<NameType>(
"short");
4241 return make<NameType>(
"unsigned short");
4245 return make<NameType>(
"int");
4249 return make<NameType>(
"unsigned int");
4253 return make<NameType>(
"long");
4257 return make<NameType>(
"unsigned long");
4261 return make<NameType>(
"long long");
4265 return make<NameType>(
"unsigned long long");
4269 return make<NameType>(
"__int128");
4273 return make<NameType>(
"unsigned __int128");
4277 return make<NameType>(
"float");
4281 return make<NameType>(
"double");
4285 return make<NameType>(
"long double");
4289 return make<NameType>(
"__float128");
4293 return make<NameType>(
"...");
4298 std::string_view Res = parseBareSourceName();
4304 if (consumeIf(
'I')) {
4308 if (!consumeIf(
'E'))
4310 Result = make<TransformedType>(Res,
BaseType);
4312 Result = make<NameType>(Res);
4320 return make<NameType>(
"decimal64");
4324 return make<NameType>(
"decimal128");
4328 return make<NameType>(
"decimal32");
4332 return make<NameType>(
"half");
4336 Node *DimensionNumber = make<NameType>(parseNumber());
4337 if (!DimensionNumber)
4339 if (!consumeIf(
'_'))
4341 return make<BinaryFPType>(DimensionNumber);
4357 return make<NameType>(
"short _Accum");
4359 return make<NameType>(
"unsigned short _Accum");
4361 return make<NameType>(
"_Accum");
4363 return make<NameType>(
"unsigned _Accum");
4365 return make<NameType>(
"long _Accum");
4367 return make<NameType>(
"unsigned long _Accum");
4377 return make<NameType>(
"short _Fract");
4379 return make<NameType>(
"unsigned short _Fract");
4381 return make<NameType>(
"_Fract");
4383 return make<NameType>(
"unsigned _Fract");
4385 return make<NameType>(
"long _Fract");
4387 return make<NameType>(
"unsigned long _Fract");
4396 if (look(1) ==
'A') {
4401 return make<NameType>(
"_Sat short _Accum");
4403 return make<NameType>(
"_Sat unsigned short _Accum");
4405 return make<NameType>(
"_Sat _Accum");
4407 return make<NameType>(
"_Sat unsigned _Accum");
4409 return make<NameType>(
"_Sat long _Accum");
4411 return make<NameType>(
"_Sat unsigned long _Accum");
4416 if (look(1) ==
'R') {
4421 return make<NameType>(
"_Sat short _Fract");
4423 return make<NameType>(
"_Sat unsigned short _Fract");
4425 return make<NameType>(
"_Sat _Fract");
4427 return make<NameType>(
"_Sat unsigned _Fract");
4429 return make<NameType>(
"_Sat long _Fract");
4431 return make<NameType>(
"_Sat unsigned long _Fract");
4444 bool Signed = look(1) ==
'B';
4446 Node *
Size = std::isdigit(look()) ? make<NameType>(parseNumber())
4447 : getDerived().parseExpr();
4450 if (!consumeIf(
'_'))
4457 return make<NameType>(
"char32_t");
4461 return make<NameType>(
"char16_t");
4465 return make<NameType>(
"char8_t");
4469 return make<NameType>(
"auto");
4473 return make<NameType>(
"decltype(auto)");
4478 std::string_view Kind = look(1) ==
'k' ?
" auto" :
" decltype(auto)";
4480 Node *Constraint = getDerived().parseName();
4483 return make<PostfixQualifiedType>(Constraint, Kind);
4488 return make<NameType>(
"std::nullptr_t");
4493 Result = getDerived().parseDecltype();
4498 Result = getDerived().parseVectorType();
4504 Node *Child = getDerived().parseType();
4507 Result = make<ParameterPackExpansion>(Child);
4516 Result = getDerived().parseFunctionType();
4522 Result = getDerived().parseFunctionType();
4527 Result = getDerived().parseArrayType();
4532 Result = getDerived().parsePointerToMemberType();
4538 if (look(1) ==
's' || look(1) ==
'u' || look(1) ==
'e') {
4539 Result = getDerived().parseClassEnumType();
4543 Result = getDerived().parseTemplateParam();
4544 if (Result ==
nullptr)
4557 if (TryToParseTemplateArgs && look() ==
'I') {
4559 Node *TA = getDerived().parseTemplateArgs();
4562 Result = make<NameWithTemplateArgs>(Result, TA);
4569 Node *
Ptr = getDerived().parseType();
4572 Result = make<PointerType>(
Ptr);
4578 Node *Ref = getDerived().parseType();
4587 Node *Ref = getDerived().parseType();
4596 Node *
P = getDerived().parseType();
4599 Result = make<PostfixQualifiedType>(
P,
" complex");
4605 Node *
P = getDerived().parseType();
4608 Result = make<PostfixQualifiedType>(
P,
" imaginary");
4613 if (look(1) !=
't') {
4614 bool IsSubst =
false;
4615 Result = getDerived().parseUnscopedName(
nullptr, &IsSubst);
4629 if (look() ==
'I' && (!IsSubst || TryToParseTemplateArgs)) {
4632 Node *TA = getDerived().parseTemplateArgs();
4635 Result = make<NameWithTemplateArgs>(Result, TA);
4636 }
else if (IsSubst) {
4647 Result = getDerived().parseClassEnumType();
4655 if (Result !=
nullptr)
4660template <
typename Derived,
typename Alloc>
4664 Node *
E = getDerived().parseExpr();
4667 return make<PrefixExpr>(Kind,
E, Prec);
4670template <
typename Derived,
typename Alloc>
4674 Node *
LHS = getDerived().parseExpr();
4677 Node *
RHS = getDerived().parseExpr();
4680 return make<BinaryExpr>(
LHS, Kind,
RHS, Prec);
4683template <
typename Derived,
typename Alloc>
4685 std::string_view Lit) {
4686 std::string_view Tmp = parseNumber(
true);
4687 if (!Tmp.empty() && consumeIf(
'E'))
4688 return make<IntegerLiteral>(Lit, Tmp);
4693template <
typename Alloc,
typename Derived>
4710template <
typename Derived,
typename Alloc>
4712 if (consumeIf(
"fpT"))
4713 return make<NameType>(
"this");
4714 if (consumeIf(
"fp")) {
4715 parseCVQualifiers();
4716 std::string_view Num = parseNumber();
4717 if (!consumeIf(
'_'))
4719 return make<FunctionParam>(Num);
4721 if (consumeIf(
"fL")) {
4722 if (parseNumber().empty())
4724 if (!consumeIf(
'p'))
4726 parseCVQualifiers();
4727 std::string_view Num = parseNumber();
4728 if (!consumeIf(
'_'))
4730 return make<FunctionParam>(Num);
4737template <
typename Derived,
typename Alloc>
4739 if (!consumeIf(
"cv"))
4744 Ty = getDerived().parseType();
4750 if (consumeIf(
'_')) {
4751 size_t ExprsBegin = Names.
size();
4752 while (!consumeIf(
'E')) {
4753 Node *
E = getDerived().parseExpr();
4758 NodeArray Exprs = popTrailingNodeArray(ExprsBegin);
4759 return make<ConversionExpr>(Ty, Exprs);
4762 Node *
E[1] = {getDerived().parseExpr()};
4763 if (
E[0] ==
nullptr)
4765 return make<ConversionExpr>(Ty, makeNodeArray(
E,
E + 1));
4775template <
typename Derived,
typename Alloc>
4777 if (!consumeIf(
'L'))
4782 return getDerived().parseIntegerLiteral(
"wchar_t");
4784 if (consumeIf(
"b0E"))
4785 return make<BoolExpr>(0);
4786 if (consumeIf(
"b1E"))
4787 return make<BoolExpr>(1);
4791 return getDerived().parseIntegerLiteral(
"char");
4794 return getDerived().parseIntegerLiteral(
"signed char");
4797 return getDerived().parseIntegerLiteral(
"unsigned char");
4800 return getDerived().parseIntegerLiteral(
"short");
4803 return getDerived().parseIntegerLiteral(
"unsigned short");
4806 return getDerived().parseIntegerLiteral(
"");
4809 return getDerived().parseIntegerLiteral(
"u");
4812 return getDerived().parseIntegerLiteral(
"l");
4815 return getDerived().parseIntegerLiteral(
"ul");
4818 return getDerived().parseIntegerLiteral(
"ll");
4821 return getDerived().parseIntegerLiteral(
"ull");
4824 return getDerived().parseIntegerLiteral(
"__int128");
4827 return getDerived().parseIntegerLiteral(
"unsigned __int128");
4830 return getDerived().template parseFloatingLiteral<float>();
4833 return getDerived().template parseFloatingLiteral<double>();
4836#if defined(__powerpc__) || defined(__s390__)
4839 return getDerived().template parseFloatingLiteral<double>();
4841 return getDerived().template parseFloatingLiteral<long double>();
4844 if (consumeIf(
"_Z")) {
4845 Node *R = getDerived().parseEncoding();
4846 if (R !=
nullptr && consumeIf(
'E'))
4851 Node *
T = getDerived().parseType();
4856 return make<StringLiteral>(
T);
4860 if (consumeIf(
"Dn") && (consumeIf(
'0'), consumeIf(
'E')))
4861 return make<NameType>(
"nullptr");
4871 Node *
T = parseUnnamedTypeName(
nullptr);
4872 if (!
T || !consumeIf(
'E'))
4874 return make<LambdaExpr>(
T);
4878 Node *
T = getDerived().parseType();
4881 std::string_view
N = parseNumber(
true);
4884 if (!consumeIf(
'E'))
4886 return make<EnumLiteral>(
T,
N);
4895template <
typename Derived,
typename Alloc>
4897 if (look() ==
'd') {
4901 Node *
Field = getDerived().parseSourceName(
nullptr);
4902 if (
Field ==
nullptr)
4904 Node *Init = getDerived().parseBracedExpr();
4905 if (Init ==
nullptr)
4907 return make<BracedExpr>(
Field, Init,
false);
4912 if (
Index ==
nullptr)
4914 Node *Init = getDerived().parseBracedExpr();
4915 if (Init ==
nullptr)
4917 return make<BracedExpr>(
Index, Init,
true);
4921 Node *RangeBegin = getDerived().parseExpr();
4922 if (RangeBegin ==
nullptr)
4924 Node *RangeEnd = getDerived().parseExpr();
4925 if (RangeEnd ==
nullptr)
4927 Node *Init = getDerived().parseBracedExpr();
4928 if (Init ==
nullptr)
4930 return make<BracedRangeExpr>(RangeBegin, RangeEnd, Init);
4934 return getDerived().parseExpr();
4942template <
typename Derived,
typename Alloc>
4944 if (!consumeIf(
'f'))
4947 bool IsLeftFold =
false, HasInitializer =
false;
4953 HasInitializer =
true;
4956 HasInitializer =
true;
4966 const auto *Op = parseOperatorEncoding();
4969 if (!(Op->getKind() == OperatorInfo::Binary
4970 || (Op->getKind() == OperatorInfo::Member
4971 && Op->getName().back() ==
'*')))
4974 Node *Pack = getDerived().parseExpr();
4975 if (Pack ==
nullptr)
4978 Node *Init =
nullptr;
4979 if (HasInitializer) {
4980 Init = getDerived().parseExpr();
4981 if (Init ==
nullptr)
4985 if (IsLeftFold && Init)
4988 return make<FoldExpr>(IsLeftFold, Op->getSymbol(), Pack, Init);
4994template <
typename Derived,
typename Alloc>
4998 Node *Ty = getDerived().parseType();
5001 Node *Expr = getDerived().parseExpr();
5004 std::string_view
Offset = getDerived().parseNumber(
true);
5005 if (!consumeIf(
'E'))
5007 return make<PointerToMemberConversionExpr>(Ty, Expr,
Offset, Prec);
5014template <
typename Derived,
typename Alloc>
5016 Node *Ty = getDerived().parseType();
5019 Node *Expr = getDerived().parseExpr();
5022 std::string_view
Offset = getDerived().parseNumber(
true);
5023 size_t SelectorsBegin = Names.
size();
5024 while (consumeIf(
'_')) {
5025 Node *Selector = make<NameType>(parseNumber());
5030 bool OnePastTheEnd = consumeIf(
'p');
5031 if (!consumeIf(
'E'))
5033 return make<SubobjectExpr>(
5034 Ty, Expr,
Offset, popTrailingNodeArray(SelectorsBegin), OnePastTheEnd);
5037template <
typename Derived,
typename Alloc>
5042 HasIncompleteTemplateParameterTracking,
true);
5043 return getDerived().parseExpr();
5046template <
typename Derived,
typename Alloc>
5049 if (consumeIf(
"rQ")) {
5051 size_t ParamsBegin = Names.
size();
5052 while (!consumeIf(
'_')) {
5053 Node *
Type = getDerived().parseType();
5054 if (
Type ==
nullptr)
5058 Params = popTrailingNodeArray(ParamsBegin);
5059 }
else if (!consumeIf(
"rq")) {
5064 size_t ReqsBegin = Names.
size();
5066 Node *Constraint =
nullptr;
5067 if (consumeIf(
'X')) {
5069 Node *Expr = getDerived().parseExpr();
5070 if (Expr ==
nullptr)
5072 bool Noexcept = consumeIf(
'N');
5073 Node *TypeReq =
nullptr;
5074 if (consumeIf(
'R')) {
5075 TypeReq = getDerived().parseName();
5076 if (TypeReq ==
nullptr)
5079 Constraint = make<ExprRequirement>(Expr, Noexcept, TypeReq);
5080 }
else if (consumeIf(
'T')) {
5082 Node *
Type = getDerived().parseType();
5083 if (
Type ==
nullptr)
5085 Constraint = make<TypeRequirement>(
Type);
5086 }
else if (consumeIf(
'Q')) {
5094 Node *NestedReq = getDerived().parseExpr();
5095 if (NestedReq ==
nullptr)
5097 Constraint = make<NestedRequirement>(NestedReq);
5099 if (Constraint ==
nullptr)
5102 }
while (!consumeIf(
'E'));
5104 return make<RequiresExpr>(Params, popTrailingNodeArray(ReqsBegin));
5152template <
typename Derived,
typename Alloc>
5154 bool Global = consumeIf(
"gs");
5156 const auto *Op = parseOperatorEncoding();
5158 auto Sym = Op->getSymbol();
5159 switch (Op->getKind()) {
5160 case OperatorInfo::Binary:
5162 return getDerived().parseBinaryExpr(
Sym, Op->getPrecedence());
5163 case OperatorInfo::Prefix:
5165 return getDerived().parsePrefixExpr(
Sym, Op->getPrecedence());
5166 case OperatorInfo::Postfix: {
5169 return getDerived().parsePrefixExpr(
Sym, Op->getPrecedence());
5170 Node *Ex = getDerived().parseExpr();
5173 return make<PostfixExpr>(Ex,
Sym, Op->getPrecedence());
5175 case OperatorInfo::Array: {
5177 Node *Base = getDerived().parseExpr();
5178 if (Base ==
nullptr)
5181 if (
Index ==
nullptr)
5183 return make<ArraySubscriptExpr>(Base,
Index, Op->getPrecedence());
5185 case OperatorInfo::Member: {
5187 Node *
LHS = getDerived().parseExpr();
5190 Node *
RHS = getDerived().parseExpr();
5193 return make<MemberExpr>(
LHS,
Sym,
RHS, Op->getPrecedence());
5195 case OperatorInfo::New: {
5201 size_t Exprs = Names.
size();
5202 while (!consumeIf(
'_')) {
5203 Node *Ex = getDerived().parseExpr();
5208 NodeArray ExprList = popTrailingNodeArray(Exprs);
5209 Node *Ty = getDerived().parseType();
5212 bool HaveInits = consumeIf(
"pi");
5213 size_t InitsBegin = Names.
size();
5214 while (!consumeIf(
'E')) {
5217 Node *Init = getDerived().parseExpr();
5218 if (Init ==
nullptr)
5222 NodeArray Inits = popTrailingNodeArray(InitsBegin);
5223 return make<NewExpr>(ExprList, Ty, Inits, Global,
5224 Op->getFlag(), Op->getPrecedence());
5226 case OperatorInfo::Del: {
5228 Node *Ex = getDerived().parseExpr();
5231 return make<DeleteExpr>(Ex, Global, Op->getFlag(),
5232 Op->getPrecedence());
5234 case OperatorInfo::Call: {
5236 Node *Callee = getDerived().parseExpr();
5237 if (Callee ==
nullptr)
5239 size_t ExprsBegin = Names.
size();
5240 while (!consumeIf(
'E')) {
5241 Node *
E = getDerived().parseExpr();
5246 return make<CallExpr>(Callee, popTrailingNodeArray(ExprsBegin),
5247 Op->getFlag(), Op->getPrecedence());
5249 case OperatorInfo::CCast: {
5254 Ty = getDerived().parseType();
5259 size_t ExprsBegin = Names.
size();
5260 bool IsMany = consumeIf(
'_');
5261 while (!consumeIf(
'E')) {
5262 Node *
E = getDerived().parseExpr();
5269 NodeArray Exprs = popTrailingNodeArray(ExprsBegin);
5270 if (!IsMany && Exprs.
size() != 1)
5272 return make<ConversionExpr>(Ty, Exprs, Op->getPrecedence());
5274 case OperatorInfo::Conditional: {
5276 Node *
Cond = getDerived().parseExpr();
5277 if (
Cond ==
nullptr)
5279 Node *
LHS = getDerived().parseExpr();
5282 Node *
RHS = getDerived().parseExpr();
5285 return make<ConditionalExpr>(
Cond,
LHS,
RHS, Op->getPrecedence());
5287 case OperatorInfo::NamedCast: {
5289 Node *Ty = getDerived().parseType();
5292 Node *Ex = getDerived().parseExpr();
5295 return make<CastExpr>(
Sym, Ty, Ex, Op->getPrecedence());
5297 case OperatorInfo::OfIdOp: {
5300 Op->getFlag() ? getDerived().parseType() : getDerived().parseExpr();
5303 return make<EnclosingExpr>(
Sym, Arg, Op->getPrecedence());
5305 case OperatorInfo::NameOnly: {
5317 return getDerived().parseExprPrimary();
5319 return getDerived().parseTemplateParam();
5320 if (look() ==
'f') {
5322 if (look(1) ==
'p' || (look(1) ==
'L' && std::isdigit(look(2))))
5323 return getDerived().parseFunctionParam();
5324 return getDerived().parseFoldExpr();
5326 if (consumeIf(
"il")) {
5327 size_t InitsBegin = Names.
size();
5328 while (!consumeIf(
'E')) {
5329 Node *
E = getDerived().parseBracedExpr();
5334 return make<InitListExpr>(
nullptr, popTrailingNodeArray(InitsBegin));
5336 if (consumeIf(
"mc"))
5338 if (consumeIf(
"nx")) {
5339 Node *Ex = getDerived().parseExpr();
5344 if (look() ==
'r' && (look(1) ==
'q' || look(1) ==
'Q'))
5345 return parseRequiresExpr();
5346 if (consumeIf(
"so"))
5347 return parseSubobjectExpr();
5348 if (consumeIf(
"sp")) {
5349 Node *Child = getDerived().parseExpr();
5350 if (Child ==
nullptr)
5352 return make<ParameterPackExpansion>(Child);
5354 if (consumeIf(
"sZ")) {
5355 if (look() ==
'T') {
5356 Node *R = getDerived().parseTemplateParam();
5359 return make<SizeofParamPackExpr>(R);
5361 Node *
FP = getDerived().parseFunctionParam();
5364 return make<EnclosingExpr>(
"sizeof... ",
FP);
5366 if (consumeIf(
"sP")) {
5367 size_t ArgsBegin = Names.
size();
5368 while (!consumeIf(
'E')) {
5369 Node *Arg = getDerived().parseTemplateArg();
5374 auto *Pack = make<NodeArrayNode>(popTrailingNodeArray(ArgsBegin));
5377 return make<EnclosingExpr>(
"sizeof... ", Pack);
5379 if (consumeIf(
"tl")) {
5380 Node *Ty = getDerived().parseType();
5383 size_t InitsBegin = Names.
size();
5384 while (!consumeIf(
'E')) {
5385 Node *
E = getDerived().parseBracedExpr();
5390 return make<InitListExpr>(Ty, popTrailingNodeArray(InitsBegin));
5392 if (consumeIf(
"tr"))
5393 return make<NameType>(
"throw");
5394 if (consumeIf(
"tw")) {
5395 Node *Ex = getDerived().parseExpr();
5398 return make<ThrowExpr>(Ex);
5400 if (consumeIf(
'u')) {
5401 Node *
Name = getDerived().parseSourceName(
nullptr);
5409 bool IsUUID =
false;
5411 if (
Name->getBaseName() ==
"__uuidof") {
5412 if (consumeIf(
't')) {
5413 UUID = getDerived().parseType();
5415 }
else if (consumeIf(
'z')) {
5416 UUID = getDerived().parseExpr();
5420 size_t ExprsBegin = Names.
size();
5422 if (
UUID ==
nullptr)
5426 while (!consumeIf(
'E')) {
5427 Node *
E = getDerived().parseTemplateArg();
5433 return make<CallExpr>(
Name, popTrailingNodeArray(ExprsBegin),
5438 return getDerived().parseUnresolvedName(Global);
5449template <
typename Alloc,
typename Derived>
5454 return parseNumber(
true).empty() || !consumeIf(
'_');
5456 return parseNumber(
true).empty() || !consumeIf(
'_') ||
5457 parseNumber(
true).empty() || !consumeIf(
'_');
5482template <
typename Derived,
typename Alloc>
5492 Node *Arg = getDerived().parseTemplateArg();
5495 return make<SpecialName>(
"template parameter object for ", Arg);
5500 Node *Ty = getDerived().parseType();
5503 return make<SpecialName>(
"vtable for ", Ty);
5508 Node *Ty = getDerived().parseType();
5511 return make<SpecialName>(
"VTT for ", Ty);
5516 Node *Ty = getDerived().parseType();
5519 return make<SpecialName>(
"typeinfo for ", Ty);
5524 Node *Ty = getDerived().parseType();
5527 return make<SpecialName>(
"typeinfo name for ", Ty);
5532 if (parseCallOffset() || parseCallOffset())
5534 Node *Encoding = getDerived().parseEncoding();
5535 if (Encoding ==
nullptr)
5537 return make<SpecialName>(
"covariant return thunk to ", Encoding);
5543 Node *FirstType = getDerived().parseType();
5544 if (FirstType ==
nullptr)
5546 if (parseNumber(
true).empty() || !consumeIf(
'_'))
5548 Node *SecondType = getDerived().parseType();
5549 if (SecondType ==
nullptr)
5551 return make<CtorVtableSpecialName>(SecondType, FirstType);
5556 Node *
Name = getDerived().parseName();
5557 if (
Name ==
nullptr)
5559 return make<SpecialName>(
"thread-local wrapper routine for ",
Name);
5564 Node *
Name = getDerived().parseName();
5565 if (
Name ==
nullptr)
5567 return make<SpecialName>(
"thread-local initialization routine for ",
Name);
5572 bool IsVirt = look() ==
'v';
5573 if (parseCallOffset())
5575 Node *BaseEncoding = getDerived().parseEncoding();
5576 if (BaseEncoding ==
nullptr)
5579 return make<SpecialName>(
"virtual thunk to ", BaseEncoding);
5581 return make<SpecialName>(
"non-virtual thunk to ", BaseEncoding);
5589 Node *
Name = getDerived().parseName();
5590 if (
Name ==
nullptr)
5592 return make<SpecialName>(
"guard variable for ",
Name);
5599 Node *
Name = getDerived().parseName();
5600 if (
Name ==
nullptr)
5603 bool ParsedSeqId = !parseSeqId(&Count);
5604 if (!consumeIf(
'_') && ParsedSeqId)
5606 return make<SpecialName>(
"reference temporary for ",
Name);
5612 if (getDerived().parseModuleNameOpt(
Module))
5616 return make<SpecialName>(
"initializer for module ",
Module);
5627template <
typename Derived,
typename Alloc>
5633 if (look() ==
'G' || look() ==
'T')
5634 return getDerived().parseSpecialName();
5636 auto IsEndOfEncoding = [&] {
5640 return numLeft() == 0 || look() ==
'E' || look() ==
'.' || look() ==
'_';
5644 Node *
Name = getDerived().parseName(&NameInfo);
5645 if (
Name ==
nullptr)
5648 if (resolveForwardTemplateRefs(NameInfo))
5651 if (IsEndOfEncoding())
5664 Node *Attrs =
nullptr;
5665 if (consumeIf(
"Ua9enable_ifI")) {
5666 size_t BeforeArgs = Names.
size();
5667 while (!consumeIf(
'E')) {
5668 Node *Arg = getDerived().parseTemplateArg();
5673 Attrs = make<EnableIfAttr>(popTrailingNodeArray(BeforeArgs));
5678 Node *ReturnType =
nullptr;
5680 ReturnType = getDerived().parseType();
5681 if (ReturnType ==
nullptr)
5686 if (!consumeIf(
'v')) {
5687 size_t ParamsBegin = Names.
size();
5689 Node *Ty = getDerived().parseType();
5693 const bool IsFirstParam = ParamsBegin == Names.
size();
5695 Ty = make<ExplicitObjectParameter>(Ty);
5701 }
while (!IsEndOfEncoding() && look() !=
'Q');
5702 Params = popTrailingNodeArray(ParamsBegin);
5705 Node *Requires =
nullptr;
5706 if (consumeIf(
'Q')) {
5707 Requires = getDerived().parseConstraintExpr();
5712 return make<FunctionEncoding>(ReturnType,
Name, Params, Attrs, Requires,
5717template <
class Float>
5723 static const size_t mangled_size = 8;
5724 static const size_t max_demangled_size = 24;
5725 static constexpr const char* spec =
"%af";
5731 static const size_t mangled_size = 16;
5732 static const size_t max_demangled_size = 32;
5733 static constexpr const char* spec =
"%a";
5739#if defined(__mips__) && defined(__mips_n64) || defined(__aarch64__) || \
5740 defined(__wasm__) || defined(__riscv) || defined(__loongarch__) || \
5742 static const size_t mangled_size = 32;
5743#elif defined(__arm__) || defined(__mips__) || defined(__hexagon__)
5744 static const size_t mangled_size = 16;
5746 static const size_t mangled_size = 20;
5753 static const size_t max_demangled_size = 42;
5754 static constexpr const char *spec =
"%LaL";
5757template <
typename Alloc,
typename Derived>
5758template <
class Float>
5763 std::string_view Data(First,
N);
5765 if (!(
C >=
'0' &&
C <=
'9') && !(
C >=
'a' &&
C <=
'f'))
5768 if (!consumeIf(
'E'))
5770 return make<FloatLiteralImpl<Float>>(Data);
5774template <
typename Alloc,
typename Derived>
5776 if (!(look() >=
'0' && look() <=
'9') &&
5777 !(look() >=
'A' && look() <=
'Z'))
5782 if (look() >=
'0' && look() <=
'9') {
5784 Id +=
static_cast<size_t>(look() -
'0');
5785 }
else if (look() >=
'A' && look() <=
'Z') {
5787 Id +=
static_cast<size_t>(look() -
'A') + 10;
5807template <
typename Derived,
typename Alloc>
5809 if (!consumeIf(
'S'))
5812 if (look() >=
'a' && look() <=
'z') {
5837 auto *SpecialSub = make<SpecialSubstitution>(Kind);
5844 Node *WithTags = getDerived().parseAbiTags(SpecialSub);
5845 if (WithTags != SpecialSub) {
5847 SpecialSub = WithTags;
5853 if (consumeIf(
'_')) {
5861 if (parseSeqId(&
Index))
5864 if (!consumeIf(
'_') ||
Index >= Subs.
size())
5873template <
typename Derived,
typename Alloc>
5875 const char *Begin = First;
5876 if (!consumeIf(
'T'))
5880 if (consumeIf(
'L')) {
5881 if (parsePositiveInteger(&Level))
5884 if (!consumeIf(
'_'))
5889 if (!consumeIf(
'_')) {
5890 if (parsePositiveInteger(&
Index))
5893 if (!consumeIf(
'_'))
5901 if (HasIncompleteTemplateParameterTracking) {
5902 return make<NameType>(std::string_view(Begin, First - 1 - Begin));
5909 if (PermitForwardTemplateReferences && Level == 0) {
5910 Node *ForwardRef = make<ForwardTemplateReference>(
Index);
5920 if (Level >= TemplateParams.
size() || !TemplateParams[Level] ||
5921 Index >= TemplateParams[Level]->
size()) {
5924 if (ParsingLambdaParamsAtLevel == Level && Level <= TemplateParams.
size()) {
5927 if (Level == TemplateParams.
size())
5929 return make<NameType>(
"auto");
5935 return (*TemplateParams[Level])[
Index];
5943template <
typename Derived,
typename Alloc>
5947 unsigned Index = NumSyntheticTemplateParameters[(int)Kind]++;
5948 Node *
N = make<SyntheticTemplateParamName>(Kind,
Index);
5954 if (consumeIf(
"Ty")) {
5958 return make<TypeTemplateParamDecl>(
Name);
5961 if (consumeIf(
"Tk")) {
5967 HasIncompleteTemplateParameterTracking,
true);
5968 Node *Constraint = getDerived().parseName();
5974 return make<ConstrainedTypeTemplateParamDecl>(Constraint,
Name);
5977 if (consumeIf(
"Tn")) {
5984 return make<NonTypeTemplateParamDecl>(
Name,
Type);
5987 if (consumeIf(
"Tt")) {
5991 size_t ParamsBegin = Names.
size();
5993 Node *Requires =
nullptr;
5994 while (!consumeIf(
'E')) {
5995 Node *
P = parseTemplateParamDecl(TemplateTemplateParamParams.
params());
5999 if (consumeIf(
'Q')) {
6000 Requires = getDerived().parseConstraintExpr();
6001 if (Requires ==
nullptr || !consumeIf(
'E'))
6006 NodeArray InnerParams = popTrailingNodeArray(ParamsBegin);
6007 return make<TemplateTemplateParamDecl>(
Name, InnerParams, Requires);
6010 if (consumeIf(
"Tp")) {
6011 Node *
P = parseTemplateParamDecl(Params);
6014 return make<TemplateParamPackDecl>(
P);
6026template <
typename Derived,
typename Alloc>
6031 Node *Arg = getDerived().parseExpr();
6032 if (Arg ==
nullptr || !consumeIf(
'E'))
6038 size_t ArgsBegin = Names.
size();
6039 while (!consumeIf(
'E')) {
6040 Node *Arg = getDerived().parseTemplateArg();
6045 NodeArray Args = popTrailingNodeArray(ArgsBegin);
6046 return make<TemplateArgumentPack>(Args);
6050 if (look(1) ==
'Z') {
6052 Node *Arg = getDerived().parseEncoding();
6053 if (Arg ==
nullptr || !consumeIf(
'E'))
6058 return getDerived().parseExprPrimary();
6062 if (!getDerived().isTemplateParamDecl())
6063 return getDerived().parseType();
6064 Node *Param = getDerived().parseTemplateParamDecl(
nullptr);
6067 Node *Arg = getDerived().parseTemplateArg();
6070 return make<TemplateParamQualifiedArg>(Param, Arg);
6073 return getDerived().parseType();
6079template <
typename Derived,
typename Alloc>
6082 if (!consumeIf(
'I'))
6088 TemplateParams.
clear();
6089 TemplateParams.
push_back(&OuterTemplateParams);
6090 OuterTemplateParams.
clear();
6093 size_t ArgsBegin = Names.
size();
6094 Node *Requires =
nullptr;
6095 while (!consumeIf(
'E')) {
6097 Node *Arg = getDerived().parseTemplateArg();
6102 if (Arg->
getKind() == Node::KTemplateParamQualifiedArg) {
6106 if (Arg->
getKind() == Node::KTemplateArgumentPack) {
6114 Node *Arg = getDerived().parseTemplateArg();
6119 if (consumeIf(
'Q')) {
6120 Requires = getDerived().parseConstraintExpr();
6121 if (!Requires || !consumeIf(
'E'))
6126 return make<TemplateArgs>(popTrailingNodeArray(ArgsBegin), Requires);
6134template <
typename Derived,
typename Alloc>
6136 if (consumeIf(
"_Z") || consumeIf(
"__Z")) {
6137 Node *Encoding = getDerived().parseEncoding(ParseParams);
6138 if (Encoding ==
nullptr)
6140 if (look() ==
'.') {
6142 make<DotSuffix>(Encoding, std::string_view(First, Last - First));
6150 if (consumeIf(
"___Z") || consumeIf(
"____Z")) {
6151 Node *Encoding = getDerived().parseEncoding(ParseParams);
6152 if (Encoding ==
nullptr || !consumeIf(
"_block_invoke"))
6154 bool RequireNumber = consumeIf(
'_');
6155 if (parseNumber().empty() && RequireNumber)
6161 return make<SpecialName>(
"invocation function for block in ", Encoding);
6164 Node *Ty = getDerived().parseType();
6170template <
typename Alloc>
6178#if defined(__clang__)
6179#pragma clang diagnostic pop
BlockVerifier::State From
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
Given that RA is a live value
#define DEMANGLE_DUMP_METHOD
#define DEMANGLE_FALLTHROUGH
#define DEMANGLE_NAMESPACE_END
#define DEMANGLE_ASSERT(__expr, __msg)
#define DEMANGLE_NAMESPACE_BEGIN
#define DEMANGLE_UNREACHABLE
std::optional< std::vector< StOtherPiece > > Other
Qualifiers operator|=(Qualifiers &Q1, Qualifiers Q2)
const char * parse_discriminator(const char *first, const char *last)
Machine Check Debug Module
static StringRef getName(Value *V)
const SmallVectorImpl< MachineOperand > & Cond
std::pair< llvm::MachO::Target, std::string > UUID
static bool consume(InternalInstruction *insn, T &ptr)
SaveTemplateParams(AbstractManglingParser *TheParser)
TemplateParamList * params()
~ScopedTemplateParamList()
ScopedTemplateParamList(AbstractManglingParser *TheParser)
void printLeft(OutputBuffer &OB) const override
ArraySubscriptExpr(const Node *Op1_, const Node *Op2_, Prec Prec_)
void printRight(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
bool printInitListAsType(OutputBuffer &OB, const NodeArray &Elements) const override
bool hasArraySlow(OutputBuffer &) const override
ArrayType(const Node *Base_, Node *Dimension_)
bool hasRHSComponentSlow(OutputBuffer &) const override
BinaryExpr(const Node *LHS_, std::string_view InfixOperator_, const Node *RHS_, Prec Prec_)
void printLeft(OutputBuffer &OB) const override
BinaryFPType(const Node *Dimension_)
void printLeft(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
BitIntType(const Node *Size_, bool Signed_)
void printLeft(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
BracedExpr(const Node *Elem_, const Node *Init_, bool IsArray_)
void printLeft(OutputBuffer &OB) const override
BracedRangeExpr(const Node *First_, const Node *Last_, const Node *Init_)
void printLeft(OutputBuffer &OB) const override
CallExpr(const Node *Callee_, NodeArray Args_, bool IsParen_, Prec Prec_)
CastExpr(std::string_view CastKind_, const Node *To_, const Node *From_, Prec Prec_)
void printLeft(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
void printDeclarator(OutputBuffer &OB) const
ClosureTypeName(NodeArray TemplateParams_, const Node *Requires1_, NodeArray Params_, const Node *Requires2_, std::string_view Count_)
void printLeft(OutputBuffer &OB) const override
ConditionalExpr(const Node *Cond_, const Node *Then_, const Node *Else_, Prec Prec_)
A constrained template type parameter declaration, 'C T'.
ConstrainedTypeTemplateParamDecl(Node *Constraint_, Node *Name_)
void printRight(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
ConversionExpr(const Node *Type_, NodeArray Expressions_, Prec Prec_)
void printLeft(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
ConversionOperatorType(const Node *Ty_)
CtorDtorName(const Node *Basename_, bool IsDtor_, int Variant_)
void printLeft(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
CtorVtableSpecialName(const Node *FirstType_, const Node *SecondType_)
void printLeft(OutputBuffer &OB) const override
DeleteExpr(Node *Op_, bool IsGlobal_, bool IsArray_, Prec Prec_)
DotSuffix(const Node *Prefix_, std::string_view Suffix_)
void printLeft(OutputBuffer &OB) const override
DtorName(const Node *Base_)
void printLeft(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
DynamicExceptionSpec(NodeArray Types_)
ElaboratedTypeSpefType(std::string_view Kind_, Node *Child_)
void printLeft(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
EnableIfAttr(NodeArray Conditions_)
void printLeft(OutputBuffer &OB) const override
EnclosingExpr(std::string_view Prefix_, const Node *Infix_, Prec Prec_=Prec::Primary)
void printLeft(OutputBuffer &OB) const override
EnumLiteral(const Node *Ty_, std::string_view Integer_)
std::string_view getBaseName() const override
bool isInstantiation() const
ExpandedSpecialSubstitution(SpecialSubKind SSK_)
ExpandedSpecialSubstitution(SpecialSubKind SSK_, Kind K_)
Represents the explicitly named object parameter.
ExplicitObjectParameter(Node *Base_)
void printLeft(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
ExprRequirement(const Node *Expr_, bool IsNoexcept_, const Node *TypeConstraint_)
void printLeft(OutputBuffer &OB) const override
FloatLiteralImpl(std::string_view Contents_)
void printLeft(OutputBuffer &OB) const override
FoldExpr(bool IsLeftFold_, std::string_view OperatorName_, const Node *Pack_, const Node *Init_)
void printRight(OutputBuffer &OB) const override
Qualifiers getCVQuals() const
FunctionRefQual getRefQual() const
const Node * getReturnType() const
bool hasRHSComponentSlow(OutputBuffer &) const override
void printLeft(OutputBuffer &OB) const override
const Node * getName() const
bool hasFunctionSlow(OutputBuffer &) const override
FunctionEncoding(const Node *Ret_, const Node *Name_, NodeArray Params_, const Node *Attrs_, const Node *Requires_, Qualifiers CVQuals_, FunctionRefQual RefQual_)
NodeArray getParams() const
void printLeft(OutputBuffer &OB) const override
FunctionParam(std::string_view Number_)
void printLeft(OutputBuffer &OB) const override
FunctionType(const Node *Ret_, NodeArray Params_, Qualifiers CVQuals_, FunctionRefQual RefQual_, const Node *ExceptionSpec_)
bool hasRHSComponentSlow(OutputBuffer &) const override
void printRight(OutputBuffer &OB) const override
bool hasFunctionSlow(OutputBuffer &) const override
GlobalQualifiedName(Node *Child_)
std::string_view getBaseName() const override
void printLeft(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
InitListExpr(const Node *Ty_, NodeArray Inits_)
std::string_view value() const
IntegerLiteral(std::string_view Type_, std::string_view Value_)
void printLeft(OutputBuffer &OB) const override
LambdaExpr(const Node *Type_)
void printLeft(OutputBuffer &OB) const override
LiteralOperator(const Node *OpName_)
void printLeft(OutputBuffer &OB) const override
MemberExpr(const Node *LHS_, std::string_view Kind_, const Node *RHS_, Prec Prec_)
void printLeft(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
NameType(std::string_view Name_)
std::string_view getBaseName() const override
std::string_view getName() const
void printLeft(OutputBuffer &OB) const override
NestedRequirement(const Node *Constraint_)
NewExpr(NodeArray ExprList_, Node *Type_, NodeArray InitList_, bool IsGlobal_, bool IsArray_, Prec Prec_)
void printLeft(OutputBuffer &OB) const override
NodeArray(Node **Elements_, size_t NumElements_)
void printWithComma(OutputBuffer &OB) const
bool printAsString(OutputBuffer &OB) const
Node * operator[](size_t Idx) const
void print(OutputBuffer &OB) const
Prec getPrecedence() const
virtual void printLeft(OutputBuffer &) const =0
virtual bool printInitListAsType(OutputBuffer &, const NodeArray &) const
void visit(Fn F) const
Visit the most-derived object corresponding to this object.
void printAsOperand(OutputBuffer &OB, Prec P=Prec::Default, bool StrictlyWorse=false) const
Node(Kind K_, Cache RHSComponentCache_, Cache ArrayCache_=Cache::No, Cache FunctionCache_=Cache::No)
bool hasRHSComponent(OutputBuffer &OB) const
DEMANGLE_DUMP_METHOD void dump() const
bool hasFunction(OutputBuffer &OB) const
Node(Kind K_, Prec Precedence_=Prec::Primary, Cache RHSComponentCache_=Cache::No, Cache ArrayCache_=Cache::No, Cache FunctionCache_=Cache::No)
Cache getRHSComponentCache() const
bool hasArray(OutputBuffer &OB) const
Cache getArrayCache() const
virtual bool hasRHSComponentSlow(OutputBuffer &) const
Cache ArrayCache
Track if this node is a (possibly qualified) array type.
virtual bool hasArraySlow(OutputBuffer &) const
Prec
Operator precedence for expression nodes.
virtual std::string_view getBaseName() const
virtual const Node * getSyntaxNode(OutputBuffer &) const
virtual bool hasFunctionSlow(OutputBuffer &) const
Cache getFunctionCache() const
virtual void printRight(OutputBuffer &) const
Cache RHSComponentCache
Tracks if this node has a component on its right side, in which case we need to call printRight.
Cache
Three-way bool to track a cached value.
Cache FunctionCache
Track if this node is a (possibly qualified) function type.
NoexceptSpec(const Node *E_)
void printLeft(OutputBuffer &OB) const override
A non-type template parameter declaration, 'int N'.
void printRight(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
NonTypeTemplateParamDecl(Node *Name_, Node *Type_)
bool isObjCObject() const
ObjCProtoName(const Node *Ty_, std::string_view Protocol_)
void printLeft(OutputBuffer &OB) const override
PODSmallVector & operator=(PODSmallVector &&Other)
PODSmallVector(const PODSmallVector &)=delete
void push_back(const T &Elem)
PODSmallVector & operator=(const PODSmallVector &)=delete
PODSmallVector(PODSmallVector &&Other)
void shrinkToSize(size_t Index)
T & operator[](size_t Index)
const Node * getChild() const
ParameterPackExpansion(const Node *Child_)
void printLeft(OutputBuffer &OB) const override
An unexpanded parameter pack (either in the expression or type context).
ParameterPack(NodeArray Data_)
void printRight(OutputBuffer &OB) const override
bool hasArraySlow(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
const Node * getSyntaxNode(OutputBuffer &OB) const override
bool hasFunctionSlow(OutputBuffer &OB) const override
bool hasRHSComponentSlow(OutputBuffer &OB) const override
PixelVectorType(const Node *Dimension_)
void printLeft(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
PointerToMemberConversionExpr(const Node *Type_, const Node *SubExpr_, std::string_view Offset_, Prec Prec_)
void printRight(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
bool hasRHSComponentSlow(OutputBuffer &OB) const override
PointerToMemberType(const Node *ClassType_, const Node *MemberType_)
bool hasRHSComponentSlow(OutputBuffer &OB) const override
PointerType(const Node *Pointee_)
const Node * getPointee() const
void printRight(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
PostfixExpr(const Node *Child_, std::string_view Operator_, Prec Prec_)
void printLeft(OutputBuffer &OB) const override
PostfixQualifiedType(const Node *Ty_, std::string_view Postfix_)
void printLeft(OutputBuffer &OB) const override
PrefixExpr(std::string_view Prefix_, Node *Child_, Prec Prec_)
void printLeft(OutputBuffer &OB) const override
bool hasFunctionSlow(OutputBuffer &OB) const override
QualType(const Node *Child_, Qualifiers Quals_)
void printLeft(OutputBuffer &OB) const override
void printQuals(OutputBuffer &OB) const
Qualifiers getQuals() const
void printRight(OutputBuffer &OB) const override
const Node * getChild() const
bool hasRHSComponentSlow(OutputBuffer &OB) const override
bool hasArraySlow(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
std::string_view getBaseName() const override
QualifiedName(const Node *Qualifier_, const Node *Name_)
void printLeft(OutputBuffer &OB) const override
bool hasRHSComponentSlow(OutputBuffer &OB) const override
ReferenceType(const Node *Pointee_, ReferenceKind RK_)
void printRight(OutputBuffer &OB) const override
RequiresExpr(NodeArray Parameters_, NodeArray Requirements_)
void printLeft(OutputBuffer &OB) const override
SizeofParamPackExpr(const Node *Pack_)
void printLeft(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
SpecialName(std::string_view Special_, const Node *Child_)
std::string_view getBaseName() const override
SpecialSubstitution(SpecialSubKind SSK_)
void printLeft(OutputBuffer &OB) const override
StringLiteral(const Node *Type_)
void printLeft(OutputBuffer &OB) const override
StructuredBindingName(NodeArray Bindings_)
void printLeft(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
SubobjectExpr(const Node *Type_, const Node *SubExpr_, std::string_view Offset_, NodeArray UnionSelectors_, bool OnePastTheEnd_)
An invented name for a template parameter for which we don't have a corresponding template argument.
void printLeft(OutputBuffer &OB) const override
SyntheticTemplateParamName(TemplateParamKind Kind_, unsigned Index_)
TemplateArgs(NodeArray Params_, Node *Requires_)
void printLeft(OutputBuffer &OB) const override
A variadic template argument.
void printLeft(OutputBuffer &OB) const override
TemplateArgumentPack(NodeArray Elements_)
NodeArray getElements() const
A template parameter pack declaration, 'typename ...T'.
void printRight(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
TemplateParamPackDecl(Node *Param_)
TemplateParamQualifiedArg(Node *Param_, Node *Arg_)
void printLeft(OutputBuffer &OB) const override
A template template parameter declaration, 'template<typename T> typename N'.
void printLeft(OutputBuffer &OB) const override
TemplateTemplateParamDecl(Node *Name_, NodeArray Params_, Node *Requires_)
void printRight(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
ThrowExpr(const Node *Op_)
TypeRequirement(const Node *Type_)
void printLeft(OutputBuffer &OB) const override
A template type parameter declaration, 'typename T'.
void printLeft(OutputBuffer &OB) const override
TypeTemplateParamDecl(Node *Name_)
void printRight(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
UnnamedTypeName(std::string_view Count_)
VectorType(const Node *BaseType_, const Node *Dimension_)
const Node * getDimension() const
void printLeft(OutputBuffer &OB) const override
const Node * getBaseType() const
VendorExtQualType(const Node *Ty_, std::string_view Ext_, const Node *TA_)
void printLeft(OutputBuffer &OB) const override
std::string_view getExt() const
const Node * getTA() const
const Node * getTy() const
constexpr Node::Kind getFloatLiteralKind(float *)
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
void printLeft(OutputBuffer &OB) const override
AbiTagAttr(Node *Base_, std::string_view Tag_)
std::string_view getBaseName() const override
Holds some extra information about a <name> that is being parsed.
bool HasExplicitObjectParameter
bool EndsWithTemplateArgs
NameState(AbstractManglingParser *Enclosing)
size_t ForwardTemplateRefsBegin
FunctionRefQual ReferenceQualifier
constexpr OperatorInfo(const char(&E)[3], OIKind K, bool F, Node::Prec P, const char *N)
Node::Prec getPrecedence() const
bool operator<(const OperatorInfo &Other) const
std::string_view getName() const
bool operator==(const char *Peek) const
bool operator!=(const char *Peek) const
bool operator<(const char *Peek) const
std::string_view getSymbol() const
bool parseModuleNameOpt(ModuleName *&Module)
Node * parseSubstitution()
PODSmallVector< Node *, 32 > Subs
Node * parseFloatingLiteral()
void reset(const char *First_, const char *Last_)
Node * parseClassEnumType()
Node * parseBaseUnresolvedName()
bool HasIncompleteTemplateParameterTracking
Node * parseSubobjectExpr()
PODSmallVector< ForwardTemplateReference *, 4 > ForwardTemplateRefs
Node * parseConversionExpr()
PODSmallVector< Node *, 32 > Names
Node * parseConstraintExpr()
bool isTemplateParamDecl()
Node * parseTemplateArgs(bool TagTemplates=false)
Node * parseSpecialName()
Node * parseTemplateParam()
Node * parseType()
Parse the <type> production.
Node * parseTemplateParamDecl(TemplateParamList *Params)
Qualifiers parseCVQualifiers()
Node * parsePrefixExpr(std::string_view Kind, Node::Prec Prec)
bool PermitForwardTemplateReferences
Node * parseUnresolvedName(bool Global)
Parse the <unresolved-name> production.
Node * parsePointerToMemberConversionExpr(Node::Prec Prec)
Node * parsePointerToMemberType()
bool resolveForwardTemplateRefs(NameState &State)
Node * parseIntegerLiteral(std::string_view Lit)
Node * make(Args &&... args)
bool parseSeqId(size_t *Out)
Node * parseEncoding(bool ParseParams=true)
Node * parseName(NameState *State=nullptr)
Parse the <name> production>
Node * parseBinaryExpr(std::string_view Kind, Node::Prec Prec)
std::string_view parseNumber(bool AllowNegative=false)
TemplateParamList OuterTemplateParams
Node * parse(bool ParseParams=true)
Top-level entry point into the parser.
Node * parseFunctionType()
Node * parseDestructorName()
NodeArray makeNodeArray(It begin, It end)
Node * parseLocalName(NameState *State)
AbstractManglingParser(const char *First_, const char *Last_)
Node * parseRequiresExpr()
char look(unsigned Lookahead=0) const
bool parsePositiveInteger(size_t *Out)
Node * parseExprPrimary()
Node * parseQualifiedType()
Node * parseCtorDtorName(Node *&SoFar, NameState *State)
Node * parseExpr()
Parse the <expression> production.
Node * parseAbiTags(Node *N)
static const OperatorInfo Ops[]
Node * parseNestedName(NameState *State)
unsigned NumSyntheticTemplateParameters[3]
Node * parseSourceName(NameState *State)
Node * parseUnscopedName(NameState *State, bool *isSubstName)
size_t ParsingLambdaParamsAtLevel
Node * parseTemplateArg()
bool TryToParseTemplateArgs
bool consumeIf(std::string_view S)
Node * parseUnqualifiedName(NameState *State, Node *Scope, ModuleName *Module)
std::string_view parseBareSourceName()
NodeArray popTrailingNodeArray(size_t FromPosition)
Node * parseFunctionParam()
PODSmallVector< TemplateParamList *, 4 > TemplateParams
const OperatorInfo * parseOperatorEncoding()
Node * parseUnresolvedType()
Node * parseOperatorName(NameState *State)
Node * parseUnnamedTypeName(NameState *State)
static const size_t NumOps
A forward-reference to a template argument that was not known at the point where the template paramet...
const Node * getSyntaxNode(OutputBuffer &OB) const override
bool hasRHSComponentSlow(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
bool hasFunctionSlow(OutputBuffer &OB) const override
bool hasArraySlow(OutputBuffer &OB) const override
void printRight(OutputBuffer &OB) const override
ForwardTemplateReference(size_t Index_)
void match(Fn F) const =delete
LocalName(Node *Encoding_, Node *Entity_)
void printLeft(OutputBuffer &OB) const override
std::string_view getBaseName() const override
MemberLikeFriendName(Node *Qual_, Node *Name_)
void printLeft(OutputBuffer &OB) const override
std::string_view getBaseName() const override
void printLeft(OutputBuffer &OB) const override
ModuleEntity(ModuleName *Module_, Node *Name_)
void printLeft(OutputBuffer &OB) const override
ModuleName(ModuleName *Parent_, Node *Name_, bool IsPartition_=false)
void printLeft(OutputBuffer &OB) const override
std::string_view getBaseName() const override
NameWithTemplateArgs(Node *Name_, Node *TemplateArgs_)
std::string_view getBaseName() const override
NestedName(Node *Qual_, Node *Name_)
void printLeft(OutputBuffer &OB) const override
void printLeft(OutputBuffer &OB) const override
NodeArrayNode(NodeArray Array_)
Determine the kind of a node from its type.