[lld] 316123a - [lld-macho][nfc] lld/Common's `demangle()` is redundant for Mach-O

Jez Ng via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 14 12:29:06 PDT 2022


Author: Jez Ng
Date: 2022-10-14T15:28:47-04:00
New Revision: 316123a2fce299ab86bceea67049b089efb11b9b

URL: https://github.com/llvm/llvm-project/commit/316123a2fce299ab86bceea67049b089efb11b9b
DIFF: https://github.com/llvm/llvm-project/commit/316123a2fce299ab86bceea67049b089efb11b9b.diff

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

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

Added: 
    

Modified: 
    lld/MachO/Symbols.cpp

Removed: 
    


################################################################################
diff  --git a/lld/MachO/Symbols.cpp b/lld/MachO/Symbols.cpp
index a3553769d6f1..e7a4e4089a74 100644
--- a/lld/MachO/Symbols.cpp
+++ b/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,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) {


        


More information about the llvm-commits mailing list