10 #ifndef LLVM_DEMANGLE_ITANIUMDEMANGLE_H 11 #define LLVM_DEMANGLE_ITANIUMDEMANGLE_H 29 #define FOR_EACH_NODE_KIND(X) \ 32 X(VendorExtQualType) \ 34 X(ConversionOperatorType) \ 35 X(PostfixQualifiedType) \ 36 X(ElaboratedTypeSpefType) \ 43 X(PointerToMemberType) \ 47 X(DynamicExceptionSpec) \ 51 X(CtorVtableSpecialName) \ 58 X(TemplateArgumentPack) \ 59 X(ParameterPackExpansion) \ 61 X(ForwardTemplateReference) \ 62 X(NameWithTemplateArgs) \ 63 X(GlobalQualifiedName) \ 65 X(ExpandedSpecialSubstitution) \ 66 X(SpecialSubstitution) \ 71 X(StructuredBindingName) \ 73 X(ArraySubscriptExpr) \ 79 X(SizeofParamPackExpr) \ 94 X(LongDoubleLiteral) \ 99 namespace itanium_demangle {
105 #define ENUMERATOR(NodeKind) K ## NodeKind, 134 : K(K_), RHSComponentCache(RHSComponentCache_), ArrayCache(ArrayCache_),
135 FunctionCache(FunctionCache_) {}
138 template<
typename Fn>
void visit(Fn
F)
const;
194 virtual ~Node() =
default;
208 : Elements(Elements_), NumElements(NumElements_) {}
210 bool empty()
const {
return NumElements == 0; }
211 size_t size()
const {
return NumElements; }
214 Node **
end()
const {
return Elements + NumElements; }
219 bool FirstElement =
true;
220 for (
size_t Idx = 0; Idx != NumElements; ++Idx) {
225 Elements[Idx]->
print(S);
234 FirstElement =
false;
243 template<
typename Fn>
void match(Fn
F)
const {
F(Array); }
256 :
Node(KDotSuffix), Prefix(Prefix_), Suffix(Suffix_) {}
258 template<
typename Fn>
void match(Fn
F)
const {
F(Prefix, Suffix); }
274 :
Node(KVendorExtQualType), Ty(Ty_), Ext(Ext_) {}
276 template<
typename Fn>
void match(Fn
F)
const {
F(Ty, Ext); }
320 Quals(Quals_), Child(Child_) {}
322 template<
typename Fn>
void match(Fn
F)
const {
F(Child, Quals); }
347 :
Node(KConversionOperatorType), Ty(Ty_) {}
349 template<
typename Fn>
void match(Fn
F)
const {
F(Ty); }
363 :
Node(KPostfixQualifiedType), Ty(Ty_), Postfix(Postfix_) {}
365 template<
typename Fn>
void match(Fn
F)
const {
F(Ty, Postfix); }
379 template<
typename Fn>
void match(Fn
F)
const {
F(Name); }
392 :
Node(KElaboratedTypeSpefType), Kind(Kind_), Child(Child_) {}
394 template<
typename Fn>
void match(Fn
F)
const {
F(Kind, Child); }
410 Base(Base_), Tag(Tag_) {}
412 template<
typename Fn>
void match(Fn
F)
const {
F(Base, Tag); }
426 :
Node(KEnableIfAttr), Conditions(Conditions_) {}
428 template<
typename Fn>
void match(Fn
F)
const {
F(Conditions); }
445 :
Node(KObjCProtoName), Ty(Ty_), Protocol(Protocol_) {}
447 template<
typename Fn>
void match(Fn
F)
const {
F(Ty, Protocol); }
450 return Ty->
getKind() == KNameType &&
470 template<
typename Fn>
void match(Fn
F)
const {
F(Pointee); }
473 return Pointee->hasRHSComponent(S);
478 if (Pointee->getKind() != KObjCProtoName ||
479 !
static_cast<const ObjCProtoName *
>(Pointee)->isObjCObject()) {
480 Pointee->printLeft(s);
481 if (Pointee->hasArray(s))
483 if (Pointee->hasArray(s) || Pointee->hasFunction(s))
487 const auto *objcProto =
static_cast<const ObjCProtoName *
>(Pointee);
489 s += objcProto->Protocol;
495 if (Pointee->getKind() != KObjCProtoName ||
496 !
static_cast<const ObjCProtoName *
>(Pointee)->isObjCObject()) {
497 if (Pointee->hasArray(s) || Pointee->hasFunction(s))
499 Pointee->printRight(s);
514 mutable bool Printing =
false;
519 std::pair<ReferenceKind, const Node *> collapse(
OutputStream &S)
const {
520 auto SoFar = std::make_pair(RK, Pointee);
523 if (SN->
getKind() != KReferenceType)
526 SoFar.second = RT->Pointee;
527 SoFar.first = std::min(SoFar.first, RT->RK);
535 Pointee(Pointee_), RK(RK_) {}
537 template<
typename Fn>
void match(Fn
F)
const {
F(Pointee, RK); }
547 std::pair<ReferenceKind, const Node *> Collapsed = collapse(s);
548 Collapsed.second->printLeft(s);
549 if (Collapsed.second->hasArray(s))
551 if (Collapsed.second->hasArray(s) || Collapsed.second->hasFunction(s))
560 std::pair<ReferenceKind, const Node *> Collapsed = collapse(s);
561 if (Collapsed.second->hasArray(s) || Collapsed.second->hasFunction(s))
563 Collapsed.second->printRight(s);
568 const Node *ClassType;
569 const Node *MemberType;
574 ClassType(ClassType_), MemberType(MemberType_) {}
576 template<
typename Fn>
void match(Fn
F)
const {
F(ClassType, MemberType); }
605 const char *FirstChar = Str.
begin();
606 const char *SecondChar = Str.
end();
607 if (SecondChar ==
nullptr) {
608 assert(FirstChar == SecondChar);
609 ++FirstChar, ++SecondChar;
611 First =
static_cast<const void *
>(FirstChar);
612 Second =
static_cast<const void *
>(SecondChar);
616 : First(static_cast<
const void *>(N)), Second(nullptr) {}
620 bool isNode()
const {
return First && !Second; }
621 bool isEmpty()
const {
return !First && !Second; }
625 return StringView(static_cast<const char *>(First),
626 static_cast<const char *>(Second));
631 return static_cast<const Node *
>(First);
644 Base(Base_), Dimension(Dimension_) {}
646 template<
typename Fn>
void match(Fn
F)
const {
F(Base, Dimension); }
659 else if (Dimension.
isNode())
671 const Node *ExceptionSpec;
676 :
Node(KFunctionType,
679 Ret(Ret_), Params(Params_), CVQuals(CVQuals_), RefQual(RefQual_),
680 ExceptionSpec(ExceptionSpec_) {}
682 template<
typename Fn>
void match(Fn
F)
const {
683 F(Ret, Params, CVQuals, RefQual, ExceptionSpec);
719 if (ExceptionSpec !=
nullptr) {
721 ExceptionSpec->
print(S);
731 template<
typename Fn>
void match(Fn
F)
const {
F(E); }
744 :
Node(KDynamicExceptionSpec), Types(Types_) {}
746 template<
typename Fn>
void match(Fn
F)
const {
F(Types); }
767 :
Node(KFunctionEncoding,
770 Ret(Ret_), Name(Name_), Params(Params_), Attrs(Attrs_),
771 CVQuals(CVQuals_), RefQual(RefQual_) {}
773 template<
typename Fn>
void match(Fn
F)
const {
774 F(Ret, Name, Params, Attrs, CVQuals, RefQual);
790 if (!Ret->hasRHSComponent(S))
815 if (Attrs !=
nullptr)
825 :
Node(KLiteralOperator), OpName(OpName_) {}
827 template<
typename Fn>
void match(Fn
F)
const {
F(OpName); }
830 S +=
"operator\"\" ";
841 :
Node(KSpecialName), Special(Special_), Child(Child_) {}
843 template<
typename Fn>
void match(Fn
F)
const {
F(Special, Child); }
852 const Node *FirstType;
853 const Node *SecondType;
857 :
Node(KCtorVtableSpecialName),
858 FirstType(FirstType_), SecondType(SecondType_) {}
860 template<
typename Fn>
void match(Fn
F)
const {
F(FirstType, SecondType); }
863 S +=
"construction vtable for ";
866 SecondType->
print(S);
875 :
Node(KNestedName), Qual(Qual_), Name(Name_) {}
877 template<
typename Fn>
void match(Fn
F)
const {
F(Qual, Name); }
893 :
Node(KLocalName), Encoding(Encoding_), Entity(Entity_) {}
895 template<
typename Fn>
void match(Fn
F)
const {
F(Encoding, Entity); }
906 const Node *Qualifier;
911 :
Node(KQualifiedName), Qualifier(Qualifier_), Name(Name_) {}
913 template<
typename Fn>
void match(Fn
F)
const {
F(Qualifier, Name); }
930 :
Node(KVectorType), BaseType(BaseType_),
931 Dimension(Dimension_) {}
933 template<
typename Fn>
void match(Fn
F)
const {
F(BaseType, Dimension); }
951 :
Node(KPixelVectorType), Dimension(Dimension_) {}
953 template<
typename Fn>
void match(Fn
F)
const {
F(Dimension); }
957 S +=
"pixel vector[";
958 S += Dimension.asString();
999 template<
typename Fn>
void match(Fn
F)
const {
F(Data); }
1002 initializePackExpansion(S);
1004 return Idx < Data.size() && Data[Idx]->hasRHSComponent(S);
1007 initializePackExpansion(S);
1009 return Idx < Data.size() && Data[Idx]->hasArray(S);
1012 initializePackExpansion(S);
1014 return Idx < Data.size() && Data[Idx]->hasFunction(S);
1017 initializePackExpansion(S);
1019 return Idx < Data.size() ? Data[Idx]->getSyntaxNode(S) :
this;
1023 initializePackExpansion(S);
1025 if (Idx < Data.size())
1029 initializePackExpansion(S);
1031 if (Idx < Data.size())
1045 :
Node(KTemplateArgumentPack), Elements(Elements_) {}
1047 template<
typename Fn>
void match(Fn
F)
const {
F(Elements); }
1052 Elements.printWithComma(S);
1063 :
Node(KParameterPackExpansion), Child(Child_) {}
1065 template<
typename Fn>
void match(Fn
F)
const {
F(Child); }
1108 template<
typename Fn>
void match(Fn
F)
const {
F(Params); }
1114 Params.printWithComma(S);
1115 if (S.
back() ==
'>')
1147 mutable bool Printing =
false;
1157 template<
typename Fn>
void match(Fn
F)
const =
delete;
1204 :
Node(KNameWithTemplateArgs), Name(Name_), TemplateArgs(TemplateArgs_) {}
1206 template<
typename Fn>
void match(Fn
F)
const {
F(Name, TemplateArgs); }
1212 TemplateArgs->
print(S);
1221 :
Node(KGlobalQualifiedName), Child(Child_) {}
1223 template<
typename Fn>
void match(Fn
F)
const {
F(Child); }
1238 template<
typename Fn>
void match(Fn
F)
const {
F(Child); }
1262 :
Node(KExpandedSpecialSubstitution), SSK(SSK_) {}
1264 template<
typename Fn>
void match(Fn
F)
const {
F(SSK); }
1281 LLVM_BUILTIN_UNREACHABLE;
1287 S +=
"std::allocator";
1290 S +=
"std::basic_string";
1293 S +=
"std::basic_string<char, std::char_traits<char>, " 1294 "std::allocator<char> >";
1297 S +=
"std::basic_istream<char, std::char_traits<char> >";
1300 S +=
"std::basic_ostream<char, std::char_traits<char> >";
1303 S +=
"std::basic_iostream<char, std::char_traits<char> >";
1314 :
Node(KSpecialSubstitution), SSK(SSK_) {}
1316 template<
typename Fn>
void match(Fn
F)
const {
F(SSK); }
1333 LLVM_BUILTIN_UNREACHABLE;
1339 S +=
"std::allocator";
1342 S +=
"std::basic_string";
1348 S +=
"std::istream";
1351 S +=
"std::ostream";
1354 S +=
"std::iostream";
1361 const Node *Basename;
1367 :
Node(KCtorDtorName), Basename(Basename_), IsDtor(IsDtor_),
1368 Variant(Variant_) {}
1370 template<
typename Fn>
void match(Fn
F)
const {
F(Basename, IsDtor, Variant); }
1375 S += Basename->getBaseName();
1385 template<
typename Fn>
void match(Fn
F)
const {
F(Base); }
1399 template<
typename Fn>
void match(Fn
F)
const {
F(Count); }
1414 :
Node(KClosureTypeName), Params(Params_), Count(Count_) {}
1416 template<
typename Fn>
void match(Fn
F)
const {
F(Params, Count); }
1431 :
Node(KStructuredBindingName), Bindings(Bindings_) {}
1433 template<
typename Fn>
void match(Fn
F)
const {
F(Bindings); }
1451 :
Node(KBinaryExpr), LHS(LHS_), InfixOperator(InfixOperator_), RHS(RHS_) {
1454 template<
typename Fn>
void match(Fn
F)
const {
F(LHS, InfixOperator, RHS); }
1459 if (InfixOperator ==
">")
1470 if (InfixOperator ==
">")
1481 :
Node(KArraySubscriptExpr), Op1(Op1_), Op2(Op2_) {}
1483 template<
typename Fn>
void match(Fn
F)
const {
F(Op1, Op2); }
1500 :
Node(KPostfixExpr), Child(Child_), Operator(Operator_) {}
1502 template<
typename Fn>
void match(Fn
F)
const {
F(Child, Operator); }
1519 :
Node(KConditionalExpr), Cond(Cond_), Then(Then_), Else(Else_) {}
1521 template<
typename Fn>
void match(Fn
F)
const {
F(Cond, Then, Else); }
1541 :
Node(KMemberExpr), LHS(LHS_), Kind(Kind_), RHS(RHS_) {}
1543 template<
typename Fn>
void match(Fn
F)
const {
F(LHS, Kind, RHS); }
1559 :
Node(KEnclosingExpr), Prefix(Prefix_), Infix(Infix_),
1560 Postfix(Postfix_) {}
1562 template<
typename Fn>
void match(Fn
F)
const {
F(Prefix, Infix, Postfix); }
1579 :
Node(KCastExpr), CastKind(CastKind_), To(To_), From(From_) {}
1581 template<
typename Fn>
void match(Fn
F)
const {
F(CastKind, To, From); }
1598 :
Node(KSizeofParamPackExpr), Pack(Pack_) {}
1600 template<
typename Fn>
void match(Fn
F)
const {
F(Pack); }
1616 :
Node(KCallExpr), Callee(Callee_), Args(Args_) {}
1618 template<
typename Fn>
void match(Fn
F)
const {
F(Callee, Args); }
1638 :
Node(KNewExpr), ExprList(ExprList_), Type(Type_), InitList(InitList_),
1639 IsGlobal(IsGlobal_), IsArray(IsArray_) {}
1641 template<
typename Fn>
void match(Fn
F)
const {
1642 F(ExprList, Type, InitList, IsGlobal, IsArray);
1652 if (!ExprList.
empty()) {
1658 if (!InitList.
empty()) {
1674 :
Node(KDeleteExpr), Op(Op_), IsGlobal(IsGlobal_), IsArray(IsArray_) {}
1676 template<
typename Fn>
void match(Fn
F)
const {
F(Op, IsGlobal, IsArray); }
1694 :
Node(KPrefixExpr), Prefix(Prefix_), Child(Child_) {}
1696 template<
typename Fn>
void match(Fn
F)
const {
F(Prefix, Child); }
1712 template<
typename Fn>
void match(Fn
F)
const {
F(Number); }
1726 :
Node(KConversionExpr), Type(Type_), Expressions(Expressions_) {}
1728 template<
typename Fn>
void match(Fn
F)
const {
F(Type, Expressions); }
1744 :
Node(KInitListExpr), Ty(Ty_), Inits(Inits_) {}
1746 template<
typename Fn>
void match(Fn
F)
const {
F(Ty, Inits); }
1763 :
Node(KBracedExpr), Elem(Elem_), Init(Init_), IsArray(IsArray_) {}
1765 template<
typename Fn>
void match(Fn
F)
const {
F(Elem, Init, IsArray); }
1776 if (Init->
getKind() != KBracedExpr && Init->
getKind() != KBracedRangeExpr)
1788 :
Node(KBracedRangeExpr), First(First_), Last(Last_), Init(Init_) {}
1790 template<
typename Fn>
void match(Fn
F)
const {
F(First, Last, Init); }
1798 if (Init->
getKind() != KBracedExpr && Init->
getKind() != KBracedRangeExpr)
1812 :
Node(KFoldExpr), Pack(Pack_), Init(Init_), OperatorName(OperatorName_),
1813 IsLeftFold(IsLeftFold_) {}
1815 template<
typename Fn>
void match(Fn
F)
const {
1816 F(IsLeftFold, OperatorName, Pack, Init);
1820 auto PrintPack = [&] {
1830 if (Init !=
nullptr) {
1848 if (Init !=
nullptr) {
1865 template<
typename Fn>
void match(Fn
F)
const {
F(Op); }
1879 template<
typename Fn>
void match(Fn
F)
const {
F(Value); }
1882 S += Value ?
StringView(
"true") : StringView(
"false");
1893 :
Node(KIntegerCastExpr), Ty(Ty_), Integer(Integer_) {}
1895 template<
typename Fn>
void match(Fn
F)
const {
F(Ty, Integer); }
1911 :
Node(KIntegerLiteral), Type(Type_), Value(Value_) {}
1913 template<
typename Fn>
void match(Fn
F)
const {
F(Type, Value); }
1916 if (Type.
size() > 3) {
1922 if (Value[0] ==
'n') {
1928 if (Type.
size() <= 3)
1935 namespace float_literal_impl {
1937 return Node::KFloatLiteral;
1940 return Node::KDoubleLiteral;
1943 return Node::KLongDoubleLiteral;
1950 static constexpr
Kind KindForClass =
1955 :
Node(KindForClass), Contents(Contents_) {}
1957 template<
typename Fn>
void match(Fn
F)
const {
F(Contents); }
1961 const char *last = Contents.
end() + 1;
1964 if (static_cast<std::size_t>(last - first) > N) {
1968 char buf[
sizeof(Float)];
1970 const char *t =
first;
1972 for (; t != last; ++t, ++e) {
1973 unsigned d1 = isdigit(*t) ?
static_cast<unsigned>(*t -
'0')
1974 : static_cast<unsigned>(*t -
'a' + 10);
1976 unsigned d0 = isdigit(*t) ?
static_cast<unsigned>(*t -
'0')
1977 : static_cast<unsigned>(*t -
'a' + 10);
1978 *e =
static_cast<char>((d1 << 4) + d0);
1980 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 1996 template<
typename Fn>
1999 #define CASE(X) case K ## X: return F(static_cast<const X*>(this)); 2003 assert(0 &&
"unknown mangling node kind");
2008 #define SPECIALIZATION(X) \ 2009 template<> struct NodeKind<X> { \ 2010 static constexpr Node::Kind Kind = Node::K##X; \ 2011 static constexpr const char *name() { return #X; } \ 2014 #undef SPECIALIZATION 2016 #undef FOR_EACH_NODE_KIND 2018 template <
class T,
size_t N>
2020 static_assert(std::is_pod<T>::value,
2021 "T is required to be a plain old data type");
2028 bool isInline()
const {
return First == Inline; }
2030 void clearInline() {
2036 void reserve(
size_t NewCap) {
2039 auto* Tmp =
static_cast<T*
>(std::malloc(NewCap *
sizeof(
T)));
2045 First =
static_cast<T*
>(std::realloc(First, NewCap *
sizeof(
T)));
2046 if (First ==
nullptr)
2050 Cap = First + NewCap;
2060 if (
Other.isInline()) {
2062 Last = First +
Other.size();
2067 First =
Other.First;
2070 Other.clearInline();
2074 if (
Other.isInline()) {
2080 Last = First +
Other.size();
2086 First =
Other.First;
2089 Other.clearInline();
2102 reserve(
size() * 2);
2107 assert(Last != First &&
"Popping empty vector!");
2112 assert(Index <=
size() &&
"dropBack() can't expand!");
2113 Last = First +
Index;
2119 bool empty()
const {
return First == Last; }
2120 size_t size()
const {
return static_cast<size_t>(Last - First); }
2122 assert(Last != First &&
"Calling back() on empty vector!");
2160 bool TryToParseTemplateArgs =
true;
2161 bool PermitForwardTemplateReferences =
false;
2162 bool ParsingLambdaParams =
false;
2167 : First(First_), Last(Last_) {}
2171 void reset(
const char *First_,
const char *Last_) {
2176 TemplateParams.
clear();
2177 ParsingLambdaParams =
false;
2178 TryToParseTemplateArgs =
true;
2179 PermitForwardTemplateReferences =
false;
2180 ASTAllocator.reset();
2184 return ASTAllocator.template makeNode<T>(std::forward<Args>(args)...);
2188 size_t sz =
static_cast<size_t>(end -
begin);
2189 void *mem = ASTAllocator.allocateNodeArray(sz);
2190 Node **data =
new (mem)
Node *[sz];
2198 makeNodeArray(Names.
begin() + (long)FromPosition, Names.
end());
2212 if (First != Last && *First == C) {
2219 char consume() {
return First != Last ? *First++ :
'\0'; }
2221 char look(
unsigned Lookahead = 0) {
2222 if (static_cast<size_t>(Last - First) <= Lookahead)
2224 return First[Lookahead];
2227 size_t numLeft()
const {
return static_cast<size_t>(Last - First); }
2229 StringView parseNumber(
bool AllowNegative =
false);
2231 bool parsePositiveInteger(
size_t *Out);
2234 bool parseSeqId(
size_t *Out);
2235 Node *parseSubstitution();
2236 Node *parseTemplateParam();
2237 Node *parseTemplateArgs(
bool TagTemplates =
false);
2238 Node *parseTemplateArg();
2245 Node *parseExprPrimary();
2246 template <
class Float>
Node *parseFloatingLiteral();
2247 Node *parseFunctionParam();
2248 Node *parseNewExpr();
2249 Node *parseConversionExpr();
2250 Node *parseBracedExpr();
2251 Node *parseFoldExpr();
2255 Node *parseFunctionType();
2256 Node *parseVectorType();
2257 Node *parseDecltype();
2258 Node *parseArrayType();
2259 Node *parsePointerToMemberType();
2260 Node *parseClassEnumType();
2261 Node *parseQualifiedType();
2263 Node *parseEncoding();
2264 bool parseCallOffset();
2265 Node *parseSpecialName();
2270 bool CtorDtorConversion =
false;
2271 bool EndsWithTemplateArgs =
false;
2277 : ForwardTemplateRefsBegin(Enclosing->ForwardTemplateRefs.
size()) {}
2281 size_t I = State.ForwardTemplateRefsBegin;
2282 size_t E = ForwardTemplateRefs.
size();
2283 for (; I <
E; ++
I) {
2284 size_t Idx = ForwardTemplateRefs[
I]->Index;
2285 if (Idx >= TemplateParams.
size())
2287 ForwardTemplateRefs[
I]->Ref = TemplateParams[Idx];
2289 ForwardTemplateRefs.
dropBack(State.ForwardTemplateRefsBegin);
2294 Node *parseName(NameState *State =
nullptr);
2295 Node *parseLocalName(NameState *State);
2296 Node *parseOperatorName(NameState *State);
2297 Node *parseUnqualifiedName(NameState *State);
2298 Node *parseUnnamedTypeName(NameState *State);
2299 Node *parseSourceName(NameState *State);
2300 Node *parseUnscopedName(NameState *State);
2301 Node *parseNestedName(NameState *State);
2302 Node *parseCtorDtorName(
Node *&SoFar, NameState *State);
2307 Node *parseUnresolvedName();
2308 Node *parseSimpleId();
2309 Node *parseBaseUnresolvedName();
2310 Node *parseUnresolvedType();
2311 Node *parseDestructorName();
2326 template <
typename Derived,
typename Alloc>
2331 return getDerived().parseNestedName(State);
2333 return getDerived().parseLocalName(State);
2336 if (look() ==
'S' && look(1) !=
't') {
2337 Node *S = getDerived().parseSubstitution();
2342 Node *
TA = getDerived().parseTemplateArgs(State !=
nullptr);
2345 if (State) State->EndsWithTemplateArgs =
true;
2346 return make<NameWithTemplateArgs>(S,
TA);
2349 Node *
N = getDerived().parseUnscopedName(State);
2353 if (look() ==
'I') {
2355 Node *
TA = getDerived().parseTemplateArgs(State !=
nullptr);
2358 if (State) State->EndsWithTemplateArgs =
true;
2359 return make<NameWithTemplateArgs>(
N,
TA);
2368 template <
typename Derived,
typename Alloc>
2370 if (!consumeIf(
'Z'))
2372 Node *Encoding = getDerived().parseEncoding();
2373 if (Encoding ==
nullptr || !consumeIf(
'E'))
2376 if (consumeIf(
's')) {
2378 auto *StringLitName = make<NameType>(
"string literal");
2381 return make<LocalName>(Encoding, StringLitName);
2384 if (consumeIf(
'd')) {
2386 if (!consumeIf(
'_'))
2388 Node *
N = getDerived().parseName(State);
2391 return make<LocalName>(Encoding,
N);
2394 Node *Entity = getDerived().parseName(State);
2395 if (Entity ==
nullptr)
2398 return make<LocalName>(Encoding, Entity);
2404 template <
typename Derived,
typename Alloc>
2407 if (consumeIf(
"StL") || consumeIf(
"St")) {
2408 Node *R = getDerived().parseUnqualifiedName(State);
2411 return make<StdQualifiedName>(R);
2413 return getDerived().parseUnqualifiedName(State);
2421 template <
typename Derived,
typename Alloc>
2427 Result = getDerived().parseUnnamedTypeName(State);
2428 else if (look() >=
'1' && look() <=
'9')
2429 Result = getDerived().parseSourceName(State);
2430 else if (consumeIf(
"DC")) {
2431 size_t BindingsBegin = Names.size();
2433 Node *Binding = getDerived().parseSourceName(State);
2434 if (Binding ==
nullptr)
2436 Names.push_back(Binding);
2437 }
while (!consumeIf(
'E'));
2438 Result = make<StructuredBindingName>(popTrailingNodeArray(BindingsBegin));
2440 Result = getDerived().parseOperatorName(State);
2441 if (Result !=
nullptr)
2442 Result = getDerived().parseAbiTags(Result);
2452 template <
typename Derived,
typename Alloc>
2455 if (consumeIf(
"Ut")) {
2457 if (!consumeIf(
'_'))
2459 return make<UnnamedTypeName>(Count);
2461 if (consumeIf(
"Ul")) {
2464 if (!consumeIf(
"vE")) {
2465 size_t ParamsBegin = Names.size();
2467 Node *
P = getDerived().parseType();
2471 }
while (!consumeIf(
'E'));
2472 Params = popTrailingNodeArray(ParamsBegin);
2475 if (!consumeIf(
'_'))
2477 return make<ClosureTypeName>(Params, Count);
2483 template <
typename Derived,
typename Alloc>
2486 if (parsePositiveInteger(&Length))
2488 if (numLeft() < Length || Length == 0)
2493 return make<NameType>(
"(anonymous namespace)");
2494 return make<NameType>(
Name);
2548 template <
typename Derived,
typename Alloc>
2556 return make<NameType>(
"operator&&");
2560 return make<NameType>(
"operator&");
2563 return make<NameType>(
"operator&=");
2566 return make<NameType>(
"operator=");
2573 return make<NameType>(
"operator()");
2576 return make<NameType>(
"operator,");
2579 return make<NameType>(
"operator~");
2588 PermitForwardTemplateReferences ||
2590 Node *Ty = getDerived().parseType();
2593 if (State) State->CtorDtorConversion =
true;
2594 return make<ConversionOperatorType>(Ty);
2602 return make<NameType>(
"operator delete[]");
2605 return make<NameType>(
"operator*");
2608 return make<NameType>(
"operator delete");
2611 return make<NameType>(
"operator/");
2614 return make<NameType>(
"operator/=");
2621 return make<NameType>(
"operator^");
2624 return make<NameType>(
"operator^=");
2627 return make<NameType>(
"operator==");
2634 return make<NameType>(
"operator>=");
2637 return make<NameType>(
"operator>");
2641 if (look(1) ==
'x') {
2643 return make<NameType>(
"operator[]");
2650 return make<NameType>(
"operator<=");
2654 Node *SN = getDerived().parseSourceName(State);
2657 return make<LiteralOperator>(SN);
2661 return make<NameType>(
"operator<<");
2664 return make<NameType>(
"operator<<=");
2667 return make<NameType>(
"operator<");
2674 return make<NameType>(
"operator-");
2677 return make<NameType>(
"operator-=");
2680 return make<NameType>(
"operator*");
2683 return make<NameType>(
"operator*=");
2686 return make<NameType>(
"operator--");
2693 return make<NameType>(
"operator new[]");
2696 return make<NameType>(
"operator!=");
2699 return make<NameType>(
"operator-");
2702 return make<NameType>(
"operator!");
2705 return make<NameType>(
"operator new");
2712 return make<NameType>(
"operator||");
2715 return make<NameType>(
"operator|");
2718 return make<NameType>(
"operator|=");
2725 return make<NameType>(
"operator->*");
2728 return make<NameType>(
"operator+");
2731 return make<NameType>(
"operator+=");
2734 return make<NameType>(
"operator++");
2737 return make<NameType>(
"operator+");
2740 return make<NameType>(
"operator->");
2744 if (look(1) ==
'u') {
2746 return make<NameType>(
"operator?");
2753 return make<NameType>(
"operator%");
2756 return make<NameType>(
"operator%=");
2759 return make<NameType>(
"operator>>");
2762 return make<NameType>(
"operator>>=");
2766 if (look(1) ==
's') {
2768 return make<NameType>(
"operator<=>");
2773 if (std::isdigit(look(1))) {
2775 Node *SN = getDerived().parseSourceName(State);
2778 return make<ConversionOperatorType>(SN);
2793 template <
typename Derived,
typename Alloc>
2797 if (SoFar->
getKind() == Node::KSpecialSubstitution) {
2804 SoFar = make<ExpandedSpecialSubstitution>(SSK);
2813 if (consumeIf(
'C')) {
2814 bool IsInherited = consumeIf(
'I');
2815 if (look() !=
'1' && look() !=
'2' && look() !=
'3' && look() !=
'5')
2817 int Variant = look() -
'0';
2819 if (State) State->CtorDtorConversion =
true;
2821 if (getDerived().parseName(State) ==
nullptr)
2824 return make<CtorDtorName>(SoFar,
false, Variant);
2827 if (look() ==
'D' &&
2828 (look(1) ==
'0' || look(1) ==
'1' || look(1) ==
'2' || look(1) ==
'5')) {
2829 int Variant = look(1) -
'0';
2831 if (State) State->CtorDtorConversion =
true;
2832 return make<CtorDtorName>(SoFar,
true, Variant);
2855 template <
typename Derived,
typename Alloc>
2858 if (!consumeIf(
'N'))
2862 if (State) State->CVQualifiers = CVTmp;
2864 if (consumeIf(
'O')) {
2866 }
else if (consumeIf(
'R')) {
2871 Node *SoFar =
nullptr;
2872 auto PushComponent = [&](
Node *Comp) {
2873 if (!Comp)
return false;
2874 if (SoFar) SoFar = make<NestedName>(SoFar, Comp);
2876 if (State) State->EndsWithTemplateArgs =
false;
2877 return SoFar !=
nullptr;
2880 if (consumeIf(
"St")) {
2881 SoFar = make<NameType>(
"std");
2886 while (!consumeIf(
'E')) {
2890 if (consumeIf(
'M')) {
2891 if (SoFar ==
nullptr)
2897 if (look() ==
'T') {
2898 if (!PushComponent(getDerived().parseTemplateParam()))
2900 Subs.push_back(SoFar);
2905 if (look() ==
'I') {
2906 Node *
TA = getDerived().parseTemplateArgs(State !=
nullptr);
2907 if (TA ==
nullptr || SoFar ==
nullptr)
2909 SoFar = make<NameWithTemplateArgs>(SoFar,
TA);
2912 if (State) State->EndsWithTemplateArgs =
true;
2913 Subs.push_back(SoFar);
2918 if (look() ==
'D' && (look(1) ==
't' || look(1) ==
'T')) {
2919 if (!PushComponent(getDerived().parseDecltype()))
2921 Subs.push_back(SoFar);
2926 if (look() ==
'S' && look(1) !=
't') {
2927 Node *S = getDerived().parseSubstitution();
2928 if (!PushComponent(S))
2936 if (look() ==
'C' || (look() ==
'D' && look(1) !=
'C')) {
2937 if (SoFar ==
nullptr)
2939 if (!PushComponent(getDerived().parseCtorDtorName(SoFar, State)))
2941 SoFar = getDerived().parseAbiTags(SoFar);
2942 if (SoFar ==
nullptr)
2944 Subs.push_back(SoFar);
2949 if (!PushComponent(getDerived().parseUnqualifiedName(State)))
2951 Subs.push_back(SoFar);
2954 if (SoFar ==
nullptr || Subs.empty())
2962 template <
typename Derived,
typename Alloc>
2964 Node *SN = getDerived().parseSourceName(
nullptr);
2967 if (look() ==
'I') {
2968 Node *
TA = getDerived().parseTemplateArgs();
2971 return make<NameWithTemplateArgs>(SN,
TA);
2978 template <
typename Derived,
typename Alloc>
2981 if (std::isdigit(look()))
2982 Result = getDerived().parseSimpleId();
2984 Result = getDerived().parseUnresolvedType();
2985 if (Result ==
nullptr)
2987 return make<DtorName>(Result);
2993 template <
typename Derived,
typename Alloc>
2995 if (look() ==
'T') {
2996 Node *TP = getDerived().parseTemplateParam();
3002 if (look() ==
'D') {
3003 Node *DT = getDerived().parseDecltype();
3009 return getDerived().parseSubstitution();
3019 template <
typename Derived,
typename Alloc>
3021 if (std::isdigit(look()))
3022 return getDerived().parseSimpleId();
3024 if (consumeIf(
"dn"))
3025 return getDerived().parseDestructorName();
3029 Node *Oper = getDerived().parseOperatorName(
nullptr);
3030 if (Oper ==
nullptr)
3032 if (look() ==
'I') {
3033 Node *
TA = getDerived().parseTemplateArgs();
3036 return make<NameWithTemplateArgs>(Oper,
TA);
3052 template <
typename Derived,
typename Alloc>
3054 Node *SoFar =
nullptr;
3058 if (consumeIf(
"srN")) {
3059 SoFar = getDerived().parseUnresolvedType();
3060 if (SoFar ==
nullptr)
3063 if (look() ==
'I') {
3064 Node *
TA = getDerived().parseTemplateArgs();
3067 SoFar = make<NameWithTemplateArgs>(SoFar,
TA);
3072 while (!consumeIf(
'E')) {
3073 Node *Qual = getDerived().parseSimpleId();
3074 if (Qual ==
nullptr)
3076 SoFar = make<QualifiedName>(SoFar, Qual);
3081 Node *
Base = getDerived().parseBaseUnresolvedName();
3082 if (Base ==
nullptr)
3084 return make<QualifiedName>(SoFar, Base);
3087 bool Global = consumeIf(
"gs");
3090 if (!consumeIf(
"sr")) {
3091 SoFar = getDerived().parseBaseUnresolvedName();
3092 if (SoFar ==
nullptr)
3095 SoFar = make<GlobalQualifiedName>(SoFar);
3100 if (std::isdigit(look())) {
3102 Node *Qual = getDerived().parseSimpleId();
3103 if (Qual ==
nullptr)
3106 SoFar = make<QualifiedName>(SoFar, Qual);
3108 SoFar = make<GlobalQualifiedName>(Qual);
3113 }
while (!consumeIf(
'E'));
3118 SoFar = getDerived().parseUnresolvedType();
3119 if (SoFar ==
nullptr)
3122 if (look() ==
'I') {
3123 Node *
TA = getDerived().parseTemplateArgs();
3126 SoFar = make<NameWithTemplateArgs>(SoFar,
TA);
3132 assert(SoFar !=
nullptr);
3134 Node *
Base = getDerived().parseBaseUnresolvedName();
3135 if (Base ==
nullptr)
3137 return make<QualifiedName>(SoFar, Base);
3142 template <
typename Derived,
typename Alloc>
3144 while (consumeIf(
'B')) {
3148 N = make<AbiTagAttr>(
N, SN);
3156 template <
typename Alloc,
typename Derived>
3159 const char *Tmp = First;
3162 if (numLeft() == 0 || !std::isdigit(*First))
3164 while (numLeft() != 0 && std::isdigit(*First))
3170 template <
typename Alloc,
typename Derived>
3173 if (look() <
'0' || look() >
'9')
3175 while (look() >=
'0' && look() <=
'9') {
3177 *Out +=
static_cast<size_t>(consume() -
'0');
3182 template <
typename Alloc,
typename Derived>
3185 if (parsePositiveInteger(&Int) || numLeft() < Int)
3200 template <
typename Derived,
typename Alloc>
3204 Node *ExceptionSpec =
nullptr;
3205 if (consumeIf(
"Do")) {
3206 ExceptionSpec = make<NameType>(
"noexcept");
3209 }
else if (consumeIf(
"DO")) {
3210 Node *
E = getDerived().parseExpr();
3211 if (E ==
nullptr || !consumeIf(
'E'))
3213 ExceptionSpec = make<NoexceptSpec>(
E);
3216 }
else if (consumeIf(
"Dw")) {
3217 size_t SpecsBegin = Names.size();
3218 while (!consumeIf(
'E')) {
3219 Node *
T = getDerived().parseType();
3225 make<DynamicExceptionSpec>(popTrailingNodeArray(SpecsBegin));
3232 if (!consumeIf(
'F'))
3236 if (ReturnType ==
nullptr)
3240 size_t ParamsBegin = Names.size();
3246 if (consumeIf(
"RE")) {
3250 if (consumeIf(
"OE")) {
3254 Node *
T = getDerived().parseType();
3260 NodeArray Params = popTrailingNodeArray(ParamsBegin);
3261 return make<FunctionType>(
ReturnType, Params, CVQuals,
3262 ReferenceQualifier, ExceptionSpec);
3270 template <
typename Derived,
typename Alloc>
3272 if (!consumeIf(
"Dv"))
3274 if (look() >=
'1' && look() <=
'9') {
3276 if (!consumeIf(
'_'))
3279 return make<PixelVectorType>(DimensionNumber);
3280 Node *ElemType = getDerived().parseType();
3281 if (ElemType ==
nullptr)
3283 return make<VectorType>(ElemType, DimensionNumber);
3286 if (!consumeIf(
'_')) {
3287 Node *DimExpr = getDerived().parseExpr();
3290 if (!consumeIf(
'_'))
3292 Node *ElemType = getDerived().parseType();
3295 return make<VectorType>(ElemType, DimExpr);
3297 Node *ElemType = getDerived().parseType();
3300 return make<VectorType>(ElemType,
StringView());
3305 template <
typename Derived,
typename Alloc>
3307 if (!consumeIf(
'D'))
3309 if (!consumeIf(
't') && !consumeIf(
'T'))
3311 Node *
E = getDerived().parseExpr();
3314 if (!consumeIf(
'E'))
3316 return make<EnclosingExpr>(
"decltype(",
E,
")");
3321 template <
typename Derived,
typename Alloc>
3323 if (!consumeIf(
'A'))
3328 if (std::isdigit(look())) {
3329 Dimension = parseNumber();
3330 if (!consumeIf(
'_'))
3332 }
else if (!consumeIf(
'_')) {
3333 Node *DimExpr = getDerived().parseExpr();
3334 if (DimExpr ==
nullptr)
3336 if (!consumeIf(
'_'))
3338 Dimension = DimExpr;
3341 Node *Ty = getDerived().parseType();
3344 return make<ArrayType>(Ty, Dimension);
3348 template <
typename Derived,
typename Alloc>
3350 if (!consumeIf(
'M'))
3352 Node *ClassType = getDerived().parseType();
3353 if (ClassType ==
nullptr)
3355 Node *MemberType = getDerived().parseType();
3356 if (MemberType ==
nullptr)
3358 return make<PointerToMemberType>(ClassType, MemberType);
3365 template <
typename Derived,
typename Alloc>
3368 if (consumeIf(
"Ts"))
3369 ElabSpef =
"struct";
3370 else if (consumeIf(
"Tu"))
3372 else if (consumeIf(
"Te"))
3375 Node *
Name = getDerived().parseName();
3376 if (Name ==
nullptr)
3379 if (!ElabSpef.
empty())
3380 return make<ElaboratedTypeSpefType>(ElabSpef, Name);
3388 template <
typename Derived,
typename Alloc>
3390 if (consumeIf(
'U')) {
3403 SaveLast(Last, ProtoSourceName.
end());
3404 Proto = parseBareSourceName();
3408 Node *Child = getDerived().parseQualifiedType();
3409 if (Child ==
nullptr)
3411 return make<ObjCProtoName>(Child, Proto);
3414 Node *Child = getDerived().parseQualifiedType();
3415 if (Child ==
nullptr)
3417 return make<VendorExtQualType>(Child, Qual);
3421 Node *Ty = getDerived().parseType();
3425 Ty = make<QualType>(Ty, Quals);
3449 template <
typename Derived,
typename Alloc>
3451 Node *Result =
nullptr;
3458 unsigned AfterQuals = 0;
3459 if (look(AfterQuals) ==
'r') ++AfterQuals;
3460 if (look(AfterQuals) ==
'V') ++AfterQuals;
3461 if (look(AfterQuals) ==
'K') ++AfterQuals;
3463 if (look(AfterQuals) ==
'F' ||
3464 (look(AfterQuals) ==
'D' &&
3465 (look(AfterQuals + 1) ==
'o' || look(AfterQuals + 1) ==
'O' ||
3466 look(AfterQuals + 1) ==
'w' || look(AfterQuals + 1) ==
'x'))) {
3467 Result = getDerived().parseFunctionType();
3473 Result = getDerived().parseQualifiedType();
3479 return make<NameType>(
"void");
3483 return make<NameType>(
"wchar_t");
3487 return make<NameType>(
"bool");
3491 return make<NameType>(
"char");
3495 return make<NameType>(
"signed char");
3499 return make<NameType>(
"unsigned char");
3503 return make<NameType>(
"short");
3507 return make<NameType>(
"unsigned short");
3511 return make<NameType>(
"int");
3515 return make<NameType>(
"unsigned int");
3519 return make<NameType>(
"long");
3523 return make<NameType>(
"unsigned long");
3527 return make<NameType>(
"long long");
3531 return make<NameType>(
"unsigned long long");
3535 return make<NameType>(
"__int128");
3539 return make<NameType>(
"unsigned __int128");
3543 return make<NameType>(
"float");
3547 return make<NameType>(
"double");
3551 return make<NameType>(
"long double");
3555 return make<NameType>(
"__float128");
3559 return make<NameType>(
"...");
3567 return make<NameType>(Res);
3574 return make<NameType>(
"decimal64");
3578 return make<NameType>(
"decimal128");
3582 return make<NameType>(
"decimal32");
3586 return make<NameType>(
"decimal16");
3590 return make<NameType>(
"char32_t");
3594 return make<NameType>(
"char16_t");
3598 return make<NameType>(
"auto");
3602 return make<NameType>(
"decltype(auto)");
3606 return make<NameType>(
"std::nullptr_t");
3611 Result = getDerived().parseDecltype();
3616 Result = getDerived().parseVectorType();
3622 Node *Child = getDerived().parseType();
3625 Result = make<ParameterPackExpansion>(Child);
3634 Result = getDerived().parseFunctionType();
3640 Result = getDerived().parseFunctionType();
3645 Result = getDerived().parseArrayType();
3650 Result = getDerived().parsePointerToMemberType();
3656 if (look(1) ==
's' || look(1) ==
'u' || look(1) ==
'e') {
3657 Result = getDerived().parseClassEnumType();
3661 Result = getDerived().parseTemplateParam();
3662 if (Result ==
nullptr)
3675 if (TryToParseTemplateArgs && look() ==
'I') {
3676 Node *
TA = getDerived().parseTemplateArgs();
3679 Result = make<NameWithTemplateArgs>(Result,
TA);
3686 Node *Ptr = getDerived().parseType();
3689 Result = make<PointerType>(Ptr);
3695 Node *
Ref = getDerived().parseType();
3704 Node *
Ref = getDerived().parseType();
3713 Node *
P = getDerived().parseType();
3716 Result = make<PostfixQualifiedType>(
P,
" complex");
3722 Node *
P = getDerived().parseType();
3725 Result = make<PostfixQualifiedType>(
P,
" imaginary");
3730 if (look(1) && look(1) !=
't') {
3731 Node *Sub = getDerived().parseSubstitution();
3745 if (TryToParseTemplateArgs && look() ==
'I') {
3746 Node *
TA = getDerived().parseTemplateArgs();
3749 Result = make<NameWithTemplateArgs>(Sub,
TA);
3761 Result = getDerived().parseClassEnumType();
3769 if (Result !=
nullptr)
3770 Subs.push_back(Result);
3774 template <
typename Derived,
typename Alloc>
3776 Node *
E = getDerived().parseExpr();
3779 return make<PrefixExpr>(
Kind,
E);
3782 template <
typename Derived,
typename Alloc>
3784 Node *LHS = getDerived().parseExpr();
3787 Node *RHS = getDerived().parseExpr();
3790 return make<BinaryExpr>(LHS,
Kind, RHS);
3793 template <
typename Derived,
typename Alloc>
3797 if (!Tmp.
empty() && consumeIf(
'E'))
3798 return make<IntegerLiteral>(Lit, Tmp);
3803 template <
typename Alloc,
typename Derived>
3819 template <
typename Derived,
typename Alloc>
3821 if (consumeIf(
"fp")) {
3822 parseCVQualifiers();
3824 if (!consumeIf(
'_'))
3826 return make<FunctionParam>(Num);
3828 if (consumeIf(
"fL")) {
3829 if (parseNumber().empty())
3831 if (!consumeIf(
'p'))
3833 parseCVQualifiers();
3835 if (!consumeIf(
'_'))
3837 return make<FunctionParam>(Num);
3847 template <
typename Derived,
typename Alloc>
3849 bool Global = consumeIf(
"gs");
3850 bool IsArray = look(1) ==
'a';
3851 if (!consumeIf(
"nw") && !consumeIf(
"na"))
3853 size_t Exprs = Names.size();
3854 while (!consumeIf(
'_')) {
3855 Node *Ex = getDerived().parseExpr();
3858 Names.push_back(Ex);
3860 NodeArray ExprList = popTrailingNodeArray(Exprs);
3861 Node *Ty = getDerived().parseType();
3864 if (consumeIf(
"pi")) {
3865 size_t InitsBegin = Names.size();
3866 while (!consumeIf(
'E')) {
3867 Node *
Init = getDerived().parseExpr();
3868 if (Init ==
nullptr)
3870 Names.push_back(Init);
3872 NodeArray Inits = popTrailingNodeArray(InitsBegin);
3873 return make<NewExpr>(ExprList, Ty, Inits, Global, IsArray);
3874 }
else if (!consumeIf(
'E'))
3876 return make<NewExpr>(ExprList, Ty,
NodeArray(), Global, IsArray);
3881 template <
typename Derived,
typename Alloc>
3883 if (!consumeIf(
"cv"))
3888 Ty = getDerived().parseType();
3894 if (consumeIf(
'_')) {
3895 size_t ExprsBegin = Names.size();
3896 while (!consumeIf(
'E')) {
3897 Node *
E = getDerived().parseExpr();
3902 NodeArray Exprs = popTrailingNodeArray(ExprsBegin);
3903 return make<ConversionExpr>(Ty, Exprs);
3906 Node *
E[1] = {getDerived().parseExpr()};
3907 if (E[0] ==
nullptr)
3909 return make<ConversionExpr>(Ty, makeNodeArray(E, E + 1));
3918 template <
typename Derived,
typename Alloc>
3920 if (!consumeIf(
'L'))
3925 return getDerived().parseIntegerLiteral(
"wchar_t");
3927 if (consumeIf(
"b0E"))
3928 return make<BoolExpr>(0);
3929 if (consumeIf(
"b1E"))
3930 return make<BoolExpr>(1);
3934 return getDerived().parseIntegerLiteral(
"char");
3937 return getDerived().parseIntegerLiteral(
"signed char");
3940 return getDerived().parseIntegerLiteral(
"unsigned char");
3943 return getDerived().parseIntegerLiteral(
"short");
3946 return getDerived().parseIntegerLiteral(
"unsigned short");
3949 return getDerived().parseIntegerLiteral(
"");
3952 return getDerived().parseIntegerLiteral(
"u");
3955 return getDerived().parseIntegerLiteral(
"l");
3958 return getDerived().parseIntegerLiteral(
"ul");
3961 return getDerived().parseIntegerLiteral(
"ll");
3964 return getDerived().parseIntegerLiteral(
"ull");
3967 return getDerived().parseIntegerLiteral(
"__int128");
3970 return getDerived().parseIntegerLiteral(
"unsigned __int128");
3973 return getDerived().template parseFloatingLiteral<float>();
3976 return getDerived().template parseFloatingLiteral<double>();
3979 return getDerived().template parseFloatingLiteral<long double>();
3981 if (consumeIf(
"_Z")) {
3982 Node *R = getDerived().parseEncoding();
3983 if (R !=
nullptr && consumeIf(
'E'))
3993 Node *
T = getDerived().parseType();
3998 if (!consumeIf(
'E'))
4000 return make<IntegerCastExpr>(
T,
N);
4013 template <
typename Derived,
typename Alloc>
4015 if (look() ==
'd') {
4019 Node *
Field = getDerived().parseSourceName(
nullptr);
4020 if (Field ==
nullptr)
4022 Node *
Init = getDerived().parseBracedExpr();
4023 if (Init ==
nullptr)
4025 return make<BracedExpr>(
Field, Init,
false);
4030 if (Index ==
nullptr)
4032 Node *
Init = getDerived().parseBracedExpr();
4033 if (Init ==
nullptr)
4035 return make<BracedExpr>(
Index, Init,
true);
4039 Node *RangeBegin = getDerived().parseExpr();
4040 if (RangeBegin ==
nullptr)
4042 Node *RangeEnd = getDerived().parseExpr();
4043 if (RangeEnd ==
nullptr)
4045 Node *
Init = getDerived().parseBracedExpr();
4046 if (Init ==
nullptr)
4048 return make<BracedRangeExpr>(RangeBegin, RangeEnd, Init);
4052 return getDerived().parseExpr();
4060 template <
typename Derived,
typename Alloc>
4062 if (!consumeIf(
'f'))
4065 char FoldKind = look();
4066 bool IsLeftFold, HasInitializer;
4067 HasInitializer = FoldKind ==
'L' || FoldKind ==
'R';
4068 if (FoldKind ==
'l' || FoldKind ==
'L')
4070 else if (FoldKind ==
'r' || FoldKind ==
'R')
4078 if (consumeIf(
"aa")) OperatorName =
"&&";
4079 else if (consumeIf(
"an")) OperatorName =
"&";
4080 else if (consumeIf(
"aN")) OperatorName =
"&=";
4081 else if (consumeIf(
"aS")) OperatorName =
"=";
4082 else if (consumeIf(
"cm")) OperatorName =
",";
4083 else if (consumeIf(
"ds")) OperatorName =
".*";
4084 else if (consumeIf(
"dv")) OperatorName =
"/";
4085 else if (consumeIf(
"dV")) OperatorName =
"/=";
4086 else if (consumeIf(
"eo")) OperatorName =
"^";
4087 else if (consumeIf(
"eO")) OperatorName =
"^=";
4088 else if (consumeIf(
"eq")) OperatorName =
"==";
4089 else if (consumeIf(
"ge")) OperatorName =
">=";
4090 else if (consumeIf(
"gt")) OperatorName =
">";
4091 else if (consumeIf(
"le")) OperatorName =
"<=";
4092 else if (consumeIf(
"ls")) OperatorName =
"<<";
4093 else if (consumeIf(
"lS")) OperatorName =
"<<=";
4094 else if (consumeIf(
"lt")) OperatorName =
"<";
4095 else if (consumeIf(
"mi")) OperatorName =
"-";
4096 else if (consumeIf(
"mI")) OperatorName =
"-=";
4097 else if (consumeIf(
"ml")) OperatorName =
"*";
4098 else if (consumeIf(
"mL")) OperatorName =
"*=";
4099 else if (consumeIf(
"ne")) OperatorName =
"!=";
4100 else if (consumeIf(
"oo")) OperatorName =
"||";
4101 else if (consumeIf(
"or")) OperatorName =
"|";
4102 else if (consumeIf(
"oR")) OperatorName =
"|=";
4103 else if (consumeIf(
"pl")) OperatorName =
"+";
4104 else if (consumeIf(
"pL")) OperatorName =
"+=";
4105 else if (consumeIf(
"rm")) OperatorName =
"%";
4106 else if (consumeIf(
"rM")) OperatorName =
"%=";
4107 else if (consumeIf(
"rs")) OperatorName =
">>";
4108 else if (consumeIf(
"rS")) OperatorName =
">>=";
4109 else return nullptr;
4111 Node *Pack = getDerived().parseExpr(), *
Init =
nullptr;
4112 if (Pack ==
nullptr)
4114 if (HasInitializer) {
4115 Init = getDerived().parseExpr();
4116 if (
Init ==
nullptr)
4120 if (IsLeftFold &&
Init)
4123 return make<FoldExpr>(IsLeftFold, OperatorName, Pack,
Init);
4170 template <
typename Derived,
typename Alloc>
4172 bool Global = consumeIf(
"gs");
4178 return getDerived().parseExprPrimary();
4180 return getDerived().parseTemplateParam();
4183 if (look(1) ==
'p' || (look(1) ==
'L' && std::isdigit(look(2))))
4184 return getDerived().parseFunctionParam();
4185 return getDerived().parseFoldExpr();
4191 return getDerived().parseBinaryExpr(
"&&");
4194 return getDerived().parsePrefixExpr(
"&");
4197 return getDerived().parseBinaryExpr(
"&");
4200 return getDerived().parseBinaryExpr(
"&=");
4203 return getDerived().parseBinaryExpr(
"=");
4206 Node *Ty = getDerived().parseType();
4209 return make<EnclosingExpr>(
"alignof (", Ty,
")");
4213 Node *Ty = getDerived().parseExpr();
4216 return make<EnclosingExpr>(
"alignof (", Ty,
")");
4225 Node *Ty = getDerived().parseType();
4228 Node *Ex = getDerived().parseExpr();
4231 return make<CastExpr>(
"const_cast", Ty, Ex);
4237 if (Callee ==
nullptr)
4239 size_t ExprsBegin = Names.size();
4240 while (!consumeIf(
'E')) {
4241 Node *
E = getDerived().parseExpr();
4246 return make<CallExpr>(Callee, popTrailingNodeArray(ExprsBegin));
4250 return getDerived().parseBinaryExpr(
",");
4253 return getDerived().parsePrefixExpr(
"~");
4255 return getDerived().parseConversionExpr();
4262 Node *Ex = getDerived().parseExpr();
4265 return make<DeleteExpr>(Ex, Global,
true);
4269 Node *
T = getDerived().parseType();
4272 Node *Ex = getDerived().parseExpr();
4275 return make<CastExpr>(
"dynamic_cast",
T, Ex);
4279 return getDerived().parsePrefixExpr(
"*");
4282 Node *
E = getDerived().parseExpr();
4285 return make<DeleteExpr>(
E, Global,
false);
4288 return getDerived().parseUnresolvedName();
4291 Node *LHS = getDerived().parseExpr();
4294 Node *RHS = getDerived().parseExpr();
4297 return make<MemberExpr>(LHS,
".*", RHS);
4301 Node *LHS = getDerived().parseExpr();
4304 Node *RHS = getDerived().parseExpr();
4307 return make<MemberExpr>(LHS,
".", RHS);
4311 return getDerived().parseBinaryExpr(
"/");
4314 return getDerived().parseBinaryExpr(
"/=");
4321 return getDerived().parseBinaryExpr(
"^");
4324 return getDerived().parseBinaryExpr(
"^=");
4327 return getDerived().parseBinaryExpr(
"==");
4334 return getDerived().parseBinaryExpr(
">=");
4337 return getDerived().parseBinaryExpr(
">");
4344 Node *
Base = getDerived().parseExpr();
4345 if (Base ==
nullptr)
4348 if (Index ==
nullptr)
4350 return make<ArraySubscriptExpr>(Base,
Index);
4354 size_t InitsBegin = Names.size();
4355 while (!consumeIf(
'E')) {
4356 Node *
E = getDerived().parseBracedExpr();
4361 return make<InitListExpr>(
nullptr, popTrailingNodeArray(InitsBegin));
4369 return getDerived().parseBinaryExpr(
"<=");
4372 return getDerived().parseBinaryExpr(
"<<");
4375 return getDerived().parseBinaryExpr(
"<<=");
4378 return getDerived().parseBinaryExpr(
"<");
4385 return getDerived().parseBinaryExpr(
"-");
4388 return getDerived().parseBinaryExpr(
"-=");
4391 return getDerived().parseBinaryExpr(
"*");
4394 return getDerived().parseBinaryExpr(
"*=");
4398 return getDerived().parsePrefixExpr(
"--");
4399 Node *Ex = getDerived().parseExpr();
4402 return make<PostfixExpr>(Ex,
"--");
4409 return getDerived().parseNewExpr();
4412 return getDerived().parseBinaryExpr(
"!=");
4415 return getDerived().parsePrefixExpr(
"-");
4418 return getDerived().parsePrefixExpr(
"!");
4421 Node *Ex = getDerived().parseExpr();
4424 return make<EnclosingExpr>(
"noexcept (", Ex,
")");
4430 return getDerived().parseUnresolvedName();
4433 return getDerived().parseBinaryExpr(
"||");
4436 return getDerived().parseBinaryExpr(
"|");
4439 return getDerived().parseBinaryExpr(
"|=");
4446 return getDerived().parseBinaryExpr(
"->*");
4449 return getDerived().parseBinaryExpr(
"+");
4452 return getDerived().parseBinaryExpr(
"+=");
4456 return getDerived().parsePrefixExpr(
"++");
4457 Node *Ex = getDerived().parseExpr();
4460 return make<PostfixExpr>(Ex,
"++");
4464 return getDerived().parsePrefixExpr(
"+");
4467 Node *L = getDerived().parseExpr();
4470 Node *R = getDerived().parseExpr();
4473 return make<MemberExpr>(L,
"->", R);
4478 if (First[1] ==
'u') {
4480 Node *Cond = getDerived().parseExpr();
4481 if (Cond ==
nullptr)
4483 Node *LHS = getDerived().parseExpr();
4486 Node *RHS = getDerived().parseExpr();
4489 return make<ConditionalExpr>(Cond, LHS, RHS);
4496 Node *
T = getDerived().parseType();
4499 Node *Ex = getDerived().parseExpr();
4502 return make<CastExpr>(
"reinterpret_cast",
T, Ex);
4506 return getDerived().parseBinaryExpr(
"%");
4509 return getDerived().parseBinaryExpr(
"%=");
4512 return getDerived().parseBinaryExpr(
">>");
4515 return getDerived().parseBinaryExpr(
">>=");
4522 Node *
T = getDerived().parseType();
4525 Node *Ex = getDerived().parseExpr();
4528 return make<CastExpr>(
"static_cast",
T, Ex);
4532 Node *Child = getDerived().parseExpr();
4533 if (Child ==
nullptr)
4535 return make<ParameterPackExpansion>(Child);
4538 return getDerived().parseUnresolvedName();
4541 Node *Ty = getDerived().parseType();
4544 return make<EnclosingExpr>(
"sizeof (", Ty,
")");
4548 Node *Ex = getDerived().parseExpr();
4551 return make<EnclosingExpr>(
"sizeof (", Ex,
")");
4555 if (look() ==
'T') {
4556 Node *R = getDerived().parseTemplateParam();
4559 return make<SizeofParamPackExpr>(R);
4560 }
else if (look() ==
'f') {
4561 Node *
FP = getDerived().parseFunctionParam();
4564 return make<EnclosingExpr>(
"sizeof... (",
FP,
")");
4569 size_t ArgsBegin = Names.size();
4570 while (!consumeIf(
'E')) {
4571 Node *
Arg = getDerived().parseTemplateArg();
4574 Names.push_back(Arg);
4576 auto *Pack = make<NodeArrayNode>(popTrailingNodeArray(ArgsBegin));
4579 return make<EnclosingExpr>(
"sizeof... (", Pack,
")");
4587 Node *Ex = getDerived().parseExpr();
4590 return make<EnclosingExpr>(
"typeid (", Ex,
")");
4594 Node *Ty = getDerived().parseType();
4597 return make<EnclosingExpr>(
"typeid (", Ty,
")");
4601 Node *Ty = getDerived().parseType();
4604 size_t InitsBegin = Names.size();
4605 while (!consumeIf(
'E')) {
4606 Node *
E = getDerived().parseBracedExpr();
4611 return make<InitListExpr>(Ty, popTrailingNodeArray(InitsBegin));
4615 return make<NameType>(
"throw");
4618 Node *Ex = getDerived().parseExpr();
4621 return make<ThrowExpr>(Ex);
4634 return getDerived().parseUnresolvedName();
4647 template <
typename Alloc,
typename Derived>
4652 return parseNumber(
true).empty() || !consumeIf(
'_');
4654 return parseNumber(
true).empty() || !consumeIf(
'_') ||
4655 parseNumber(
true).empty() || !consumeIf(
'_');
4677 template <
typename Derived,
typename Alloc>
4685 Node *Ty = getDerived().parseType();
4688 return make<SpecialName>(
"vtable for ", Ty);
4693 Node *Ty = getDerived().parseType();
4696 return make<SpecialName>(
"VTT for ", Ty);
4701 Node *Ty = getDerived().parseType();
4704 return make<SpecialName>(
"typeinfo for ", Ty);
4709 Node *Ty = getDerived().parseType();
4712 return make<SpecialName>(
"typeinfo name for ", Ty);
4717 if (parseCallOffset() || parseCallOffset())
4719 Node *Encoding = getDerived().parseEncoding();
4720 if (Encoding ==
nullptr)
4722 return make<SpecialName>(
"covariant return thunk to ", Encoding);
4728 Node *FirstType = getDerived().parseType();
4729 if (FirstType ==
nullptr)
4731 if (parseNumber(
true).
empty() || !consumeIf(
'_'))
4733 Node *SecondType = getDerived().parseType();
4734 if (SecondType ==
nullptr)
4736 return make<CtorVtableSpecialName>(SecondType, FirstType);
4741 Node *
Name = getDerived().parseName();
4742 if (Name ==
nullptr)
4744 return make<SpecialName>(
"thread-local wrapper routine for ",
Name);
4749 Node *
Name = getDerived().parseName();
4750 if (Name ==
nullptr)
4752 return make<SpecialName>(
"thread-local initialization routine for ",
Name);
4757 bool IsVirt = look() ==
'v';
4758 if (parseCallOffset())
4760 Node *BaseEncoding = getDerived().parseEncoding();
4761 if (BaseEncoding ==
nullptr)
4764 return make<SpecialName>(
"virtual thunk to ", BaseEncoding);
4766 return make<SpecialName>(
"non-virtual thunk to ", BaseEncoding);
4774 Node *
Name = getDerived().parseName();
4775 if (Name ==
nullptr)
4777 return make<SpecialName>(
"guard variable for ",
Name);
4784 Node *
Name = getDerived().parseName();
4785 if (Name ==
nullptr)
4788 bool ParsedSeqId = !parseSeqId(&Count);
4789 if (!consumeIf(
'_') && ParsedSeqId)
4791 return make<SpecialName>(
"reference temporary for ",
Name);
4801 template <
typename Derived,
typename Alloc>
4803 if (look() ==
'G' || look() ==
'T')
4804 return getDerived().parseSpecialName();
4806 auto IsEndOfEncoding = [&] {
4810 return numLeft() == 0 || look() ==
'E' || look() ==
'.' || look() ==
'_';
4813 NameState NameInfo(
this);
4814 Node *
Name = getDerived().parseName(&NameInfo);
4815 if (Name ==
nullptr)
4818 if (resolveForwardTemplateRefs(NameInfo))
4821 if (IsEndOfEncoding())
4825 if (consumeIf(
"Ua9enable_ifI")) {
4826 size_t BeforeArgs = Names.size();
4827 while (!consumeIf(
'E')) {
4828 Node *
Arg = getDerived().parseTemplateArg();
4831 Names.push_back(Arg);
4833 Attrs = make<EnableIfAttr>(popTrailingNodeArray(BeforeArgs));
4839 if (!NameInfo.CtorDtorConversion && NameInfo.EndsWithTemplateArgs) {
4840 ReturnType = getDerived().parseType();
4841 if (ReturnType ==
nullptr)
4847 Attrs, NameInfo.CVQualifiers,
4848 NameInfo.ReferenceQualifier);
4850 size_t ParamsBegin = Names.size();
4852 Node *Ty = getDerived().parseType();
4855 Names.push_back(Ty);
4856 }
while (!IsEndOfEncoding());
4859 popTrailingNodeArray(ParamsBegin),
4860 Attrs, NameInfo.CVQualifiers,
4861 NameInfo.ReferenceQualifier);
4864 template <
class Float>
4870 static const size_t mangled_size = 8;
4871 static const size_t max_demangled_size = 24;
4872 static constexpr
const char* spec =
"%af";
4878 static const size_t mangled_size = 16;
4879 static const size_t max_demangled_size = 32;
4880 static constexpr
const char* spec =
"%a";
4886 #if defined(__mips__) && defined(__mips_n64) || defined(__aarch64__) || \ 4888 static const size_t mangled_size = 32;
4889 #elif defined(__arm__) || defined(__mips__) || defined(__hexagon__) 4890 static const size_t mangled_size = 16;
4892 static const size_t mangled_size = 20;
4894 static const size_t max_demangled_size = 40;
4895 static constexpr
const char *spec =
"%LaL";
4898 template <
typename Alloc,
typename Derived>
4899 template <
class Float>
4906 if (!std::isxdigit(
C))
4909 if (!consumeIf(
'E'))
4911 return make<FloatLiteralImpl<Float>>(Data);
4915 template <
typename Alloc,
typename Derived>
4917 if (!(look() >=
'0' && look() <=
'9') &&
4918 !(look() >=
'A' && look() <=
'Z'))
4923 if (look() >=
'0' && look() <=
'9') {
4925 Id +=
static_cast<size_t>(look() -
'0');
4926 }
else if (look() >=
'A' && look() <=
'Z') {
4928 Id +=
static_cast<size_t>(look() -
'A') + 10;
4947 template <
typename Derived,
typename Alloc>
4949 if (!consumeIf(
'S'))
4952 if (std::islower(look())) {
4987 Node *WithTags = getDerived().parseAbiTags(SpecialSub);
4988 if (WithTags != SpecialSub) {
4989 Subs.push_back(WithTags);
4990 SpecialSub = WithTags;
4996 if (consumeIf(
'_')) {
5004 if (parseSeqId(&Index))
5007 if (!consumeIf(
'_') || Index >= Subs.size())
5014 template <
typename Derived,
typename Alloc>
5016 if (!consumeIf(
'T'))
5020 if (!consumeIf(
'_')) {
5021 if (parsePositiveInteger(&Index))
5024 if (!consumeIf(
'_'))
5030 if (ParsingLambdaParams)
5031 return make<NameType>(
"auto");
5036 if (PermitForwardTemplateReferences) {
5037 Node *ForwardRef = make<ForwardTemplateReference>(
Index);
5040 assert(ForwardRef->
getKind() == Node::KForwardTemplateReference);
5041 ForwardTemplateRefs.push_back(
5042 static_cast<ForwardTemplateReference *>(ForwardRef));
5046 if (Index >= TemplateParams.size())
5048 return TemplateParams[
Index];
5056 template <
typename Derived,
typename Alloc>
5061 Node *
Arg = getDerived().parseExpr();
5062 if (Arg ==
nullptr || !consumeIf(
'E'))
5068 size_t ArgsBegin = Names.size();
5069 while (!consumeIf(
'E')) {
5070 Node *
Arg = getDerived().parseTemplateArg();
5073 Names.push_back(Arg);
5076 return make<TemplateArgumentPack>(
Args);
5080 if (look(1) ==
'Z') {
5082 Node *
Arg = getDerived().parseEncoding();
5083 if (Arg ==
nullptr || !consumeIf(
'E'))
5088 return getDerived().parseExprPrimary();
5091 return getDerived().parseType();
5097 template <
typename Derived,
typename Alloc>
5100 if (!consumeIf(
'I'))
5106 TemplateParams.clear();
5108 size_t ArgsBegin = Names.size();
5109 while (!consumeIf(
'E')) {
5111 auto OldParams = std::move(TemplateParams);
5112 Node *
Arg = getDerived().parseTemplateArg();
5113 TemplateParams = std::move(OldParams);
5116 Names.push_back(Arg);
5118 if (Arg->
getKind() == Node::KTemplateArgumentPack) {
5119 TableEntry = make<ParameterPack>(
5124 TemplateParams.push_back(TableEntry);
5126 Node *
Arg = getDerived().parseTemplateArg();
5129 Names.push_back(Arg);
5132 return make<TemplateArgs>(popTrailingNodeArray(ArgsBegin));
5140 template <
typename Derived,
typename Alloc>
5142 if (consumeIf(
"_Z")) {
5143 Node *Encoding = getDerived().parseEncoding();
5144 if (Encoding ==
nullptr)
5146 if (look() ==
'.') {
5147 Encoding = make<DotSuffix>(Encoding,
StringView(First, Last));
5155 if (consumeIf(
"___Z")) {
5156 Node *Encoding = getDerived().parseEncoding();
5157 if (Encoding ==
nullptr || !consumeIf(
"_block_invoke"))
5159 bool RequireNumber = consumeIf(
'_');
5160 if (parseNumber().
empty() && RequireNumber)
5166 return make<SpecialName>(
"invocation function for block in ", Encoding);
5169 Node *Ty = getDerived().parseType();
5175 template <
typename Alloc>
5184 #endif // LLVM_DEMANGLE_ITANIUMDEMANGLE_H Node * parseTemplateArgs(bool TagTemplates=false)
bool hasArraySlow(OutputStream &S) const override
StringView getBaseName() const override
bool hasRHSComponentSlow(OutputStream &S) const override
bool startsWith(char C) const
bool hasArray(OutputStream &S) const
void visit(Fn F) const
Visit the most-derived object corresponding to this object.
NodeArray getElements() const
const_iterator end(StringRef path)
Get end iterator over path.
void printLeft(OutputStream &s) const override
Node * parseIntegerLiteral(StringView Lit)
void printLeft(OutputStream &S) const override
ArrayType(const Node *Base_, NodeOrString Dimension_)
StringView dropFront(size_t N=1) const
void printLeft(OutputStream &S) const override
void printLeft(OutputStream &S) const override
VectorType(const Node *BaseType_, NodeOrString Dimension_)
Node * parseQualifiedType()
SpecialName(StringView Special_, const Node *Child_)
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
PODSmallVector< ForwardTemplateReference *, 4 > ForwardTemplateRefs
void printLeft(OutputStream &S) const override
void printLeft(OutputStream &s) const override
ForwardTemplateReference(size_t Index_)
This class represents lattice values for constants.
InitListExpr(const Node *Ty_, NodeArray Inits_)
void printLeft(OutputStream &S) const override
const Node * getSyntaxNode(OutputStream &S) const override
UnnamedTypeName(StringView Count_)
NodeArray makeNodeArray(It begin, It end)
constexpr Node::Kind getFloatLiteralKind(long double *)
Node * parseTemplateArg()
Node * parseBaseUnresolvedName()
PostfixQualifiedType(Node *Ty_, StringView Postfix_)
bool parseSeqId(size_t *Out)
GlobalQualifiedName(Node *Child_)
SpecialSubstitution(SpecialSubKind SSK_)
Node * operator[](size_t Idx) const
NodeArrayNode(NodeArray Array_)
void printLeft(OutputStream &S) const override
LLVM_DUMP_METHOD void dump() const
void printLeft(OutputStream &S) const override
void printLeft(OutputStream &S) const override
VendorExtQualType(const Node *Ty_, StringView Ext_)
TemplateArgs(NodeArray Params_)
void printLeft(OutputStream &S) const override
StringView getBaseName() const override
CallExpr(const Node *Callee_, NodeArray Args_)
#define ENUMERATOR(NodeKind)
SizeofParamPackExpr(const Node *Pack_)
FunctionParam(StringView Number_)
Cache
Three-way bool to track a cached value.
Node * make(Args &&... args)
bool hasArraySlow(OutputStream &S) const override
bool parsePositiveInteger(size_t *Out)
void printLeft(OutputStream &S) const override
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
StringView getBaseName() const override
void printLeft(OutputStream &S) const override
Node * parsePrefixExpr(StringView Kind)
PointerType(const Node *Pointee_)
void printLeft(OutputStream &S) const override
NestedName(Node *Qual_, Node *Name_)
CastExpr(StringView CastKind_, const Node *To_, const Node *From_)
Node * parseBinaryExpr(StringView Kind)
Node * parsePointerToMemberType()
void printLeft(OutputStream &S) const override
Node * parseUnscopedName(NameState *State)
Node * parseOperatorName(NameState *State)
T & operator[](size_t Index)
void printLeft(OutputStream &S) const override
gvn Early GVN Hoisting of Expressions
unsigned CurrentPackIndex
If a ParameterPackExpansion (or similar type) is encountered, the offset into the pack that we're cur...
void printLeft(OutputStream &S) const override
virtual const Node * getSyntaxNode(OutputStream &) const
QualifiedName(const Node *Qualifier_, const Node *Name_)
void printLeft(OutputStream &S) const override
void printLeft(OutputStream &S) const override
void printLeft(OutputStream &S) const override
const Node * getReturnType() const
bool match(Val *V, const Pattern &P)
void printLeft(OutputStream &S) const override
Node * parseLocalName(NameState *State)
amdgpu Simplify well known AMD library false Value Value const Twine & Name
EnableIfAttr(NodeArray Conditions_)
void printRight(OutputStream &S) const override
void printLeft(OutputStream &S) const override
constexpr Node::Kind getFloatLiteralKind(float *)
void printLeft(OutputStream &S) const override
NodeArray(Node **Elements_, size_t NumElements_)
ClosureTypeName(NodeArray Params_, StringView Count_)
Cache FunctionCache
Track if this node is a (possibly qualified) function type.
The access may reference the value stored in memory.
IntegerCastExpr(const Node *Ty_, StringView Integer_)
static StringRef getName(Value *V)
void printLeft(OutputStream &S) const override
DynamicExceptionSpec(NodeArray Types_)
ParameterPack(NodeArray Data_)
const Node * getName() const
void dropBack(size_t Index)
Node * parseSpecialName()
Cache ArrayCache
Track if this node is a (possibly qualified) array type.
DtorName(const Node *Base_)
Cache RHSComponentCache
Tracks if this node has a component on its right side, in which case we need to call printRight...
void printLeft(OutputStream &S) const override
bool hasRHSComponentSlow(OutputStream &) const override
void printLeft(OutputStream &S) const override
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
void printRight(OutputStream &s) const override
Node * parseSubstitution()
Node * parseClassEnumType()
TemplateArgumentPack(NodeArray Elements_)
ExpandedSpecialSubstitution(SpecialSubKind SSK_)
NodeArray popTrailingNodeArray(size_t FromPosition)
void printLeft(OutputStream &S) const override
Node * parseCtorDtorName(Node *&SoFar, NameState *State)
ThrowExpr(const Node *Op_)
const char * begin() const
Node * parseExprPrimary()
Node(Kind K_, Cache RHSComponentCache_=Cache::No, Cache ArrayCache_=Cache::No, Cache FunctionCache_=Cache::No)
void printLeft(OutputStream &S) const override
NewExpr(NodeArray ExprList_, Node *Type_, NodeArray InitList_, bool IsGlobal_, bool IsArray_)
Holds some extra information about a <name> that is being parsed.
virtual bool hasFunctionSlow(OutputStream &) const
ObjCProtoName(const Node *Ty_, StringView Protocol_)
#define FOR_EACH_NODE_KIND(X)
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
Node * parseName(NameState *State=nullptr)
Parse the <name> production>
void printLeft(OutputStream &S) const override
LocalName(Node *Encoding_, Node *Entity_)
amdgpu Simplify well known AMD library false Value * Callee
void printLeft(OutputStream &S) const override
void printWithComma(OutputStream &S) const
Node * parseFloatingLiteral()
void printLeft(OutputStream &S) const override
void printLeft(OutputStream &S) const override
BracedRangeExpr(const Node *First_, const Node *Last_, const Node *Init_)
StringView parseNumber(bool AllowNegative=false)
Node * parseUnresolvedName()
Parse the <unresolved-name> production.
NameState(AbstractManglingParser *Enclosing)
bool hasFunctionSlow(OutputStream &) const override
bool hasFunctionSlow(OutputStream &S) const override
The instances of the Type class are immutable: once they are created, they are never changed...
StdQualifiedName(Node *Child_)
Node * parseUnqualifiedName(NameState *State)
size_t getCurrentPosition() const
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
A variadic template argument.
void printLeft(OutputStream &S) const override
FoldExpr(bool IsLeftFold_, StringView OperatorName_, const Node *Pack_, const Node *Init_)
void setCurrentPosition(size_t NewPos)
Node * parseSourceName(NameState *State)
StringView getBaseName() const override
bool hasRHSComponentSlow(OutputStream &) const override
Node * parseNestedName(NameState *State)
bool isObjCObject() const
void printLeft(OutputStream &s) const override
void printLeft(OutputStream &S) const override
NoexceptSpec(const Node *E_)
ConversionExpr(const Node *Type_, NodeArray Expressions_)
PODSmallVector< Node *, 32 > Subs
void printLeft(OutputStream &S) const override
EnclosingExpr(StringView Prefix_, Node *Infix_, StringView Postfix_)
void printLeft(OutputStream &S) const override
void push_back(const T &Elem)
llvm::Expected< Value > parse(llvm::StringRef JSON)
Parses the provided JSON source, or returns a ParseError.
Node * parse()
Top-level entry point into the parser.
A forward-reference to a template argument that was not known at the point where the template paramet...
void printLeft(OutputStream &S) const override
void printLeft(OutputStream &S) const override
Node * parseExpr()
Parse the <expr> production.
An unexpanded parameter pack (either in the expression or type context).
CtorDtorName(const Node *Basename_, bool IsDtor_, int Variant_)
Node * parseUnresolvedType()
StringView getName() const
StringView getBaseName() const override
constexpr bool empty(const T &RangeOrContainer)
Test whether RangeOrContainer is empty. Similar to C++17 std::empty.
Node * parseType()
Parse the <type> production.
BaseType
A given derived pointer can have multiple base pointers through phi/selects.
void printLeft(OutputStream &S) const override
PointerToMemberType(const Node *ClassType_, const Node *MemberType_)
#define SPECIALIZATION(X)
Node * parseFunctionType()
bool hasRHSComponentSlow(OutputStream &S) const override
PixelVectorType(NodeOrString Dimension_)
PostfixExpr(const Node *Child_, StringView Operator_)
ReferenceType(const Node *Pointee_, ReferenceKind RK_)
void printLeft(OutputStream &S) const override
virtual StringView getBaseName() const
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
BlockVerifier::State From
virtual bool hasArraySlow(OutputStream &) const
Node * parseTemplateParam()
void printQuals(OutputStream &S) const
StringView getBaseName() const override
This is a utility class that provides an abstraction for the common functionality between Instruction...
IntegerLiteral(StringView Type_, StringView Value_)
void printLeft(OutputStream &S) const override
void printLeft(OutputStream &s) const override
void print(OutputStream &S) const
bool hasFunctionSlow(OutputStream &S) const override
void printLeft(OutputStream &S) const override
void reset(const char *First_, const char *Last_)
PODSmallVector< Node *, 8 > TemplateParams
void printRight(OutputStream &S) const override
Node * parseFunctionParam()
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
virtual bool hasRHSComponentSlow(OutputStream &) const
void printRight(OutputStream &s) const override
void printLeft(OutputStream &S) const override
ElaboratedTypeSpefType(StringView Kind_, Node *Child_)
bool resolveForwardTemplateRefs(NameState &State)
void printLeft(OutputStream &S) const override
void printLeft(OutputStream &S) const override
PODSmallVector< Node *, 32 > Names
bool hasArraySlow(OutputStream &S) const override
void printLeft(OutputStream &S) const override
bool hasRHSComponentSlow(OutputStream &S) const override
QualType(const Node *Child_, Qualifiers Quals_)
ParameterPackExpansion(const Node *Child_)
AbstractManglingParser(const char *First_, const char *Last_)
amdgpu Simplify well known AMD library false Value Value * Arg
PODSmallVector(PODSmallVector &&Other)
void printLeft(OutputStream &S) const override
bool hasRHSComponentSlow(OutputStream &) const override
void printLeft(OutputStream &s) const override
ConditionalExpr(const Node *Cond_, const Node *Then_, const Node *Else_)
DotSuffix(const Node *Prefix_, StringView Suffix_)
FunctionEncoding(const Node *Ret_, const Node *Name_, NodeArray Params_, const Node *Attrs_, Qualifiers CVQuals_, FunctionRefQual RefQual_)
const Node * getChild() const
bool hasRHSComponent(OutputStream &S) const
Qualifiers operator|=(Qualifiers &Q1, Qualifiers Q2)
DeleteExpr(Node *Op_, bool IsGlobal_, bool IsArray_)
BinaryExpr(const Node *LHS_, StringView InfixOperator_, const Node *RHS_)
void printRight(OutputStream &S) const override
bool hasRHSComponentSlow(OutputStream &S) const override
Node * parseConversionExpr()
void printLeft(OutputStream &s) const override
void printRight(OutputStream &S) const override
bool hasFunction(OutputStream &S) const
void printLeft(OutputStream &S) const override
ConversionOperatorType(const Node *Ty_)
bool hasFunctionSlow(OutputStream &) const override
void printLeft(OutputStream &S) const override
size_t ForwardTemplateRefsBegin
bool hasFunctionSlow(OutputStream &S) const override
void printLeft(OutputStream &S) const override
void printLeft(OutputStream &S) const override
StringView asString() const
Node * parseUnnamedTypeName(NameState *State)
StringView getBaseName() const override
NodeArray getParams() const
void printLeft(OutputStream &S) const override
void printLeft(OutputStream &s) const override
ArraySubscriptExpr(const Node *Op1_, const Node *Op2_)
bool hasRHSComponentSlow(OutputStream &S) const override
bool hasRHSComponentSlow(OutputStream &S) const override
StringView getBaseName() const override
FunctionRefQual getRefQual() const
const char * parse_discriminator(const char *first, const char *last)
const Node * getSyntaxNode(OutputStream &S) const override
void printRight(OutputStream &S) const override
char look(unsigned Lookahead=0)
void printLeft(OutputStream &S) const override
void printRight(OutputStream &s) const override
NameWithTemplateArgs(Node *Name_, Node *TemplateArgs_)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void printLeft(OutputStream &S) const override
LiteralOperator(const Node *OpName_)
virtual void printLeft(OutputStream &) const =0
void printLeft(OutputStream &S) const override
LLVM Value Representation.
FunctionType(const Node *Ret_, NodeArray Params_, Qualifiers CVQuals_, FunctionRefQual RefQual_, const Node *ExceptionSpec_)
Node * parseAbiTags(Node *N)
Node * parseDestructorName()
StructuredBindingName(NodeArray Bindings_)
Qualifiers getCVQuals() const
BracedExpr(const Node *Elem_, const Node *Init_, bool IsArray_)
const Node * asNode() const
CtorVtableSpecialName(const Node *FirstType_, const Node *SecondType_)
virtual void printRight(OutputStream &) const
FloatLiteralImpl(StringView Contents_)
void printRight(OutputStream &S) const override
void printLeft(OutputStream &S) const override
PODSmallVector & operator=(PODSmallVector &&Other)
Type * parseType(StringRef Asm, SMDiagnostic &Err, const Module &M, const SlotMapping *Slots=nullptr)
Parse a type in the given string.
void printLeft(OutputStream &S) const override
void printLeft(OutputStream &S) const override
OutputIt copy(R &&Range, OutputIt Out)
bool hasArraySlow(OutputStream &) const override
NodeOrString(StringView Str)
AbiTagAttr(Node *Base_, StringView Tag_)
NameType(StringView Name_)
bool consumeIf(StringView S)
Determine the kind of a node from its type.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
MemberExpr(const Node *LHS_, StringView Kind_, const Node *RHS_)
StringView parseBareSourceName()
void printLeft(OutputStream &S) const override
void printLeft(OutputStream &S) const override
Qualifiers parseCVQualifiers()
PrefixExpr(StringView Prefix_, Node *Child_)