1 //===- Symbols.cpp --------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "Symbols.h" 10 #include "InputFiles.h" 11 #include "lld/Common/ErrorHandler.h" 12 #include "lld/Common/Strings.h" 13 14 using namespace llvm; 15 using namespace lld; 16 using namespace lld::macho; 17 18 void LazySymbol::fetchArchiveMember() { file->fetch(sym); } 19 20 // Returns a symbol for an error message. 21 std::string lld::toString(const Symbol &sym) { 22 if (Optional<std::string> s = demangleItanium(sym.getName())) 23 return *s; 24 return std::string(sym.getName()); 25 } 26