swift-demangle: don't require the $-prefix for embedded symbols

Support demangling `swift-demangle e4main8MyStructV3fooyyFAA1XV_Tg5` (note the missing $-prefix)
This commit is contained in:
Erik Eckstein
2025-01-28 17:35:25 +01:00
parent 7c821ed098
commit 1f36fa5c0b
2 changed files with 4 additions and 1 deletions

View File

@@ -1,4 +1,7 @@
; This is not really a Swift source file: -*- Text -*-
; RUN: echo '$e4main8MyStructV3fooyyFAA1XV_Tg5' | swift-demangle | %FileCheck %s
; RUN: swift-demangle '$e4main8MyStructV3fooyyFAA1XV_Tg5' | %FileCheck %s
; RUN: swift-demangle e4main8MyStructV3fooyyFAA1XV_Tg5 | %FileCheck %s
; CHECK: generic specialization <main.X> of main.MyStruct.foo() -> ()

View File

@@ -441,7 +441,7 @@ int main(int argc, char **argv) {
"is quoted or escaped.\n";
continue;
}
if (!DemangleType && (name.starts_with("S") || name.starts_with("s"))) {
if (!DemangleType && (name.starts_with("S") || name.starts_with("s") || name.starts_with("e"))) {
std::string correctedName = std::string("$") + name.str();
demangle(llvm::outs(), correctedName, DCtx, options);
} else {