[lld-macho][nfc] lld/Common's `demangle()` is redundant for Mach-O
authorJez Ng <jezng@fb.com>
Fri, 14 Oct 2022 19:28:15 +0000 (15:28 -0400)
committerJez Ng <jezng@fb.com>
Fri, 14 Oct 2022 19:28:47 +0000 (15:28 -0400)
The only thing that the Common implementation does is a check for
`config->demangle`, but {D135189} added that check to
`maybeDemangleSymbol`, so there's no need to go through `Common`...

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D135942

lld/MachO/Symbols.cpp

index a355376..e7a4e40 100644 (file)
@@ -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,9 +32,9 @@ static_assert(sizeof(SymbolUnion) == sizeof(Defined),
 static std::string maybeDemangleSymbol(StringRef symName) {
   if (config->demangle) {
     symName.consume_front("_");
-    return demangle(symName, true);
+    return demangle(symName.str());
   }
-  return std::string(symName);
+  return symName.str();
 }
 
 std::string lld::toString(const Symbol &sym) {