[PATCH] D111431: [Demangle] Add support for D function literals and null literal value
Luís Ferreira via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 8 08:45:58 PDT 2021
ljmf00 created this revision.
ljmf00 added a project: LLVM.
Herald added a subscriber: hiraditya.
ljmf00 requested review of this revision.
Herald added a subscriber: llvm-commits.
Signed-off-by: Luís Ferreira <contact at lsferreira.net>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D111431
Files:
llvm/lib/Demangle/DLangDemangle.cpp
llvm/unittests/Demangle/DLangDemangleTest.cpp
Index: llvm/unittests/Demangle/DLangDemangleTest.cpp
===================================================================
--- llvm/unittests/Demangle/DLangDemangleTest.cpp
+++ llvm/unittests/Demangle/DLangDemangleTest.cpp
@@ -318,7 +318,10 @@
{"_D8demangle28__T4testVS8demangle1SS2i1i2Zv",
"demangle.test!(demangle.S(1, 2))"},
{"_D8demangle35__T4testVS8demangle1SS2i1a3_616263Zv",
- "demangle.test!(demangle.S(1, \"abc\"))"}
+ "demangle.test!(demangle.S(1, \"abc\"))"},
+ {"_D8demangle13__T4testVPinZv", "demangle.test!(null)"},
+ {"_D8demangle__T3abcS_DQt10__lambda13FNaNbNiNfZiZQBhFZi",
+ "demangle.abc!(demangle.__lambda13()).abc()"}
};
for (ExpectedVal Val : ExpectedArray) {
Index: llvm/lib/Demangle/DLangDemangle.cpp
===================================================================
--- llvm/lib/Demangle/DLangDemangle.cpp
+++ llvm/lib/Demangle/DLangDemangle.cpp
@@ -1736,6 +1736,12 @@
return nullptr;
switch (*Mangled) {
+ // Null value
+ case 'n':
+ Mangled++;
+ Decl->append("null");
+ break;
+
// Integral values
case 'N':
Mangled++;
@@ -1803,6 +1809,14 @@
Mangled = parseStructLiteral(Decl, Mangled, Name);
break;
+ // Function literal symbol
+ case 'f':
+ Mangled++;
+ if (strncmp(Mangled, "_D", 2) != 0 || !isSymbolName(Mangled + 2))
+ return nullptr;
+ Mangled = parseMangle(Decl, Mangled);
+ break;
+
default:
return nullptr;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111431.378253.patch
Type: text/x-patch
Size: 1477 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211008/2fc65a6c/attachment.bin>
More information about the llvm-commits
mailing list