[llvm] [llvm][aarch64] Fix Arm64EC name mangling algorithm (PR #115567)
Daniel Paoliello via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 13 12:25:30 PST 2024
================
@@ -302,14 +302,23 @@ std::optional<std::string> llvm::getArm64ECMangledFunctionName(StringRef Name) {
// Insert the ARM64EC "$$h" tag after the mangled function name.
if (Name.contains("$$h"))
return std::nullopt;
- size_t InsertIdx = Name.find("@@");
- size_t ThreeAtSignsIdx = Name.find("@@@");
- if (InsertIdx != std::string::npos && InsertIdx != ThreeAtSignsIdx) {
+
+ // The last 4 characters of the symbol type may contain a `@@` if the symbol
+ // is returning a qualified type. We don't want to insert `$$h` at that point.
+ auto TrimmedName = Name.drop_back(4);
+
+ // The last `@@` is the separation between the qualified name of the symbol
+ // and its type, which is where we want to insert `$$h`.
----------------
dpaoliello wrote:
Turns out using the real demangler was fairly easy. Also added your new test case.
https://github.com/llvm/llvm-project/pull/115567
More information about the llvm-commits
mailing list