[PATCH] D148465: [Demangle] demangle builtin type transformations
Congcong Cai via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 16 07:20:22 PDT 2023
HerrCai0907 updated this revision to Diff 514007.
HerrCai0907 added a comment.
update
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148465/new/
https://reviews.llvm.org/D148465
Files:
llvm/include/llvm/Demangle/ItaniumDemangle.h
llvm/include/llvm/Demangle/ItaniumNodes.def
Index: llvm/include/llvm/Demangle/ItaniumNodes.def
===================================================================
--- llvm/include/llvm/Demangle/ItaniumNodes.def
+++ llvm/include/llvm/Demangle/ItaniumNodes.def
@@ -19,6 +19,7 @@
NODE(ConversionOperatorType)
NODE(PostfixQualifiedType)
NODE(ElaboratedTypeSpefType)
+NODE(TransformedType)
NODE(NameType)
NODE(AbiTagAttr)
NODE(EnableIfAttr)
Index: llvm/include/llvm/Demangle/ItaniumDemangle.h
===================================================================
--- llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -527,6 +527,23 @@
}
};
+class TransformedType : public Node {
+ StringView Transform;
+ Node *BaseType;
+public:
+ TransformedType(StringView Transform_, Node *BaseType_)
+ : Node(KTransformedType), Transform(Transform_), BaseType(BaseType_) {}
+
+ template<typename Fn> void match(Fn F) const { F(Transform, BaseType); }
+
+ void printLeft(OutputBuffer &OB) const override {
+ OB += Transform;
+ OB += '(';
+ BaseType->print(OB);
+ OB += ')';
+ }
+};
+
struct AbiTagAttr : Node {
Node *Base;
StringView Tag;
@@ -3884,7 +3901,15 @@
// Typically, <builtin-type>s are not considered substitution candidates,
// but the exception to that exception is vendor extended types (Itanium C++
// ABI 5.9.1).
- Result = make<NameType>(Res);
+ if (consumeIf('I')) {
+ Node *BaseType = parseType();
+ if (BaseType == nullptr)
+ return nullptr;
+ if (!consumeIf('E'))
+ return nullptr;
+ Result = make<TransformedType>(Res, BaseType);
+ } else
+ Result = make<NameType>(Res);
break;
}
case 'D':
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148465.514007.patch
Type: text/x-patch
Size: 1710 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230416/a3328dbe/attachment.bin>
More information about the llvm-commits
mailing list