diff options
author | Luís Ferreira <contact@lsferreira.net> | 2021-12-30 18:04:21 +0000 |
---|---|---|
committer | Luís Ferreira <contact@lsferreira.net> | 2021-12-30 18:04:21 +0000 |
commit | 8792cd75d0ccc0a9043b5456f147a198a9d90cd2 (patch) | |
tree | 0b3cbd7640e6c715eab8955817b3efbdab5ad517 /lld/Common | |
parent | cd997689f26d1f6558ab7a04499bd5594d09861e (diff) | |
download | llvm-8792cd75d0ccc0a9043b5456f147a198a9d90cd2.tar.gz |
Revert "[lld] Add support for other demanglers other than Itanium"
This reverts commit e60d6dfd5acdc821d391ad5af2c706397bdfd36a.
clang-ppc64le-rhel buildbot failed (https://lab.llvm.org/buildbot#builders/57/builds/13424):
tools/lld/MachO/CMakeFiles/lldMachO.dir/Symbols.cpp.o: In function `lld::demangle(llvm::StringRef, bool)':
Symbols.cpp:(.text._ZN3lld8demangleEN4llvm9StringRefEb[_ZN3lld8demangleEN4llvm9StringRefEb]+0x90): undefined reference to `llvm::demangle(std::string const&)'
Diffstat (limited to 'lld/Common')
-rw-r--r-- | lld/Common/Strings.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lld/Common/Strings.cpp b/lld/Common/Strings.cpp index 6e5478e335ca..7bf336490dae 100644 --- a/lld/Common/Strings.cpp +++ b/lld/Common/Strings.cpp @@ -9,6 +9,7 @@ #include "lld/Common/Strings.h" #include "lld/Common/ErrorHandler.h" #include "lld/Common/LLVM.h" +#include "llvm/Demangle/Demangle.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/GlobPattern.h" #include <algorithm> @@ -18,6 +19,18 @@ using namespace llvm; using namespace lld; +// Returns the demangled C++ symbol name for name. +std::string lld::demangleItanium(StringRef name) { + // demangleItanium() can be called for all symbols. Only demangle C++ symbols, + // to avoid getting unexpected result for a C symbol that happens to match a + // mangled type name such as "Pi" (which would demangle to "int*"). + if (!name.startswith("_Z") && !name.startswith("__Z") && + !name.startswith("___Z") && !name.startswith("____Z")) + return std::string(name); + + return demangle(std::string(name)); +} + SingleStringMatcher::SingleStringMatcher(StringRef Pattern) { if (Pattern.size() > 2 && Pattern.startswith("\"") && Pattern.endswith("\"")) { |