aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lld/MachO/Symbols.cpp')
-rw-r--r--lld/MachO/Symbols.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/lld/MachO/Symbols.cpp b/lld/MachO/Symbols.cpp
index 87bbab00901f..4c83188fd259 100644
--- a/lld/MachO/Symbols.cpp
+++ b/lld/MachO/Symbols.cpp
@@ -14,6 +14,21 @@ using namespace llvm;
using namespace lld;
using namespace lld::macho;
+// Returns a symbol for an error message.
+static std::string demangle(StringRef symName) {
+ if (config->demangle)
+ return demangleItanium(symName);
+ return std::string(symName);
+}
+
+std::string lld::toString(const Symbol &sym) {
+ return demangle(sym.getName());
+}
+
+std::string lld::toMachOString(const object::Archive::Symbol &b) {
+ return demangle(b.getName());
+}
+
uint64_t Defined::getVA() const {
if (isAbsolute())
return value;
@@ -31,13 +46,6 @@ uint64_t Defined::getFileOffset() const {
void LazySymbol::fetchArchiveMember() { file->fetch(sym); }
-// Returns a symbol for an error message.
-std::string lld::toString(const Symbol &sym) {
- if (config->demangle)
- return demangleItanium(sym.getName());
- return std::string(sym.getName());
-}
-
uint64_t DSOHandle::getVA() const { return header->addr; }
uint64_t DSOHandle::getFileOffset() const { return header->fileOff; }