diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/libs/llvm12/include/llvm/Demangle | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/include/llvm/Demangle')
-rw-r--r-- | contrib/libs/llvm12/include/llvm/Demangle/ItaniumDemangle.h | 334 | ||||
-rw-r--r-- | contrib/libs/llvm12/include/llvm/Demangle/Utility.h | 2 |
2 files changed, 168 insertions, 168 deletions
diff --git a/contrib/libs/llvm12/include/llvm/Demangle/ItaniumDemangle.h b/contrib/libs/llvm12/include/llvm/Demangle/ItaniumDemangle.h index 09d4e42b85..da87cd2d14 100644 --- a/contrib/libs/llvm12/include/llvm/Demangle/ItaniumDemangle.h +++ b/contrib/libs/llvm12/include/llvm/Demangle/ItaniumDemangle.h @@ -89,7 +89,7 @@ X(PostfixExpr) \ X(ConditionalExpr) \ X(MemberExpr) \ - X(SubobjectExpr) \ + X(SubobjectExpr) \ X(EnclosingExpr) \ X(CastExpr) \ X(SizeofParamPackExpr) \ @@ -99,7 +99,7 @@ X(PrefixExpr) \ X(FunctionParam) \ X(ConversionExpr) \ - X(PointerToMemberConversionExpr) \ + X(PointerToMemberConversionExpr) \ X(InitListExpr) \ X(FoldExpr) \ X(ThrowExpr) \ @@ -1671,40 +1671,40 @@ public: } }; -class SubobjectExpr : public Node { - const Node *Type; - const Node *SubExpr; - StringView Offset; - NodeArray UnionSelectors; - bool OnePastTheEnd; - -public: - SubobjectExpr(const Node *Type_, const Node *SubExpr_, StringView Offset_, - NodeArray UnionSelectors_, bool OnePastTheEnd_) - : Node(KSubobjectExpr), Type(Type_), SubExpr(SubExpr_), Offset(Offset_), - UnionSelectors(UnionSelectors_), OnePastTheEnd(OnePastTheEnd_) {} - - template<typename Fn> void match(Fn F) const { - F(Type, SubExpr, Offset, UnionSelectors, OnePastTheEnd); - } - - void printLeft(OutputStream &S) const override { - SubExpr->print(S); - S += ".<"; - Type->print(S); - S += " at offset "; - if (Offset.empty()) { - S += "0"; - } else if (Offset[0] == 'n') { - S += "-"; - S += Offset.dropFront(); - } else { - S += Offset; - } - S += ">"; - } -}; - +class SubobjectExpr : public Node { + const Node *Type; + const Node *SubExpr; + StringView Offset; + NodeArray UnionSelectors; + bool OnePastTheEnd; + +public: + SubobjectExpr(const Node *Type_, const Node *SubExpr_, StringView Offset_, + NodeArray UnionSelectors_, bool OnePastTheEnd_) + : Node(KSubobjectExpr), Type(Type_), SubExpr(SubExpr_), Offset(Offset_), + UnionSelectors(UnionSelectors_), OnePastTheEnd(OnePastTheEnd_) {} + + template<typename Fn> void match(Fn F) const { + F(Type, SubExpr, Offset, UnionSelectors, OnePastTheEnd); + } + + void printLeft(OutputStream &S) const override { + SubExpr->print(S); + S += ".<"; + Type->print(S); + S += " at offset "; + if (Offset.empty()) { + S += "0"; + } else if (Offset[0] == 'n') { + S += "-"; + S += Offset.dropFront(); + } else { + S += Offset; + } + S += ">"; + } +}; + class EnclosingExpr : public Node { const StringView Prefix; const Node *Infix; @@ -1892,28 +1892,28 @@ public: } }; -class PointerToMemberConversionExpr : public Node { - const Node *Type; - const Node *SubExpr; - StringView Offset; - -public: - PointerToMemberConversionExpr(const Node *Type_, const Node *SubExpr_, - StringView Offset_) - : Node(KPointerToMemberConversionExpr), Type(Type_), SubExpr(SubExpr_), - Offset(Offset_) {} - - template<typename Fn> void match(Fn F) const { F(Type, SubExpr, Offset); } - - void printLeft(OutputStream &S) const override { - S += "("; - Type->print(S); - S += ")("; - SubExpr->print(S); - S += ")"; - } -}; - +class PointerToMemberConversionExpr : public Node { + const Node *Type; + const Node *SubExpr; + StringView Offset; + +public: + PointerToMemberConversionExpr(const Node *Type_, const Node *SubExpr_, + StringView Offset_) + : Node(KPointerToMemberConversionExpr), Type(Type_), SubExpr(SubExpr_), + Offset(Offset_) {} + + template<typename Fn> void match(Fn F) const { F(Type, SubExpr, Offset); } + + void printLeft(OutputStream &S) const override { + S += "("; + Type->print(S); + S += ")("; + SubExpr->print(S); + S += ")"; + } +}; + class InitListExpr : public Node { const Node *Ty; NodeArray Inits; @@ -2369,9 +2369,9 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser { TemplateParamList Params; public: - ScopedTemplateParamList(AbstractManglingParser *TheParser) - : Parser(TheParser), - OldNumTemplateParamLists(TheParser->TemplateParams.size()) { + ScopedTemplateParamList(AbstractManglingParser *TheParser) + : Parser(TheParser), + OldNumTemplateParamLists(TheParser->TemplateParams.size()) { Parser->TemplateParams.push_back(&Params); } ~ScopedTemplateParamList() { @@ -2493,8 +2493,8 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser { Node *parseConversionExpr(); Node *parseBracedExpr(); Node *parseFoldExpr(); - Node *parsePointerToMemberConversionExpr(); - Node *parseSubobjectExpr(); + Node *parsePointerToMemberConversionExpr(); + Node *parseSubobjectExpr(); /// Parse the <type> production. Node *parseType(); @@ -4462,50 +4462,50 @@ Node *AbstractManglingParser<Derived, Alloc>::parseFoldExpr() { return make<FoldExpr>(IsLeftFold, OperatorName, Pack, Init); } -// <expression> ::= mc <parameter type> <expr> [<offset number>] E -// -// Not yet in the spec: https://github.com/itanium-cxx-abi/cxx-abi/issues/47 -template <typename Derived, typename Alloc> -Node *AbstractManglingParser<Derived, Alloc>::parsePointerToMemberConversionExpr() { - Node *Ty = getDerived().parseType(); - if (!Ty) - return nullptr; - Node *Expr = getDerived().parseExpr(); - if (!Expr) - return nullptr; - StringView Offset = getDerived().parseNumber(true); - if (!consumeIf('E')) - return nullptr; - return make<PointerToMemberConversionExpr>(Ty, Expr, Offset); -} - -// <expression> ::= so <referent type> <expr> [<offset number>] <union-selector>* [p] E -// <union-selector> ::= _ [<number>] -// -// Not yet in the spec: https://github.com/itanium-cxx-abi/cxx-abi/issues/47 -template <typename Derived, typename Alloc> -Node *AbstractManglingParser<Derived, Alloc>::parseSubobjectExpr() { - Node *Ty = getDerived().parseType(); - if (!Ty) - return nullptr; - Node *Expr = getDerived().parseExpr(); - if (!Expr) - return nullptr; - StringView Offset = getDerived().parseNumber(true); - size_t SelectorsBegin = Names.size(); - while (consumeIf('_')) { - Node *Selector = make<NameType>(parseNumber()); - if (!Selector) - return nullptr; - Names.push_back(Selector); - } - bool OnePastTheEnd = consumeIf('p'); - if (!consumeIf('E')) - return nullptr; - return make<SubobjectExpr>( - Ty, Expr, Offset, popTrailingNodeArray(SelectorsBegin), OnePastTheEnd); -} - +// <expression> ::= mc <parameter type> <expr> [<offset number>] E +// +// Not yet in the spec: https://github.com/itanium-cxx-abi/cxx-abi/issues/47 +template <typename Derived, typename Alloc> +Node *AbstractManglingParser<Derived, Alloc>::parsePointerToMemberConversionExpr() { + Node *Ty = getDerived().parseType(); + if (!Ty) + return nullptr; + Node *Expr = getDerived().parseExpr(); + if (!Expr) + return nullptr; + StringView Offset = getDerived().parseNumber(true); + if (!consumeIf('E')) + return nullptr; + return make<PointerToMemberConversionExpr>(Ty, Expr, Offset); +} + +// <expression> ::= so <referent type> <expr> [<offset number>] <union-selector>* [p] E +// <union-selector> ::= _ [<number>] +// +// Not yet in the spec: https://github.com/itanium-cxx-abi/cxx-abi/issues/47 +template <typename Derived, typename Alloc> +Node *AbstractManglingParser<Derived, Alloc>::parseSubobjectExpr() { + Node *Ty = getDerived().parseType(); + if (!Ty) + return nullptr; + Node *Expr = getDerived().parseExpr(); + if (!Expr) + return nullptr; + StringView Offset = getDerived().parseNumber(true); + size_t SelectorsBegin = Names.size(); + while (consumeIf('_')) { + Node *Selector = make<NameType>(parseNumber()); + if (!Selector) + return nullptr; + Names.push_back(Selector); + } + bool OnePastTheEnd = consumeIf('p'); + if (!consumeIf('E')) + return nullptr; + return make<SubobjectExpr>( + Ty, Expr, Offset, popTrailingNodeArray(SelectorsBegin), OnePastTheEnd); +} + // <expression> ::= <unary operator-name> <expression> // ::= <binary operator-name> <expression> <expression> // ::= <ternary operator-name> <expression> <expression> <expression> @@ -4763,9 +4763,9 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExpr() { return nullptr; case 'm': switch (First[1]) { - case 'c': - First += 2; - return parsePointerToMemberConversionExpr(); + case 'c': + First += 2; + return parsePointerToMemberConversionExpr(); case 'i': First += 2; return getDerived().parseBinaryExpr("-"); @@ -4913,9 +4913,9 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExpr() { return Ex; return make<CastExpr>("static_cast", T, Ex); } - case 'o': - First += 2; - return parseSubobjectExpr(); + case 'o': + First += 2; + return parseSubobjectExpr(); case 'p': { First += 2; Node *Child = getDerived().parseExpr(); @@ -5011,43 +5011,43 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExpr() { } } return nullptr; - case 'u': { - ++First; - Node *Name = getDerived().parseSourceName(/*NameState=*/nullptr); - if (!Name) - return nullptr; - // Special case legacy __uuidof mangling. The 't' and 'z' appear where the - // standard encoding expects a <template-arg>, and would be otherwise be - // interpreted as <type> node 'short' or 'ellipsis'. However, neither - // __uuidof(short) nor __uuidof(...) can actually appear, so there is no - // actual conflict here. - if (Name->getBaseName() == "__uuidof") { - if (numLeft() < 2) - return nullptr; - if (*First == 't') { - ++First; - Node *Ty = getDerived().parseType(); - if (!Ty) - return nullptr; - return make<CallExpr>(Name, makeNodeArray(&Ty, &Ty + 1)); - } - if (*First == 'z') { - ++First; - Node *Ex = getDerived().parseExpr(); - if (!Ex) - return nullptr; - return make<CallExpr>(Name, makeNodeArray(&Ex, &Ex + 1)); - } - } - size_t ExprsBegin = Names.size(); - while (!consumeIf('E')) { - Node *E = getDerived().parseTemplateArg(); - if (E == nullptr) - return E; - Names.push_back(E); - } - return make<CallExpr>(Name, popTrailingNodeArray(ExprsBegin)); - } + case 'u': { + ++First; + Node *Name = getDerived().parseSourceName(/*NameState=*/nullptr); + if (!Name) + return nullptr; + // Special case legacy __uuidof mangling. The 't' and 'z' appear where the + // standard encoding expects a <template-arg>, and would be otherwise be + // interpreted as <type> node 'short' or 'ellipsis'. However, neither + // __uuidof(short) nor __uuidof(...) can actually appear, so there is no + // actual conflict here. + if (Name->getBaseName() == "__uuidof") { + if (numLeft() < 2) + return nullptr; + if (*First == 't') { + ++First; + Node *Ty = getDerived().parseType(); + if (!Ty) + return nullptr; + return make<CallExpr>(Name, makeNodeArray(&Ty, &Ty + 1)); + } + if (*First == 'z') { + ++First; + Node *Ex = getDerived().parseExpr(); + if (!Ex) + return nullptr; + return make<CallExpr>(Name, makeNodeArray(&Ex, &Ex + 1)); + } + } + size_t ExprsBegin = Names.size(); + while (!consumeIf('E')) { + Node *E = getDerived().parseTemplateArg(); + if (E == nullptr) + return E; + Names.push_back(E); + } + return make<CallExpr>(Name, popTrailingNodeArray(ExprsBegin)); + } case '1': case '2': case '3': @@ -5105,16 +5105,16 @@ Node *AbstractManglingParser<Derived, Alloc>::parseSpecialName() { switch (look()) { case 'T': switch (look(1)) { - // TA <template-arg> # template parameter object - // - // Not yet in the spec: https://github.com/itanium-cxx-abi/cxx-abi/issues/63 - case 'A': { - First += 2; - Node *Arg = getDerived().parseTemplateArg(); - if (Arg == nullptr) - return nullptr; - return make<SpecialName>("template parameter object for ", Arg); - } + // TA <template-arg> # template parameter object + // + // Not yet in the spec: https://github.com/itanium-cxx-abi/cxx-abi/issues/63 + case 'A': { + First += 2; + Node *Arg = getDerived().parseTemplateArg(); + if (Arg == nullptr) + return nullptr; + return make<SpecialName>("template parameter object for ", Arg); + } // TV <type> # virtual table case 'V': { First += 2; @@ -5243,7 +5243,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseEncoding() { decltype(TemplateParams) OldParams; public: - SaveTemplateParams(AbstractManglingParser *TheParser) : Parser(TheParser) { + SaveTemplateParams(AbstractManglingParser *TheParser) : Parser(TheParser) { OldParams = std::move(Parser->TemplateParams); Parser->TemplateParams.clear(); } @@ -5343,12 +5343,12 @@ struct FloatData<long double> #else static const size_t mangled_size = 20; // May need to be adjusted to 16 or 24 on other platforms #endif - // `-0x1.ffffffffffffffffffffffffffffp+16383` + 'L' + '\0' == 42 bytes. - // 28 'f's * 4 bits == 112 bits, which is the number of mantissa bits. - // Negatives are one character longer than positives. - // `0x1.` and `p` are constant, and exponents `+16383` and `-16382` are the - // same length. 1 sign bit, 112 mantissa bits, and 15 exponent bits == 128. - static const size_t max_demangled_size = 42; + // `-0x1.ffffffffffffffffffffffffffffp+16383` + 'L' + '\0' == 42 bytes. + // 28 'f's * 4 bits == 112 bits, which is the number of mantissa bits. + // Negatives are one character longer than positives. + // `0x1.` and `p` are constant, and exponents `+16383` and `-16382` are the + // same length. 1 sign bit, 112 mantissa bits, and 15 exponent bits == 128. + static const size_t max_demangled_size = 42; static constexpr const char *spec = "%LaL"; }; diff --git a/contrib/libs/llvm12/include/llvm/Demangle/Utility.h b/contrib/libs/llvm12/include/llvm/Demangle/Utility.h index 5b3d7575a6..36ab3deff5 100644 --- a/contrib/libs/llvm12/include/llvm/Demangle/Utility.h +++ b/contrib/libs/llvm12/include/llvm/Demangle/Utility.h @@ -59,7 +59,7 @@ class OutputStream { char *TempPtr = std::end(Temp); while (N) { - *--TempPtr = char('0' + N % 10); + *--TempPtr = char('0' + N % 10); N /= 10; } |