1 //===- Strings.cpp -------------------------------------------------------===//
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
16 #pragma comment(lib, "dbghelp.lib")
20 using namespace lld::coff;
23 Optional<std::string> coff::demangleMSVC(StringRef S) {
25 // UnDecorateSymbolName is not thread-safe, so we need a mutex.
27 std::lock_guard<std::mutex> Lock(Mu);
30 if (S.startswith("?"))
31 if (size_t Len = UnDecorateSymbolName(S.str().c_str(), Buf, sizeof(Buf), 0))
32 return std::string(Buf, Len);