[PATCH] D135942: [lld-macho][nfc] lld/Common's `demangle()` is redundant for Mach-O

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 13 23:04:50 PDT 2022


int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added projects: lld-macho, All.
int3 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The only thing that the Common implementation does is a check for
`config->demangle`, but D135189: [lld/mac] With -demangle, strip leading _ from non-mangled names <https://reviews.llvm.org/D135189> added that check to
`maybeDemangleSymbol`, so there's no need to go through `Common`...


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135942

Files:
  lld/MachO/Symbols.cpp


Index: lld/MachO/Symbols.cpp
===================================================================
--- lld/MachO/Symbols.cpp
+++ lld/MachO/Symbols.cpp
@@ -9,7 +9,7 @@
 #include "Symbols.h"
 #include "InputFiles.h"
 #include "SyntheticSections.h"
-#include "lld/Common/Strings.h"
+#include "llvm/Demangle/Demangle.h"
 
 using namespace llvm;
 using namespace lld;
@@ -32,7 +32,7 @@
 static std::string maybeDemangleSymbol(StringRef symName) {
   if (config->demangle) {
     symName.consume_front("_");
-    return demangle(symName, true);
+    return demangle(std::string(symName));
   }
   return std::string(symName);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135942.467686.patch
Type: text/x-patch
Size: 621 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221014/b3816a71/attachment.bin>


More information about the llvm-commits mailing list